unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
@ 2011-03-22  1:05 PJ Weisberg
  2011-06-03 19:49 ` Glenn Morris
  2012-04-20 10:38 ` Chong Yidong
  0 siblings, 2 replies; 12+ messages in thread
From: PJ Weisberg @ 2011-03-22  1:05 UTC (permalink / raw)
  To: 8314

I'm reporting this with the emacs snapshot from
http://emacs.naquadah.org/, but the problem exists in Emacs 23 as
well.

1) Build emacs with '--with-x=no'.
2) Start emacs with '--daemon'.
3) From a terminal emulator under X, such as gnome-terminal, with the
$DISPLAY environment variable set, run 'emacsclient -c'.

Expected: Same behavior as when no display is available, which is to
fall back to the tty.
Observed: "Waiting for Emacs..." is printed to the terminal, then
emacsclient exits with nothing else apparently happening.

It DOES fall back to the terminal if the DISPLAY env variable is set to ''.

In GNU Emacs 24.0.50.1 (i486-pc-linux-gnu)
 of 2011-03-16 on cigue, modified by Debian
 (emacs-snapshot package, version 1:20110316-1)
configured using `configure  '--build' 'i486-linux-gnu' '--host'
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.50/site-lisp:/usr/share/emacs/site-lisp'
'--without-compress-info' '--with-x=no' '--without-dbus'
'--without-sound' 'build_alias=i486-linux-gnu'
'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN
-DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed'
'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Custom

Minor modes in effect:
  show-paren-mode: t
  delete-selection-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O C RET
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O D ESC O D ESC
O D RET ESC O A ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
x r e p o r TAB RET

Recent messages:
Resetting customization items...done
Creating customization setup...done
To install your edits, invoke [State] and choose the Set operation
Creating customization items...
Creating group...
Creating group entries...done
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
byte-code: End of buffer [5 times]
byte-code: End of buffer

Load-path shadows:
/usr/share/emacs-snapshot/site-lisp/css-mode/css-mode hides
/usr/share/emacs/site-lisp/css-mode/css-mode
/usr/share/emacs-snapshot/site-lisp/html-helper-mode/visual-basic-mode
hides /usr/share/emacs/site-lisp/html-helper-mode/visual-basic-mode
/usr/share/emacs-snapshot/site-lisp/html-helper-mode/hhm-config hides
/usr/share/emacs/site-lisp/html-helper-mode/hhm-config
/usr/share/emacs-snapshot/site-lisp/html-helper-mode/html-helper-mode
hides /usr/share/emacs/site-lisp/html-helper-mode/html-helper-mode
/usr/share/emacs-snapshot/site-lisp/html-helper-mode/tempo hides
/usr/share/emacs/site-lisp/html-helper-mode/tempo
/usr/share/emacs/24.0.50/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs-snapshot/site-lisp/html-helper-mode/tempo hides
/usr/share/emacs/24.0.50/lisp/tempo
/usr/share/emacs-snapshot/site-lisp/css-mode/css-mode hides
/usr/share/emacs/24.0.50/lisp/textmodes/css-mode

Features:
(shadow sort uudecode uce supercite regi starttls spam-report spam
spam-stat gnus-uu yenc gnus-msg gnus-art mm-uu mml2015 epg-config
mm-view mml-smime smime dig mailcap nnir gnus-sum macroexp nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range gnus-win smtpmail sieve-manage shr rmail pop3
mspools metamail message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
gmm-utils mailheader mairix mailclient browse-url mailalias mail-hist
mail-extr imap hashcash gnus-dired dired gnus gnus-ems nnheader fortune
feedmail eudc-vars emacsbug url-util url-parse auth-source eieio assoc
gnus-util time-date password-cache url-vars mm-util mail-prsvr ecomplete
time image binhex sendmail mail-utils cus-edit wid-edit multi-isearch
jka-compr find-func help-mode easymenu view apropos server flyspell
ispell pp byte-opt warnings advice help-fns advice-preload disp-table
enriched midnight paren delsel cus-start cus-load compile comint
regexp-opt ring tool-bar bytecomp byte-compile debian-el
debian-el-loaddefs emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs easy-mmode ediff-hook vc-hooks lisp-float-type
lisp-mode register page menu-bar rfn-eshadow timer select mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-03-22  1:05 bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X PJ Weisberg
@ 2011-06-03 19:49 ` Glenn Morris
  2011-06-03 22:03   ` PJ Weisberg
  2011-06-06 14:56   ` Stefan Monnier
  2012-04-20 10:38 ` Chong Yidong
  1 sibling, 2 replies; 12+ messages in thread
From: Glenn Morris @ 2011-06-03 19:49 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8314

PJ Weisberg wrote:

> 1) Build emacs with '--with-x=no'.
> 2) Start emacs with '--daemon'.
> 3) From a terminal emulator under X, such as gnome-terminal, with the
> $DISPLAY environment variable set, run 'emacsclient -c'.
>
> Expected: Same behavior as when no display is available, which is to
> fall back to the tty.
> Observed: "Waiting for Emacs..." is printed to the terminal, then
> emacsclient exits with nothing else apparently happening.

I get:

   *ERROR*: Don't know how to create a frame on window system x

which seems reasonable.

If we are allowed to assume that emacsclient is used with the same
version of Emacs as it was compiled with, then it seems easy to get the
behaviour you want, see patch. However, if you want to use the same
emacsclient binary with both Emacs compiled with-x and without-x, then
it won't work. Assuming you use the emacsclient from a build with-x,
though, then you are no worse off than you are now.

I wonder if it would be better to not accept the `-c' option in a
without-x build.


*** lib-src/emacsclient.c	2011-06-01 17:15:27 +0000
--- lib-src/emacsclient.c	2011-06-03 19:16:27 +0000
***************
*** 144,151 ****
  /* The parent window ID, if we are opening a frame via XEmbed.  */
  char *parent_id = NULL;
  
! /* Nonzero means open a new Emacs frame on the current terminal. */
  int tty = 0;
  
  /* If non-NULL, the name of an editor to fallback to if the server
     is not running.  --alternate-editor.   */
--- 144,158 ----
  /* The parent window ID, if we are opening a frame via XEmbed.  */
  char *parent_id = NULL;
  
! /* Nonzero means open a new Emacs frame on the current terminal.
!    If Emacs was built without X, we must do this.
!    (This assumes emacsclient is used with the same version of Emacs
!    as it was compiled with.)  */
! #if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) || defined(WINDOWSNT)
  int tty = 0;
+ #else
+ int tty = 1;
+ #endif
  
  /* If non-NULL, the name of an editor to fallback to if the server
     is not running.  --alternate-editor.   */








^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-03 19:49 ` Glenn Morris
@ 2011-06-03 22:03   ` PJ Weisberg
  2011-06-04  6:31     ` Eli Zaretskii
  2011-06-06 14:56   ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: PJ Weisberg @ 2011-06-03 22:03 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8314

On Fri, Jun 3, 2011 at 12:49 PM, Glenn Morris <rgm@gnu.org> wrote:

> If we are allowed to assume that emacsclient is used with the same
> version of Emacs as it was compiled with, then it seems easy to get the
> behaviour you want, see patch. However, if you want to use the same
> emacsclient binary with both Emacs compiled with-x and without-x, then
> it won't work. Assuming you use the emacsclient from a build with-x,
> though, then you are no worse off than you are now.

I'm not somewhere where I can compile and test right now, but that
*looks* like it'll do what I want.  I'll come back and complain some
more over the weekend if I try it and it doesn't.  ;-)

> I wonder if it would be better to not accept the `-c' option in a
> without-x build.

I think that if there's no useable graphical display for *any* reason,
'-c' should be a synonym for '-t'.  The man page for emacsclient just
says "create a new frame instead of trying to use the current Emacs
frame" for that option, so the user hasn't *really* requested a
graphical frame.

-PJ





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-03 22:03   ` PJ Weisberg
@ 2011-06-04  6:31     ` Eli Zaretskii
  2011-06-04  8:00       ` PJ Weisberg
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2011-06-04  6:31 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8314

> Date: Fri, 3 Jun 2011 15:03:18 -0700
> From: PJ Weisberg <pj@irregularexpressions.net>
> Cc: 8314@debbugs.gnu.org
> 
> I think that if there's no useable graphical display for *any* reason,
> '-c' should be a synonym for '-t'.

I'm not at all sure that's TRT.  Next you will be saying that if -t is
not available either, emacsclient should start a new Emacs session.

> The man page for emacsclient just says "create a new frame instead
> of trying to use the current Emacs frame" for that option

The man page is not up to date with the latest changes in emacsclient,
IMO.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-04  6:31     ` Eli Zaretskii
@ 2011-06-04  8:00       ` PJ Weisberg
  2011-06-04 21:35         ` Chong Yidong
  0 siblings, 1 reply; 12+ messages in thread
From: PJ Weisberg @ 2011-06-04  8:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 8314@debbugs.gnu.org, PJ Weisberg

On Friday, June 3, 2011, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Fri, 3 Jun 2011 15:03:18 -0700
>> From: PJ Weisberg <pj@irregularexpressions.net>
>> Cc: 8314@debbugs.gnu.org
>>
>> I think that if there's no useable graphical display for *any* reason,
>> '-c' should be a synonym for '-t'.
>
> I'm not at all sure that's TRT.  Next you will be saying that if -t is
> not available either, emacsclient should start a new Emacs session.

There's already the -a="" option if I want that.  '-c' already acts
the same as '-t' if you're at a terminal with no graphical display.

Really I just want to say, "open whatever type of frame Emacs would
normally open."

In the script I was writing when I wrote this report I eventually used
`if emacs -Q --batch --eval "(kill-emacs (if (featurep 'x) 0 1))"' to
decide whether to creat a graphical frame or use --tty.


-- 

-PJ





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-04  8:00       ` PJ Weisberg
@ 2011-06-04 21:35         ` Chong Yidong
  2011-06-05 21:09           ` PJ Weisberg
  2011-06-06 14:57           ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Chong Yidong @ 2011-06-04 21:35 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8314@debbugs.gnu.org

PJ Weisberg <pj@irregularexpressions.net> writes:

>>> I think that if there's no useable graphical display for *any*
>>> reason, '-c' should be a synonym for '-t'.
>>
>> I'm not at all sure that's TRT.  Next you will be saying that if -t
>> is not available either, emacsclient should start a new Emacs
>> session.
>
> Really I just want to say, "open whatever type of frame Emacs would
> normally open."
>
> In the script I was writing when I wrote this report I eventually used
> `if emacs -Q --batch --eval "(kill-emacs (if (featurep 'x) 0 1))"' to
> decide whether to creat a graphical frame or use --tty.

What if the user wants emacsclient to exit if no graphical frame can be
created?





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-04 21:35         ` Chong Yidong
@ 2011-06-05 21:09           ` PJ Weisberg
  2011-06-06 14:57           ` Stefan Monnier
  1 sibling, 0 replies; 12+ messages in thread
From: PJ Weisberg @ 2011-06-05 21:09 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8314@debbugs.gnu.org

On Sat, Jun 4, 2011 at 2:35 PM, Chong Yidong <cyd@stupidchicken.com> wrote:

> What if the user wants emacsclient to exit if no graphical frame can be
> created?

Perhaps I'm guilty of the sin of assuming everyone uses the system the
way I use it.  I can think of very few situations where I want to open
an Emacs frame, but I'd rather have it fail than open in a terminal.

In any case, I think Emacs without X support should behave the same as
Emacs in an X-less environment.  You know a priori that we're not
going to open a graphical frame.

-PJ





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-03 19:49 ` Glenn Morris
  2011-06-03 22:03   ` PJ Weisberg
@ 2011-06-06 14:56   ` Stefan Monnier
  2011-06-29  0:16     ` Glenn Morris
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-06-06 14:56 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8314, PJ Weisberg

> I wonder if it would be better to not accept the `-c' option in a
> without-x build.

Whatever we do, we should do it in server.el, not in emacsclient.c.
I guess it'd be OK for -c to fallback to use the tty if the server was
compiled without GUI.


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-04 21:35         ` Chong Yidong
  2011-06-05 21:09           ` PJ Weisberg
@ 2011-06-06 14:57           ` Stefan Monnier
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2011-06-06 14:57 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8314@debbugs.gnu.org, PJ Weisberg

> What if the user wants emacsclient to exit if no graphical frame can be
> created?

Sounds rather far fetched, and --eval can be used for such corner cases.


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-06 14:56   ` Stefan Monnier
@ 2011-06-29  0:16     ` Glenn Morris
  2011-06-30  2:09       ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2011-06-29  0:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 8314, PJ Weisberg

Stefan Monnier wrote:

> Whatever we do, we should do it in server.el, not in emacsclient.c.

Not trivially doable, since emacsclient.c is the one that figures out
the tty name and type (when needed; find_tty) and passes them to the
server. emacsclient.c would have to be modified to pass this info in all
cases (except --eval?), and some new tty-flag added to distinguish
between "tty requested" and "tty to be used as fallback if Emacs
compiled without X" (since -tty on its own would no longer be enough).





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-06-29  0:16     ` Glenn Morris
@ 2011-06-30  2:09       ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2011-06-30  2:09 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8314, PJ Weisberg

>> Whatever we do, we should do it in server.el, not in emacsclient.c.
> Not trivially doable, since emacsclient.c is the one that figures out
> the tty name and type (when needed; find_tty) and passes them to the
> server. emacsclient.c would have to be modified to pass this info in all
> cases

Yup.  Doesn't sound like a big deal.

> (except --eval?)

No need for any exception there.

> and some new tty-flag added to distinguish between "tty requested" and
> "tty to be used as fallback if Emacs compiled without X" (since -tty
> on its own would no longer be enough).

Adding a "tty requested" flag doesn't sound particularly hard either.


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X
  2011-03-22  1:05 bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X PJ Weisberg
  2011-06-03 19:49 ` Glenn Morris
@ 2012-04-20 10:38 ` Chong Yidong
  1 sibling, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2012-04-20 10:38 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 8314

PJ Weisberg <pj@irregularexpressions.net> writes:

> 1) Build emacs with '--with-x=no'.
> 2) Start emacs with '--daemon'.
> 3) From a terminal emulator under X, such as gnome-terminal, with the
> $DISPLAY environment variable set, run 'emacsclient -c'.
>
> Expected: Same behavior as when no display is available, which is to
> fall back to the tty.
> Observed: "Waiting for Emacs..." is printed to the terminal, then
> emacsclient exits with nothing else apparently happening.
>
> It DOES fall back to the terminal if the DISPLAY env variable is set to ''.

Fixed in trunk.  Thanks for the report.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-04-20 10:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22  1:05 bug#8314: 24.0.50; emacsclient -c does the wrong thing when compiled without X PJ Weisberg
2011-06-03 19:49 ` Glenn Morris
2011-06-03 22:03   ` PJ Weisberg
2011-06-04  6:31     ` Eli Zaretskii
2011-06-04  8:00       ` PJ Weisberg
2011-06-04 21:35         ` Chong Yidong
2011-06-05 21:09           ` PJ Weisberg
2011-06-06 14:57           ` Stefan Monnier
2011-06-06 14:56   ` Stefan Monnier
2011-06-29  0:16     ` Glenn Morris
2011-06-30  2:09       ` Stefan Monnier
2012-04-20 10:38 ` Chong Yidong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).