* C-x C-c does nothing on frames created with "nowait" flag
@ 2009-01-11 9:15 Bo Lin
2009-01-11 10:27 ` Ulrich Mueller
0 siblings, 1 reply; 10+ messages in thread
From: Bo Lin @ 2009-01-11 9:15 UTC (permalink / raw)
To: emacs-devel
Hi emacs-devel,
When connecting to a Emacs daemon using "emacsclient -n -c", pressing
C-x C-c in the newly created frame does nothing. It does not exit Emacs,
close the frame, or even give any visible feed-back, just nothing.
That's quite surprising, and at first I thought Emacs has hanged.
I think it should at least give a message, like so:
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1349,18 +1349,22 @@ With ARG non-nil, silently save all file-visiting buffers, then kill.
If emacsclient was started with a list of filenames to edit, then
only these files will be asked to be saved."
- ;; save-buffers-kill-terminal occasionally calls us with proc set
- ;; to `nowait' (comes from the value of the `client' frame parameter).
- (when (processp proc)
- (let ((buffers (process-get proc 'buffers)))
- ;; If client is bufferless, emulate a normal Emacs session
- ;; exit and offer to save all buffers. Otherwise, offer to
- ;; save only the buffers belonging to the client.
- (save-some-buffers arg
- (if buffers
- (lambda () (memq (current-buffer) buffers))
- t))
- (server-delete-client proc))))
+ (cond ((eq proc 'nowait)
+ ;; save-buffers-kill-terminal occasionally calls us with proc set
+ ;; to `nowait' (comes from the value of the `client' frame parameter).
+ (message "%s"
+ (substitute-command-keys
+ "No clients waiting. Type \\[save-buffers-kill-emacs] to kill Emacs or type \\[delete-frame] to delete this frame.")))
+ ((processp proc)
+ (let ((buffers (process-get proc 'buffers)))
+ ;; If client is bufferless, emulate a normal Emacs session
+ ;; exit and offer to save all buffers. Otherwise, offer to
+ ;; save only the buffers belonging to the client.
+ (save-some-buffers arg
+ (if buffers
+ (lambda () (memq (current-buffer) buffers))
+ t))
+ (server-delete-client proc)))))
(define-key ctl-x-map "#" 'server-edit)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 9:15 C-x C-c does nothing on frames created with "nowait" flag Bo Lin
@ 2009-01-11 10:27 ` Ulrich Mueller
2009-01-11 11:32 ` Bo Lin
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Ulrich Mueller @ 2009-01-11 10:27 UTC (permalink / raw)
To: Bo Lin; +Cc: emacs-devel
>>>>> On Sun, 11 Jan 2009, Bo Lin wrote:
> When connecting to a Emacs daemon using "emacsclient -n -c",
> pressing C-x C-c in the newly created frame does nothing. It does
> not exit Emacs, close the frame, or even give any visible feed-back,
> just nothing. That's quite surprising, and at first I thought Emacs
> has hanged.
I had reported this last month already, but somehow the issue got lost.
<http://lists.gnu.org/archive/html/emacs-devel/2008-12/msg01095.html>
> I think it should at least give a message,
... or save buffers and delete the frame (also sent the following
patch already):
--- lisp/files.el.~1.1030.~
+++ lisp/files.el
@@ -5733,9 +5733,14 @@
(interactive "P")
(let ((proc (frame-parameter (selected-frame) 'client))
(frame (selected-frame)))
- (if (null proc)
- (save-buffers-kill-emacs)
- (server-save-buffers-kill-terminal proc arg))))
+ (cond
+ ((null proc)
+ (save-buffers-kill-emacs))
+ ((processp proc)
+ (server-save-buffers-kill-terminal proc arg))
+ (t
+ (save-some-buffers arg t)
+ (delete-frame)))))
\f
;; We use /: as a prefix to "quote" a file name
Ulrich
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 10:27 ` Ulrich Mueller
@ 2009-01-11 11:32 ` Bo Lin
2009-01-11 13:25 ` Chong Yidong
2009-01-11 14:54 ` Stefan Monnier
2 siblings, 0 replies; 10+ messages in thread
From: Bo Lin @ 2009-01-11 11:32 UTC (permalink / raw)
To: emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
>>>>>> On Sun, 11 Jan 2009, Bo Lin wrote:
>
>> When connecting to a Emacs daemon using "emacsclient -n -c",
>> pressing C-x C-c in the newly created frame does nothing. It does
>> not exit Emacs, close the frame, or even give any visible feed-back,
>> just nothing. That's quite surprising, and at first I thought Emacs
>> has hanged.
>
> I had reported this last month already, but somehow the issue got lost.
> <http://lists.gnu.org/archive/html/emacs-devel/2008-12/msg01095.html>
>
Ahh, I see. Sorry for the duplicate.
>> I think it should at least give a message,
>
> ... or save buffers and delete the frame
>
Yes, that would obviously be better. I just wasn't sure whether that
behavior was an oversight or intentionally made so for some obscure
reason ;-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 10:27 ` Ulrich Mueller
2009-01-11 11:32 ` Bo Lin
@ 2009-01-11 13:25 ` Chong Yidong
2009-01-11 13:40 ` Ulrich Mueller
2009-01-11 14:54 ` Stefan Monnier
2 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2009-01-11 13:25 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: Bo Lin, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
> ... or save buffers and delete the frame (also sent the following
> patch already):
Or, we could treat a `nowait' frame as though it were an ordinary
(non-client) frame on the server:
*** trunk/lisp/files.el.~1.1031.~ 2009-01-11 08:23:10.000000000 -0500
--- trunk/lisp/files.el 2009-01-11 08:24:54.000000000 -0500
***************
*** 5733,5741 ****
(interactive "P")
(let ((proc (frame-parameter (selected-frame) 'client))
(frame (selected-frame)))
! (if (null proc)
! (save-buffers-kill-emacs)
! (server-save-buffers-kill-terminal proc arg))))
\f
;; We use /: as a prefix to "quote" a file name
--- 5733,5741 ----
(interactive "P")
(let ((proc (frame-parameter (selected-frame) 'client))
(frame (selected-frame)))
! (if (processp proc)
! (server-save-buffers-kill-terminal proc arg)
! (save-buffers-kill-emacs arg))))
\f
;; We use /: as a prefix to "quote" a file name
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 13:25 ` Chong Yidong
@ 2009-01-11 13:40 ` Ulrich Mueller
2009-01-11 13:58 ` Bo Lin
0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2009-01-11 13:40 UTC (permalink / raw)
To: Chong Yidong; +Cc: Bo Lin, emacs-devel
>>>>> On Sun, 11 Jan 2009, Chong Yidong wrote:
> Or, we could treat a `nowait' frame as though it were an ordinary
> (non-client) frame on the server:
Hm, I think this is not such a good idea if Emacs was started in
daemon mode.
Ulrich
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 13:40 ` Ulrich Mueller
@ 2009-01-11 13:58 ` Bo Lin
0 siblings, 0 replies; 10+ messages in thread
From: Bo Lin @ 2009-01-11 13:58 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: Chong Yidong, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
>>>>>> On Sun, 11 Jan 2009, Chong Yidong wrote:
>
>> Or, we could treat a `nowait' frame as though it were an ordinary
>> (non-client) frame on the server:
>
> Hm, I think this is not such a good idea if Emacs was started in
> daemon mode.
Agreed. Frames created by emacsclient should behave consistently
regardless of the `nowait' flag. That is, they should not kill the
server when destroyed.
BTW if you want to make the change in files.el then I'd suggest also
delete the two line comment regarding `nowait' in
`server-save-buffers-kill-terminal', to reduce the potential for future
confusion.
-Bo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 10:27 ` Ulrich Mueller
2009-01-11 11:32 ` Bo Lin
2009-01-11 13:25 ` Chong Yidong
@ 2009-01-11 14:54 ` Stefan Monnier
2009-01-11 15:57 ` Chong Yidong
2 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-01-11 14:54 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: Bo Lin, emacs-devel
> --- lisp/files.el.~1.1030.~
> +++ lisp/files.el
> @@ -5733,9 +5733,14 @@
> (interactive "P")
> (let ((proc (frame-parameter (selected-frame) 'client))
> (frame (selected-frame)))
> - (if (null proc)
> - (save-buffers-kill-emacs)
> - (server-save-buffers-kill-terminal proc arg))))
> + (cond
> + ((null proc)
> + (save-buffers-kill-emacs))
> + ((processp proc)
> + (server-save-buffers-kill-terminal proc arg))
> + (t
> + (save-some-buffers arg t)
> + (delete-frame)))))
Any idea why this patch hasn't been installed yet?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 14:54 ` Stefan Monnier
@ 2009-01-11 15:57 ` Chong Yidong
2009-01-11 17:38 ` Ulrich Mueller
0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2009-01-11 15:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Bo Lin, Ulrich Mueller, emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Any idea why this patch hasn't been installed yet?
One problem with the patch is that it raises an error if the nowait
emacsclient frame is the last frame alive. I guess the right thing to
do in that situation is for C-x C-c to call save-buffers-kill-emacs.
I'll check in an appropriate fix shortly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 15:57 ` Chong Yidong
@ 2009-01-11 17:38 ` Ulrich Mueller
2009-01-11 20:56 ` Chong Yidong
0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2009-01-11 17:38 UTC (permalink / raw)
To: Chong Yidong; +Cc: Bo Lin, Stefan Monnier, emacs-devel
>>>>> On Sun, 11 Jan 2009, Chong Yidong wrote:
> One problem with the patch is that it raises an error if the nowait
> emacsclient frame is the last frame alive.
You are right. I think that I had only tested the patch with Emacs
started as a daemon, where it doesn't raise an error. (Still, raising
an error would be an improvement against the current behaviour, where
the command just does nothing.)
On a somewhat related issue: the "Exit Emacs" menu item always shows
C-x C-c, even if this doesn't correspond to the current key binding.
Probably its definition in menu-bar.el shouldn't use :keys to hardcode
"C-x C-c".
Ulrich
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: C-x C-c does nothing on frames created with "nowait" flag
2009-01-11 17:38 ` Ulrich Mueller
@ 2009-01-11 20:56 ` Chong Yidong
0 siblings, 0 replies; 10+ messages in thread
From: Chong Yidong @ 2009-01-11 20:56 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: Bo Lin, Stefan Monnier, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
> On a somewhat related issue: the "Exit Emacs" menu item always shows
> C-x C-c, even if this doesn't correspond to the current key binding.
> Probably its definition in menu-bar.el shouldn't use :keys to hardcode
> "C-x C-c".
Yes. We should probably also change it to use
save-buffers-kill-terminal rather than save-buffers-kill-emacs.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-01-11 20:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-11 9:15 C-x C-c does nothing on frames created with "nowait" flag Bo Lin
2009-01-11 10:27 ` Ulrich Mueller
2009-01-11 11:32 ` Bo Lin
2009-01-11 13:25 ` Chong Yidong
2009-01-11 13:40 ` Ulrich Mueller
2009-01-11 13:58 ` Bo Lin
2009-01-11 14:54 ` Stefan Monnier
2009-01-11 15:57 ` Chong Yidong
2009-01-11 17:38 ` Ulrich Mueller
2009-01-11 20:56 ` Chong Yidong
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.