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

Chong Yidong <cyd@stupidchicken.com> writes:

  > $ emacs --daemon
  > $ emacsclient foo.m
  > Waiting for Emacs...
  > 
  > Emacsclient then stops, waiting indefinitely (IIUC, it opens a frame on
  > the emacs daemon's "fake" terminal, which is inaccessible to the user).
  > By contrast, `emacsclient -c foo.m' and `emacsclient -t foo.m' do the
  > right thing.
  > 
  > I think the Emacs server should do the right thing automatically, but
  > dunno how hard that would that be to implement.

In you particular emacsly Emacs uses the "initial frame" to show the
file, which is probably not ideal.
This particular case can be solved by trying to see if the
`(selected-frame)' is FRAME_INITIAL_P (which is not exposed to elisp).
We can guess that if there's no window-system and tty-type frame
parameter we are dealing with the initial frame.

Not sure if this is good enough to cover all possible cases... 


--- server.el.~1.169.~	2008-10-26 09:34:53.000000000 -0700
+++ server.el	2008-10-29 15:46:55.000000000 -0700
@@ -814,6 +814,7 @@ The following commands are accepted by t
 		(files nil)
                 (filepos nil)
 		command-line-args-left
+		crt-frame
 		arg)
 	    ;; Remove this line from STRING.
 	    (setq string (substring string (match-end 0)))
@@ -829,7 +830,7 @@ The following commands are accepted by t
 		 ((equal "-nowait" arg) (setq nowait t))
 
 		 ;; -current-frame:  Don't create frames.
-		 ((equal "-current-frame" arg) (setq tty-name nil))
+		 ((equal "-current-frame" arg) (setq crt-frame t) (setq tty-name nil))
 
 		 ;; -display DISPLAY:
 		 ;; Open X frames on the given display instead of the default.
@@ -925,6 +926,15 @@ The following commands are accepted by t
 		 ;; Unknown command.
 		 (t (error "Unknown command: %s" arg))))
 
+	    (when (and crt-frame (not display))
+	      (let ((sframe (selected-frame)))
+		(unless
+		     (and
+		      ;; X frame
+		      (frame-parameter sframe 'window-system)
+		      ;; tty frame
+		      (frame-parameter sframe 'tty-type))
+		  (error "The current frame cannot be used, use -t or -c"))))
             (setq frame
                   (case tty-name
                     ((nil) (if display (server-select-display display)))
 






  reply	other threads:[~2008-10-29 23:06 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 [this message]
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
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=200810292306.m9TN6fE0017904@mothra.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=1267@emacsbugs.donarmstrong.com \
    --cc=cyd@stupidchicken.com \
    /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.