unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 37856@debbugs.gnu.org
Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer
Date: Mon, 21 Oct 2019 20:38:47 +0200	[thread overview]
Message-ID: <CADwFkm=4=RHq0dJeeVqqPg4+raCpZiG9TSXjorkpDkX7bkk91A@mail.gmail.com> (raw)

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@ido-cr+-record-current-command(#<subr
call-interactively> next-error nil nil)
  apply(call-interactively@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





             reply	other threads:[~2019-10-21 18:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 18:38 Stefan Kangas [this message]
2019-10-21 19:30 ` bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Eli Zaretskii
2019-10-21 20:11   ` Stefan Kangas
2019-10-21 21:37     ` Juanma Barranquero
2019-10-21 22:19       ` Stefan Kangas
2019-10-22  7:56         ` Robert Pluim
2019-10-22  2:28     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkm=4=RHq0dJeeVqqPg4+raCpZiG9TSXjorkpDkX7bkk91A@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=37856@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).