all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: 1267@emacsbugs.donarmstrong.com
Subject: bug#1267: Emacsclient can't find terminal in daemon mode
Date: Wed, 29 Oct 2008 23:55:03 -0400	[thread overview]
Message-ID: <87ljw6buug.fsf@cyd.mit.edu> (raw)
In-Reply-To: <200810300214.m9U2Eor0018222@mothra.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 29 Oct 2008 19:14:50 -0700 (PDT)")

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






  reply	other threads:[~2008-10-30  3:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87d4hif53r.fsf@cyd.mit.edu>
2008-10-28 23:04 ` bug#1267: Emacsclient can't find terminal in daemon mode Chong Yidong
2008-10-29 23:06   ` Dan Nicolaescu
2008-10-29 23:39     ` Chong Yidong
2008-10-30  0:07       ` Dan Nicolaescu
2008-10-30  1:23         ` Chong Yidong
2008-10-30  2:14           ` Dan Nicolaescu
2008-10-30  3:55             ` Chong Yidong [this message]
2008-10-30  5:25               ` Dan Nicolaescu
2008-10-30  2:40           ` Stefan Monnier
2008-10-30  1:05     ` Stefan Monnier
2008-10-30  2:15       ` Dan Nicolaescu
2008-10-30 16:05   ` bug#1267: marked as done (Emacsclient can't find terminal in daemon mode) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljw6buug.fsf@cyd.mit.edu \
    --to=cyd@stupidchicken.com \
    --cc=1267@emacsbugs.donarmstrong.com \
    --cc=dann@ics.uci.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.