GNU bug report logs -
#14676
24.3.50; winner doesn't immediately notice windows created by server
Previous Next
To reply to this bug, email your comments to 14676 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Thu, 20 Jun 2013 18:11:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
michael_heerdegen <at> web.de
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 20 Jun 2013 18:11:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
I have `winner-mode' turned on.
From e.g. an image viewer I want to open a dired buffer for the
directory containing the images. So, from the image viewer, I run
emacsclient file
and in Emacs, I immediately hit C-^ (which I bound to `dired-jump') in
the popped up window, to get the parent dir.
The problem: the buffer showing the file was not recorded in the winner
history - `winner-undo' can't get it.
Note: this only happens if I hit C-^ immediately after opening the
file. Else, you trigger `post-command-hook' which DTRT.
Evaluating
(add-hook 'server-switch-hook 'winner-save-old-configurations)
fixes the problem for me. Should we do something like that in the
definition of `winner-mode'?
Regards,
Michael.
In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
of 2013-06-18 on dex, modified by Debian
(emacs-snapshot package, version 2:20130618-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description: Debian GNU/Linux testing (jessie)
Configured using:
`configure --build x86_64-linux-gnu --host x86_64-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.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
--without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
--with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes
CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'
CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed
-znocombreloc''
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Thu, 20 Jun 2013 20:33:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 14676 <at> debbugs.gnu.org (full text, mbox):
> (add-hook 'server-switch-hook 'winner-save-old-configurations)
> fixes the problem for me. Should we do something like that in the
> definition of `winner-mode'?
I don't much like this solution.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Thu, 20 Jun 2013 21:01:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 14676 <at> debbugs.gnu.org (full text, mbox):
>> (add-hook 'server-switch-hook 'winner-save-old-configurations)
>> fixes the problem for me. Should we do something like that in the
>> definition of `winner-mode'?
> I don't much like this solution.
I think the better solution is to move the (run-hooks
'post-command-hook) in server.el. Currently it's run at the end of
server-visit-files which I think is simply too early. It should be run
at the end of server-execute instead. And that should fix your problem
as well since winner-mode hooks itself on post-command-hook.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Thu, 20 Jun 2013 21:55:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 14676 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> >> (add-hook 'server-switch-hook 'winner-save-old-configurations)
> >> fixes the problem for me. Should we do something like that in the
> >> definition of `winner-mode'?
> > I don't much like this solution.
>
> I think the better solution is to move the (run-hooks
> 'post-command-hook) in server.el. Currently it's run at the end of
> server-visit-files which I think is simply too early. It should be run
> at the end of server-execute instead. And that should fix your problem
> as well since winner-mode hooks itself on post-command-hook.
That sounds reasonable. I tested your approach quickly, and it worked.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Fri, 21 Jun 2013 14:39:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 14676 <at> debbugs.gnu.org (full text, mbox):
> That sounds reasonable. I tested your approach quickly, and it worked.
Can you show me the patch you tested?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Sat, 22 Jun 2013 22:45:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 14676 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Can you show me the patch you tested?
I tested this:
[server.patch (text/x-diff, inline)]
*** /home/micha/today/server.el 2013-06-23 00:21:58.737341216 +0200
--- /home/micha/today/server-new.el 2013-06-23 00:27:31.470493560 +0200
***************
*** 1292,1298 ****
(message "%s" (substitute-command-keys
"When done with a buffer, type \\[server-edit]")))))
(when (and frame (null tty-name))
! (server-unselect-display frame)))
((quit error)
(when (eq (car err) 'quit)
(message "Quit emacsclient request"))
--- 1292,1299 ----
(message "%s" (substitute-command-keys
"When done with a buffer, type \\[server-edit]")))))
(when (and frame (null tty-name))
! (server-unselect-display frame))
! (run-hooks 'post-command-hook))
((quit error)
(when (eq (car err) 'quit)
(message "Quit emacsclient request"))
***************
*** 1360,1368 ****
(unless server-buffer-clients
(setq server-existing-buffer t)))
(server-goto-line-column (cdr file))
! (run-hooks 'server-visit-hook)
! ;; hooks may be specific to current buffer:
! (run-hooks 'post-command-hook))
(unless nowait
;; When the buffer is killed, inform the clients.
(add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
--- 1361,1367 ----
(unless server-buffer-clients
(setq server-existing-buffer t)))
(server-goto-line-column (cdr file))
! (run-hooks 'server-visit-hook))
(unless nowait
;; When the buffer is killed, inform the clients.
(add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
[Message part 3 (text/plain, inline)]
Note that I don't know anything about server.el, I just did what you
proposed.
Anyway, it fixes the problem - with my setup as well as for -Q.
BTW, I didn't know what was meant with this comment:
| ;; hooks may be specific to current buffer:
so I just removed it.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Wed, 09 Sep 2020 13:42:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 14676 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>> Can you show me the patch you tested?
>
> I tested this:
This was the final message in this seven year old thread. Miraculously,
the patch still applies:
> (message "%s" (substitute-command-keys
> "When done with a buffer, type \\[server-edit]")))))
> (when (and frame (null tty-name))
> ! (server-unselect-display frame)))
> ((quit error)
> (when (eq (car err) 'quit)
> (message "Quit emacsclient request"))
> --- 1292,1299 ----
> (message "%s" (substitute-command-keys
> "When done with a buffer, type \\[server-edit]")))))
> (when (and frame (null tty-name))
> ! (server-unselect-display frame))
> ! (run-hooks 'post-command-hook))
> ((quit error)
> (when (eq (car err) 'quit)
> (message "Quit emacsclient request"))
[...]
> Note that I don't know anything about server.el, I just did what you
> proposed.
>
> Anyway, it fixes the problem - with my setup as well as for -Q.
I'm not very familiar with server.el myself... this just changes it to
run post-command-hook slightly later? I guess that could have
unforeseen consequences, but if it fixes this bug, then perhaps we
should give it a go?
Or did the problem fix itself through other means over the years?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Wed, 16 Sep 2020 23:46:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 14676 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Or did the problem fix itself through other means over the years?
No, it didn't.
The "patch" is just the change Stefan suggested, done in a more or less
random way AFAIR, since I don't know server.el, too. I would still give
it a try. But AFAIU the change I had posted and you quoted doesn't
fulfill what the current code says, namely that `post-command-hook'
should be run in each buffer individually. Maybe that's the reason why
Stefan had ignored it ;-)
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14676
; Package
emacs
.
(Thu, 17 Sep 2020 03:20:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 14676 <at> debbugs.gnu.org (full text, mbox):
>> Or did the problem fix itself through other means over the years?
> No, it didn't.
> The "patch" is just the change Stefan suggested, done in a more or less
> random way AFAIR, since I don't know server.el, too. I would still give
> it a try. But AFAIU the change I had posted and you quoted doesn't
> fulfill what the current code says, namely that `post-command-hook'
> should be run in each buffer individually. Maybe that's the reason why
> Stefan had ignored it ;-)
BTW, runnning `post-command-hook` in there is arguably wrong (we didn't
technically run a command, or at least we didn't go through the usual
"protocol" of running a command, so some `post-command-hook` functions
may misbehave, e.g. because of interaction with things like
`this-command` or `last-command`).
Maybe the right way to fix this is to try and make `server.el` simulate
more carefully a command-loop running a command. Or even *really* make
it run a command. E.g. instead of having `server.el` immediately
run within the process filter the code requested by the client, it could
just push some ad-hoc event onto `unread-command-events` which is then
bound to a command.
Stefan
This bug report was last modified 4 years and 269 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.