From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Dmitry Gutov <dgutov@yandex.ru>,
joaotavora@gmail.com, 44611@debbugs.gnu.org
Subject: bug#44611: Prefix arg for xref-goto-xref
Date: Thu, 24 Dec 2020 22:19:16 +0200 [thread overview]
Message-ID: <87pn2zlzy3.fsf@mail.linkov.net> (raw)
In-Reply-To: <83pn2znloa.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 24 Dec 2020 19:44:37 +0200")
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]
> 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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xref-quit-and-goto-xref.patch --]
[-- Type: text/x-diff, Size: 2433 bytes --]
diff --git a/etc/NEWS b/etc/NEWS
index b155ff9d42..14dba83368 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1820,6 +1820,11 @@ first).
\f
* 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)
next prev parent reply other threads:[~2020-12-24 20:19 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 8:18 bug#44611: Prefix arg for xref-goto-xref Juri Linkov
2020-11-13 11:20 ` Dmitry Gutov
2020-11-14 20:36 ` Juri Linkov
2020-11-15 1:05 ` Dmitry Gutov
2020-11-15 19:51 ` Juri Linkov
2020-11-15 22:25 ` Dmitry Gutov
2020-11-15 22:52 ` Drew Adams
2020-11-15 23:11 ` João Távora
2020-12-19 20:38 ` Juri Linkov
2020-12-19 21:41 ` Dmitry Gutov
2020-12-19 22:36 ` João Távora
2020-12-19 23:59 ` Dmitry Gutov
2020-12-20 20:32 ` João Távora
2020-12-20 20:45 ` Dmitry Gutov
2020-12-22 0:52 ` João Távora
2020-12-20 3:26 ` Eli Zaretskii
2020-12-20 8:39 ` Juri Linkov
2020-12-20 15:43 ` Eli Zaretskii
2020-12-20 16:10 ` Dmitry Gutov
2020-12-22 8:58 ` Juri Linkov
2020-12-22 12:20 ` Dmitry Gutov
2020-12-22 15:53 ` Eli Zaretskii
2020-12-22 21:20 ` Juri Linkov
2020-12-23 15:08 ` Eli Zaretskii
2020-12-23 16:20 ` Dmitry Gutov
2020-12-23 16:46 ` Eli Zaretskii
2020-12-23 18:45 ` Dmitry Gutov
2020-12-23 19:23 ` Eli Zaretskii
2020-12-23 19:56 ` Dmitry Gutov
2020-12-23 20:30 ` Eli Zaretskii
2020-12-23 21:24 ` Dmitry Gutov
2020-12-24 17:44 ` Eli Zaretskii
2020-12-24 20:19 ` Juri Linkov [this message]
2020-12-24 20:44 ` Eli Zaretskii
2020-12-25 9:20 ` Juri Linkov
2020-12-25 11:44 ` Eli Zaretskii
2020-12-25 15:24 ` Dmitry Gutov
2020-12-27 16:22 ` Juri Linkov
2020-12-27 17:16 ` martin rudalics
2020-12-27 18:53 ` Dmitry Gutov
2020-12-28 17:24 ` Juri Linkov
2021-01-18 1:17 ` Dmitry Gutov
2021-01-19 17:56 ` Juri Linkov
2021-01-19 19:38 ` Dmitry Gutov
2021-02-01 17:16 ` Juri Linkov
2021-03-16 18:15 ` Juri Linkov
2021-03-17 8:45 ` martin rudalics
[not found] ` <87sg4vgef6.fsf@mail.linkov.net>
2021-03-16 23:38 ` Dmitry Gutov
2021-03-17 17:23 ` Juri Linkov
2021-03-17 21:48 ` Dmitry Gutov
2020-12-27 16:20 ` Juri Linkov
2020-12-27 18:21 ` Eli Zaretskii
2020-12-28 0:54 ` Dmitry Gutov
2020-12-28 9:16 ` Juri Linkov
2021-04-22 15:18 ` Dmitry Gutov
[not found] ` <1fa6bd28-0524-011e-86c2-60c8faab51f8@yandex.ru>
2021-04-22 17:03 ` Eli Zaretskii
2021-04-22 17:44 ` Dmitry Gutov
2021-04-22 17:47 ` Eli Zaretskii
2021-04-22 17:56 ` Dmitry Gutov
2020-12-25 16:01 ` Dmitry Gutov
2021-04-23 10:41 ` Dmitry Gutov
2021-04-23 10:53 ` Eli Zaretskii
2021-04-24 9:56 ` Eli Zaretskii
2021-04-24 10:01 ` Dmitry Gutov
2020-12-23 21:10 ` Juri Linkov
2020-12-24 3:36 ` Eli Zaretskii
2020-12-24 21:38 ` Dmitry Gutov
2020-12-25 7:37 ` Eli Zaretskii
2020-12-25 12:14 ` Dmitry Gutov
2020-12-25 13:32 ` Eli Zaretskii
2020-12-25 14:49 ` Dmitry Gutov
2020-12-25 15:42 ` Eli Zaretskii
2020-12-28 0:36 ` Dmitry Gutov
2020-12-22 9:24 ` João Távora
2020-12-11 9:30 ` Juri Linkov
2020-12-11 11:19 ` Dmitry Gutov
2020-12-11 12:08 ` Eli Zaretskii
2020-12-12 20:39 ` Juri Linkov
2020-12-13 15:10 ` Eli Zaretskii
2020-12-13 20:20 ` Juri Linkov
2020-12-13 20:50 ` João Távora
2020-12-14 16:16 ` Eli Zaretskii
2020-12-14 16:34 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pn2zlzy3.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=44611@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=joaotavora@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.