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: Sat, 19 Dec 2020 22:38:12 +0200 Message-ID: <87v9cxleff.fsf@mail.linkov.net> References: <87k0up68e4.fsf@mail.linkov.net> <99772eb6-5a4e-7cf6-259d-0e9429e6bf97@yandex.ru> <878sb3n0a9.fsf@mail.linkov.net> <48f942f9-a557-0185-25fe-612e78cd9071@yandex.ru> <875z67gd6z.fsf@mail.linkov.net> <72e9e5e9-651f-401f-2e26-faaac1b7fdb5@yandex.ru> 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="1113"; 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: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 44611@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 19 21:41:11 2020 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 1kqj2N-0000BD-Ns for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 21:41:11 +0100 Original-Received: from localhost ([::1]:39540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqj2M-0006wT-7U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 15:41:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqj2E-0006wK-EP for bug-gnu-emacs@gnu.org; Sat, 19 Dec 2020 15:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqj2E-0002mK-7E for bug-gnu-emacs@gnu.org; Sat, 19 Dec 2020 15:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kqj2E-0006gr-40 for bug-gnu-emacs@gnu.org; Sat, 19 Dec 2020 15:41: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: Sat, 19 Dec 2020 20:41: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.160841040725627 (code B ref 44611); Sat, 19 Dec 2020 20:41:02 +0000 Original-Received: (at 44611) by debbugs.gnu.org; 19 Dec 2020 20:40:07 +0000 Original-Received: from localhost ([127.0.0.1]:43259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqj1K-0006fH-Ox for submit@debbugs.gnu.org; Sat, 19 Dec 2020 15:40:07 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqj1I-0006ed-6R for 44611@debbugs.gnu.org; Sat, 19 Dec 2020 15:40:04 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 905891BF204; Sat, 19 Dec 2020 20:39:56 +0000 (UTC) In-Reply-To: <72e9e5e9-651f-401f-2e26-faaac1b7fdb5@yandex.ru> (Dmitry Gutov's message of "Mon, 16 Nov 2020 00:25:03 +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:196427 Archived-At: --=-=-= Content-Type: text/plain >> I'd expect TAB rather to iterate over multiple matches, >> i.e. like TAB in browsers go to the next match. Even in the *Completions* >> buffer TAB moves to the next completion. And in icomplete-mode >> the closest analogy to picking one result is 'C-j' >> (icomplete-force-complete-and-exit). > > If people like it, I'm totally fine with changing the binding to 'C-j'. I'm very sorry for beating this horse again, but after trying to use xref as a replacement of grep, typing 'C-x p g' pops up a grep-like buffer and due to habit of typing the same keys that are supported by grep-mode where among them is TAB bound to compilation-next-error to browse the results forward, but instead of going to the next match, it does the worst thing imaginable - kills the output buffer. Therefore, I propose this patch that binds TAB and S-TAB to command that behave like compilation-next-error and compilation-previous-error: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref-compilation-next-error.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 6e99e9d8ac..6c333fc8c1 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -581,16 +581,26 @@ xref-show-location-at-point (when xref (xref--show-location (xref-item-location xref))))) +(defun xref-next-line-no-select () + "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-select) (xref-show-location-at-point)) +(defun xref-prev-line-no-select () + "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-select) (xref-show-location-at-point)) (defun xref-next-group () @@ -761,7 +771,8 @@ xref--xref-buffer-mode-map (define-key map (kbd "P") #'xref-prev-group) (define-key map (kbd "r") #'xref-query-replace-in-results) (define-key map (kbd "RET") #'xref-goto-xref) - (define-key map (kbd "TAB") #'xref-quit-and-goto-xref) + (define-key map "\t" 'xref-next-line-no-select) ; like compilation-next-error + (define-key map [backtab] 'xref-prev-line-no-select) ; like compilation-previous-error (define-key map (kbd "C-o") #'xref-show-location-at-point) ;; suggested by Johan Claesson "to further reduce finger movement": (define-key map (kbd ".") #'xref-next-line) --=-=-=--