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: Thu, 24 Dec 2020 22:19:16 +0200 Organization: LINKOV.NET Message-ID: <87pn2zlzy3.fsf@mail.linkov.net> References: <87k0up68e4.fsf@mail.linkov.net> <878sb3n0a9.fsf@mail.linkov.net> <48f942f9-a557-0185-25fe-612e78cd9071@yandex.ru> <875z67gd6z.fsf@mail.linkov.net> <72e9e5e9-651f-401f-2e26-faaac1b7fdb5@yandex.ru> <87v9cxleff.fsf@mail.linkov.net> <834kkhtaxm.fsf@gnu.org> <874kkgswg2.fsf@mail.linkov.net> <83v9cwsct7.fsf@gnu.org> <87k0tab3y0.fsf@mail.linkov.net> <83pn31rg5a.fsf@gnu.org> <877dp9ycq6.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> 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="31626"; 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: Dmitry Gutov , joaotavora@gmail.com, 44611@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 24 21:40:52 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 1ksXPn-00087f-GH for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 21:40:51 +0100 Original-Received: from localhost ([::1]:34458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksXPl-0000Yb-Av for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 15:40:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksXO3-0007je-Bj for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksXO3-0007EE-4L for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ksXO3-0008J2-2P for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Dec 2020 20:39:03 +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.160884231031847 (code B ref 44611); Thu, 24 Dec 2020 20:39:03 +0000 Original-Received: (at 44611) by debbugs.gnu.org; 24 Dec 2020 20:38:30 +0000 Original-Received: from localhost ([127.0.0.1]:56058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksXNW-0008Hb-85 for submit@debbugs.gnu.org; Thu, 24 Dec 2020 15:38:30 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:48275) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksXNT-0008H2-Ss for 44611@debbugs.gnu.org; Thu, 24 Dec 2020 15:38:30 -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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 1BFB81C0004; Thu, 24 Dec 2020 20:38:19 +0000 (UTC) In-Reply-To: <83pn2znloa.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 24 Dec 2020 19:44:37 +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:196661 Archived-At: --=-=-= Content-Type: text/plain > There's only one rule: not to make backward-incompatible changes > without a very good reason. With further development of the search commands based on xref, more users perceive it as a grep replacement, that however is not based on grep mode, so this is a good reason to make xref keybindings more compatible with grep mode. > Given the single precedent I found, I'm fine with declaring the > current binding of TAB obsolete and providing a replacement for it > ('b'? 'q'?), so that we could replace it in some future version after > 28, if that is okay with you and Juri. Thanks, this is surely okay. So here is the patch that does this. It binds 'xref-quit-and-goto-xref' to 'C-j' like in icomplete mode: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref-quit-and-goto-xref.patch diff --git a/etc/NEWS b/etc/NEWS index b155ff9d42..14dba83368 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1820,6 +1820,11 @@ first). * Incompatible Editing Changes in Emacs 28.1 +** In xref, 'TAB' now moves to the next xref instead of quitting *xref* buffer. +Using 'TAB' / 'S-TAB' key bindings to navigate the search results +is more in the line with other modes like grep mode. The command +'xref-quit-and-goto-xref' is now bound to 'C-j' like in icomplete. + ** In 'nroff-mode', 'center-line' is now bound to 'M-o M-s'. The original key binding was 'M-s', which interfered with I-search, since the latter uses 'M-s' as a prefix key of the search prefix map. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 181f94b0bc..8b48396495 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -585,16 +585,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 () @@ -765,7 +775,9 @@ 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 (kbd "C-j") #'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) --=-=-=--