From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#46119: 28.0.50; this-error-recenter Date: Tue, 02 Feb 2021 19:05:10 +0200 Organization: LINKOV.NET Message-ID: <87v9baafyp.fsf@mail.linkov.net> References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9220"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 02 18:21:16 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6zMZ-0002IT-QU for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Feb 2021 18:21:15 +0100 Original-Received: from localhost ([::1]:56548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6zMY-0002H0-SR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Feb 2021 12:21:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6zLO-00019O-Es for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 12:20:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6zLO-0006E9-45 for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 12:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l6zLN-0004bG-WB for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2021 12:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Feb 2021 17:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46119-submit@debbugs.gnu.org id=B46119.161228636317585 (code B ref 46119); Tue, 02 Feb 2021 17:20:01 +0000 Original-Received: (at 46119) by debbugs.gnu.org; 2 Feb 2021 17:19:23 +0000 Original-Received: from localhost ([127.0.0.1]:36113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKl-0004ZU-5g for submit@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:23 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:52673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKi-0004Z6-Dt for 46119@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:22 -0500 X-Originating-IP: 91.129.108.204 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 74A2424000E; Tue, 2 Feb 2021 17:19:12 +0000 (UTC) In-Reply-To: <874kivlhro.fsf@gmail.com> (Tino Calancha's message of "Mon, 01 Feb 2021 20:17:31 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199156 Archived-At: > I am posting now the approach using two new commands: > > * 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. > * lisp/simple.el (this-error-recenter): New command. Wouldn't a better name be recenter-current-error since existing name is compilation-current-error? > +(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. > + (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.