all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21723: 24.5; Bug in `server-kill-emacs-query-function'
@ 2015-10-21  8:52 Eli Barzilay
  2015-10-21 16:51 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Barzilay @ 2015-10-21  8:52 UTC (permalink / raw)
  To: 21723

The code in `server-kill-emacs-query-function' (in server.el) has this
in an `or':

    (let (live-client)
      (dolist (proc server-clients)
        (when (memq t (mapcar 'buffer-live-p (process-get
                                              proc 'buffers)))
          (setq live-client t)))
      live-client)

IIUC, this looks for a live client, and if there is one, the t result
means that the yes-or-no-p question in the end will *not* get asked.
I verified this by:

  * Starting emacs -Q and in it start the server

  * Run emacsclient on a random file

  * Now, C-x C-c exits without asking any questions.

It seems to me like that condition is reversed, an the last line
should instead be: (not live-client)

This will also make the first condition in the function unnecessary,
since if there are no clients, then the loop will not find a live one
and the question will be skipped.

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





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

* bug#21723: 24.5; Bug in `server-kill-emacs-query-function'
  2015-10-21  8:52 bug#21723: 24.5; Bug in `server-kill-emacs-query-function' Eli Barzilay
@ 2015-10-21 16:51 ` Eli Zaretskii
  2015-10-22  5:30   ` Eli Barzilay
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2015-10-21 16:51 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 21723-done

> From: Eli Barzilay <eli@barzilay.org>
> Date: Wed, 21 Oct 2015 04:52:01 -0400
> 
> The code in `server-kill-emacs-query-function' (in server.el) has this
> in an `or':
> 
>     (let (live-client)
>       (dolist (proc server-clients)
>         (when (memq t (mapcar 'buffer-live-p (process-get
>                                               proc 'buffers)))
>           (setq live-client t)))
>       live-client)
> 
> IIUC, this looks for a live client, and if there is one, the t result
> means that the yes-or-no-p question in the end will *not* get asked.
> I verified this by:
> 
>   * Starting emacs -Q and in it start the server
> 
>   * Run emacsclient on a random file
> 
>   * Now, C-x C-c exits without asking any questions.
> 
> It seems to me like that condition is reversed, an the last line
> should instead be: (not live-client)

Ouch!  This bug was there for almost 10 years, since the simple loop
was rewritten as dolist, and the negation of the result was dropped in
the process.

Should be fixed now, thanks.





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

* bug#21723: 24.5; Bug in `server-kill-emacs-query-function'
  2015-10-21 16:51 ` Eli Zaretskii
@ 2015-10-22  5:30   ` Eli Barzilay
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Barzilay @ 2015-10-22  5:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 21723-done

On Wed, Oct 21, 2015 at 12:51 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Eli Barzilay <eli@barzilay.org>
>> Date: Wed, 21 Oct 2015 04:52:01 -0400
>>
>> The code in `server-kill-emacs-query-function' (in server.el) has this
>> in an `or':
>>
>>     (let (live-client)
>>       (dolist (proc server-clients)
>>         (when (memq t (mapcar 'buffer-live-p (process-get
>>                                               proc 'buffers)))
>>           (setq live-client t)))
>>       live-client)
>>
>> IIUC, this looks for a live client, and if there is one, the t result
>> means that the yes-or-no-p question in the end will *not* get asked.
>> I verified this by:
>>
>>   * Starting emacs -Q and in it start the server
>>
>>   * Run emacsclient on a random file
>>
>>   * Now, C-x C-c exits without asking any questions.
>>
>> It seems to me like that condition is reversed, an the last line
>> should instead be: (not live-client)
>
> Ouch!  This bug was there for almost 10 years, since the simple loop
> was rewritten as dolist, and the negation of the result was dropped in
> the process.

(Ah -- I saw the bug when adapting old hacks to new code, and saw that
difference.  I wondered why I didn't report it if I had a fixed version,
but my hacks were probably more than 10 years old so based on the
previous version...)

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





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

end of thread, other threads:[~2015-10-22  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21  8:52 bug#21723: 24.5; Bug in `server-kill-emacs-query-function' Eli Barzilay
2015-10-21 16:51 ` Eli Zaretskii
2015-10-22  5:30   ` Eli Barzilay

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.