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#44611: Prefix arg for xref-goto-xref Date: Mon, 01 Feb 2021 19:16:57 +0200 Organization: LINKOV.NET Message-ID: <871rdzam7q.fsf@mail.linkov.net> References: <87k0up68e4.fsf@mail.linkov.net> <837dp8r250.fsf@gnu.org> <4a0c8870-e2e7-97c7-5808-afa704ebee13@yandex.ru> <83mty4pj0u.fsf@gnu.org> <1d9bf365-224f-bb41-d79c-e22d110b41e3@yandex.ru> <83eejgpbs8.fsf@gnu.org> <9fa9d286-4497-baa9-15cd-1ef31651781f@yandex.ru> <83a6u4p8nz.fsf@gnu.org> <3c740ee3-cc1c-e2e3-d540-7be0b37d91ef@yandex.ru> <83pn2znloa.fsf@gnu.org> <87pn2zlzy3.fsf@mail.linkov.net> <83k0t7ndbs.fsf@gnu.org> <87wnx6z1gs.fsf@mail.linkov.net> <83a6u2nm8o.fsf@gnu.org> <87eejbbfm9.fsf@mail.linkov.net> <87sg7ponct.fsf@mail.linkov.net> <6511aade-1b6d-7a82-6848-3ccba43a794c@yandex.ru> <87bldkc028.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27988"; 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: joaotavora@gmail.com, 44611@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 01 18:28:48 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 1l6d0G-00075W-N9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Feb 2021 18:28:44 +0100 Original-Received: from localhost ([::1]:60510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6d0F-0004Ez-L8 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Feb 2021 12:28:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6cwg-0000rt-Vd for bug-gnu-emacs@gnu.org; Mon, 01 Feb 2021 12:25:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6cwg-0003FJ-OY for bug-gnu-emacs@gnu.org; Mon, 01 Feb 2021 12:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l6cwg-0003vj-L0 for bug-gnu-emacs@gnu.org; Mon, 01 Feb 2021 12:25: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: Mon, 01 Feb 2021 17:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44611 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 44611-submit@debbugs.gnu.org id=B44611.161220025214995 (code B ref 44611); Mon, 01 Feb 2021 17:25:02 +0000 Original-Received: (at 44611) by debbugs.gnu.org; 1 Feb 2021 17:24:12 +0000 Original-Received: from localhost ([127.0.0.1]:33046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6cvs-0003tl-JJ for submit@debbugs.gnu.org; Mon, 01 Feb 2021 12:24:12 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:41665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6cvq-0003tQ-0X for 44611@debbugs.gnu.org; Mon, 01 Feb 2021 12:24:11 -0500 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id A6241100014; Mon, 1 Feb 2021 17:24:00 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Tue, 19 Jan 2021 21:38:43 +0200") 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:199096 Archived-At: --=-=-= Content-Type: text/plain > I think C-u RET is probably fine, especially if we add a change like you > described to compile-goto-error as well. But if anyone wanted to propose > some other alternative, they're welcome to. I want to propose another alternative: to implement C-u RET not only for compilation-mode, but also for e.g. occur-mode, maybe current-prefix-arg could be handled in 'next-error-found' by adding to the end: (when (and current-prefix-arg from-buffer (not (eq from-buffer to-buffer))) (let ((window (get-buffer-window from-buffer))) (with-selected-window window (quit-restore-window window)))) But this means that it should take into account possible values of the prefix arg of the command 'next-error': A prefix ARG specifies how many error messages to move; negative means move back to previous error messages. Just C-u as a prefix means reparse the error message buffer and start at the first error. So since 'C-u M-g n' is already taken, an alternative is 'C-0 M-g n'. If 'C-0' makes no sense for 'C-0 M-g n', it could be used to close the window. Or maybe 'C-0 M-g n' still makes sense, e.g. to redisplay the current location? BTW, here are the commands that work like TAB in grep-mode. I propose to install this patch, so at least users could bind them in own init files: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref-no-display.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 18fdd963fb..750a090b84 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -607,16 +607,26 @@ xref-show-location-at-point (when xref (xref--show-location (xref-item-location xref))))) +(defun xref-next-line-no-display () + "Move to the next xref but don't display its source." + (interactive) + (xref--search-property 'xref-item)) + (defun xref-next-line () "Move to the next xref and display its source in the appropriate window." (interactive) - (xref--search-property 'xref-item) + (xref-next-line-no-display) (xref-show-location-at-point)) +(defun xref-prev-line-no-display () + "Move to the previous xref but don't display its source." + (interactive) + (xref--search-property 'xref-item t)) + (defun xref-prev-line () "Move to the previous xref and display its source in the appropriate window." (interactive) - (xref--search-property 'xref-item t) + (xref-prev-line-no-display) (xref-show-location-at-point)) (defun xref-next-group () --=-=-=--