changeset 91663:2b045ea84cf9

(decode_options): Pass --display implicitly if -c is specified. Only set tty if -t or -c is specified.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 08 Feb 2008 15:25:58 +0000
parents 9687e006eab2
children cb25fa691429
files lib-src/ChangeLog lib-src/emacsclient.c
diffstat 2 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Fri Feb 08 12:50:25 2008 +0000
+++ b/lib-src/ChangeLog	Fri Feb 08 15:25:58 2008 +0000
@@ -1,3 +1,8 @@
+2008-02-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacsclient.c (decode_options): Pass --display implicitly if -c
+	is specified.  Only set tty if -t or -c is specified.
+
 2008-02-04  Jason Rumney  <jasonr@gnu.org>
 
 	* makefile.w32-in (lisp1): Use (), not {}.
--- a/lib-src/emacsclient.c	Fri Feb 08 12:50:25 2008 +0000
+++ b/lib-src/emacsclient.c	Fri Feb 08 15:25:58 2008 +0000
@@ -480,15 +480,6 @@
 {
   alternate_editor = egetenv ("ALTERNATE_EDITOR");
 
-  /* We used to set `display' to $DISPLAY by default, but this changed the
-     default behavior and is sometimes inconvenient.  So instead of forcing
-     users to say "--display ''" when they want to use Emacs's existing tty
-     or display connection, we force them to use "--display $DISPLAY" if
-     they want Emacs to connect to their current display.  */
-#if 0
-  display = egetenv ("DISPLAY");
-#endif
-
   while (1)
     {
       int opt = getopt_long (argc, argv,
@@ -566,13 +557,24 @@
 	}
     }
 
+  /* We used to set `display' to $DISPLAY by default, but this changed the
+     default behavior and is sometimes inconvenient.  So instead of forcing
+     users to say "--display ''" when they want to use Emacs's existing tty
+     or display connection, we force them to use "--display $DISPLAY" if
+     they want Emacs to connect to their current display.
+     -c still implicitly passes --display $DISPLAY unless -t was specified
+     so as to try and mimick the behavior of `emacs' which either uses
+     the current tty or the current $DISPLAY.  */
+  if (!current_frame && !tty)
+    display = egetenv ("DISPLAY");
+
   if (display && strlen (display) == 0)
     display = NULL;
 
   if (!tty && display)
     window_system = 1;
 #if !defined (WINDOWSNT) && !defined (HAVE_CARBON)
-  else
+  else if (!current_frame)
     tty = 1;
 #endif