From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#1267: Emacsclient can't find terminal in daemon mode Date: Wed, 29 Oct 2008 23:55:03 -0400 Message-ID: <87ljw6buug.fsf@cyd.mit.edu> References: <87r660gw33.fsf@cyd.mit.edu> <200810292306.m9TN6fE0017904@mothra.ics.uci.edu> <87zlknvuna.fsf@cyd.mit.edu> <200810300007.m9U07XYV017977@mothra.ics.uci.edu> <87skqe511f.fsf@cyd.mit.edu> <200810300214.m9U2Eor0018222@mothra.ics.uci.edu> Reply-To: Chong Yidong , 1267@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225339854 30200 80.91.229.12 (30 Oct 2008 04:10:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Oct 2008 04:10:54 +0000 (UTC) Cc: 1267@emacsbugs.donarmstrong.com To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 30 05:11:56 2008 connect(): Connection refused Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KvOsy-0006uz-IL for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 05:11:52 +0100 Original-Received: from localhost ([127.0.0.1]:33083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvOrs-0005X5-0X for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 00:10:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KvOrJ-00053W-UX for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 00:10:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KvOrI-00052f-At for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 00:10:09 -0400 Original-Received: from [199.232.76.173] (port=33151 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvOrI-00052V-5g for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 00:10:08 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:37801) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KvOrH-0006vj-UZ for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2008 00:10:08 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9U4A3Zt010539; Wed, 29 Oct 2008 21:10:03 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9U403CC007462; Wed, 29 Oct 2008 21:00:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 30 Oct 2008 04:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1267 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1267-submit@emacsbugs.donarmstrong.com id=B1267.12253389006119 (code B ref 1267); Thu, 30 Oct 2008 04:00:03 +0000 Original-Received: (at 1267) by emacsbugs.donarmstrong.com; 30 Oct 2008 03:55:00 +0000 Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9U3svA3006113 for <1267@emacsbugs.donarmstrong.com>; Wed, 29 Oct 2008 20:54:58 -0700 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 9C3B357E0BE; Wed, 29 Oct 2008 23:55:03 -0400 (EDT) In-Reply-To: <200810300214.m9U2Eor0018222@mothra.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 29 Oct 2008 19:14:50 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 30 Oct 2008 00:10:09 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:22031 Archived-At: How bout something on these lines? The effect is that instead of signalling an error when no -t or -c is passed and no usable frame exists, Emacs opens the tty of the calling emacsclient. *** trunk/lib-src/emacsclient.c.~1.135.~ 2008-10-29 11:38:04.000000000 -0400 --- trunk/lib-src/emacsclient.c 2008-10-29 23:10:45.000000000 -0400 *************** *** 1437,1443 **** send_to_emacs (emacs_socket, " "); } ! if (tty) { char *type = egetenv ("TERM"); char *tty_name = NULL; --- 1437,1443 ---- send_to_emacs (emacs_socket, " "); } ! if (tty || current_frame) { char *type = egetenv ("TERM"); char *tty_name = NULL; *** trunk/lisp/server.el.~1.170.~ 2008-10-29 11:38:05.000000000 -0400 --- trunk/lisp/server.el 2008-10-29 23:48:42.000000000 -0400 *************** *** 810,815 **** --- 810,816 ---- dontkill ; t if the client should not be killed. (commands ()) dir + use-current-frame (tty-name nil) ;nil, `window-system', or the tty name. tty-type ;string. (files nil) *************** *** 830,836 **** ((equal "-nowait" arg) (setq nowait t)) ;; -current-frame: Don't create frames. ! ((equal "-current-frame" arg) (setq tty-name nil)) ;; -display DISPLAY: ;; Open X frames on the given display instead of the default. --- 831,837 ---- ((equal "-nowait" arg) (setq nowait t)) ;; -current-frame: Don't create frames. ! ((equal "-current-frame" arg) (setq use-current-frame t)) ;; -display DISPLAY: ;; Open X frames on the given display instead of the default. *************** *** 926,937 **** ;; Unknown command. (t (error "Unknown command: %s" arg)))) ! (setq frame ! (case tty-name ! ((nil) (if display (server-select-display display))) ! ((window-system) ! (server-create-window-system-frame display nowait proc)) ! (t (server-create-tty-frame tty-name tty-type proc)))) (process-put proc 'continuation --- 927,940 ---- ;; Unknown command. (t (error "Unknown command: %s" arg)))) ! (cond ((and use-current-frame ! (not (and (daemonp) ! (= (length (frame-list)) 1) ! (eq (selected-frame) terminal-frame)))) ! (if display (server-select-display display))) ! ((eq tty-name 'window-system) ! (server-create-window-system-frame display nowait proc)) ! (t (server-create-tty-frame tty-name tty-type proc))) (process-put proc 'continuation