From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 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 22:11:50 +0200 [thread overview]
Message-ID: <CADwFkm=6ebZNpDYS=b6c+qud1oy2D_wCQPfuVVXLs5FY+_CMsA@mail.gmail.com> (raw)
In-Reply-To: <83lftd28wt.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
> > 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.
>
> Why isn't this a cockpit error: you force a function that happens to
> switch buffers to recenter. It's like you've added a call to
> 'recenter' in some arbitrary place in a random function: you are
> responsible for that code, and if it does stuff that it shouldn't,
> your code is wrong. No?
In this case my expectation was that this code would be run *after*
the command, i.e. when it had already done all the switching. I'm not
sure that's comparable to placing recenter in an arbitrary place
inside the function.
It was surprising to me that this didn't work, and it's not clear what
I should do instead. For example, the following code exhibits the
same problem:
(defun my-next-error ()
(interactive)
(next-error)
(recenter))
What am I missing?
Best regards,
Stefan Kangas
next prev parent reply other threads:[~2019-10-21 20:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 18:38 bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Stefan Kangas
2019-10-21 19:30 ` Eli Zaretskii
2019-10-21 20:11 ` Stefan Kangas [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkm=6ebZNpDYS=b6c+qud1oy2D_wCQPfuVVXLs5FY+_CMsA@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=37856@debbugs.gnu.org \
--cc=eliz@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 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.