GNU bug report logs - #46119
28.0.50; this-error-recenter

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Tue, 26 Jan 2021 21:22:01 UTC

Severity: wishlist

Tags: patch

Found in version 28.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 46119 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 46119 <at> debbugs.gnu.org, uyennhi.qm <at> gmail.com
Subject: Re: bug#46119: 28.0.50; this-error-recenter
Date: Tue, 02 Feb 2021 22:16:05 +0100
Juri Linkov <juri <at> jurta.org> writes:

>>     * lisp/window.el (recenter-other-window): New command.
>>     Bind recenter-other-window to M-C-l.
>
> M-C-l can't be used because M-C-l is already bound to 'reposition-window'.
> Only S-M-C-l is free.
Right, my bad.  Ok, I will use S-M-C-l then.

>>     * lisp/simple.el (this-error-recenter): New command.
>
> Wouldn't a better name be recenter-current-error
> since existing name is compilation-current-error?
Agreed.

>> +(defun this-error-recenter (&optional arg)
>> +  "Recenter the current displayed error in the `next-error' buffer."
>> +  (interactive "P")
>> +  (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode)))
>> +      (user-error "This command is for *Occur* or *Grep* buffers")
>
> This is bad restriction that needs to be removed.
OK

>> +    (funcall next-error-function 0 nil)
>> +    (recenter-top-bottom arg)
>> +    (pop-to-buffer next-error-last-buffer)))
>
> `(pop-to-buffer next-error-last-buffer)' has problems
> and should be replaced with `save-selected-window'.
>
> Please see the commit 072b4c679dfd5528e74849cad18246730a991933
> and bug#32607 for explanations.

I must set the buffer with the locus current, otherwise `recenter' rises
an error:

(defun recenter-current-error (&optional arg)
  "Recenter the current displayed error in the `next-error' buffer."
  (interactive "P")
  (save-selected-window
    (let ((next-error-highlight next-error-highlight-no-select)
          (display-buffer-overriding-action
           '(nil (inhibit-same-window . t))))
      (next-error 0)
      (set-buffer (window-buffer))
      (recenter-top-bottom arg))))




This bug report was last modified 4 years and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.