GNU bug report logs -
#37856
27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Mon, 21 Oct 2019 18:40:02 UTC
Severity: normal
Found in version 27.0.50
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 37856 <at> debbugs.gnu.org.
--
37856: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37856
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Juanma Barranquero <lekktu <at> gmail.com> writes:
> > What am I missing?
>
> What's wrong with
>
> (add-hook 'next-error-hook 'recenter)
Oops, how silly of me. Yes, I'll just use that. Thanks.
I'm still a bit confounded by the above behaviour, but if everyone
else feels that everything is in order I'll just go ahead and close
this. Sorry about the noise.
Best regards,
Stefan Kangas
[Message part 3 (message/rfc822, inline)]
I get an error when advising 'next-error' with 'recenter'.
Steps to reproduce:
1. Under "emacs -Q", evaluate:
(defun my-advice (&rest args)
(recenter))
(advice-add 'next-error :after #'my-advice)
2. M-x rgrep RET [... grep for something]
3. Run 'next-error' (M-g M-n) from the "*grep*" buffer.
Result: I get the error:
recenter-top-bottom: ‘recenter’ing a window that does not display
current-buffer.
(I also get the error when I run it in the second window when
'next-error' would take you to a different file.)
Expected result: I get no error.
---
Backtrace:
Debugger entered--Lisp error: (error "‘recenter’ing a window that does
not display curre...")
recenter()
my-advice(nil)
apply(my-advice nil)
next-error(nil)
funcall-interactively(next-error nil)
#<subr call-interactively>(next-error nil nil)
apply(#<subr call-interactively> next-error (nil nil))
call-interactively <at> ido-cr+-record-current-command(#<subr
call-interactively> next-error nil nil)
apply(call-interactively <at> ido-cr+-record-current-command #<subr
call-interactively> (next-error nil nil))
call-interactively(next-error nil nil)
command-execute(next-error)
---
This seems to be due to this code in window.c:
/* For reasons why we signal an error here, see
https://lists.gnu.org/r/emacs-devel/2014-06/msg00053.html,
https://lists.gnu.org/r/emacs-devel/2014-06/msg00094.html. */
if (buf != current_buffer)
error ("`recenter'ing a window that does not display current-buffer.");
This code was added here:
3da983f8c4 2014-06-06 Stefan Monnier * src/window.c (Frecenter):
Signal an error if window-buffer is not current-buffer.
---
In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS
appkit-1561.61 Version 10.13.6 (Build 17G8037))
of 2019-10-21 built on Stefans-MBP
Repository revision: 0e6f4628d8fff53505e4399e71da9f531a64fff7
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1561
System Description: Mac OS X 10.13.6
This bug report was last modified 5 years and 215 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.