[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d6ad208 5/6: Use overlay arrow to indicate current *xref* selecti
From: |
Mattias Engdegård |
Subject: |
master d6ad208 5/6: Use overlay arrow to indicate current *xref* selection |
Date: |
Sat, 21 Aug 2021 06:56:44 -0400 (EDT) |
branch: master
commit d6ad208b2cea6cb78ea4427ae4715bc5e6c5c85b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Use overlay arrow to indicate current *xref* selection
* lisp/progmodes/xref.el (xref--set-arrow): New function.
(xref-show-location-at-point, xref-goto-xref)
(xref--next-error-function): Call it.
(xref--show-common-initialize): Remove arrow.
---
lisp/progmodes/xref.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index a8bab47..d004a0c 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -600,12 +600,19 @@ SELECT is `quit', also quit the *xref* window."
(xref--show-pos-in-buf marker buf))))))
(user-error (message (error-message-string err)))))
+(defun xref--set-arrow ()
+ "Set the overlay arrow at the line at point."
+ (setq overlay-arrow-position
+ (set-marker (or overlay-arrow-position (make-marker))
+ (line-beginning-position))))
+
(defun xref-show-location-at-point ()
"Display the source of xref at point in the appropriate window, if any."
(interactive)
(let* ((xref (xref--item-at-point))
(xref--current-item xref))
(when xref
+ (xref--set-arrow)
(xref--show-location (xref-item-location xref)))))
(defun xref-next-line-no-show ()
@@ -663,6 +670,7 @@ quit the *xref* buffer."
(xref (or (xref--item-at-point)
(user-error "Choose a reference to visit")))
(xref--current-item xref))
+ (xref--set-arrow)
(xref--show-location (xref-item-location xref) (if quit 'quit t))
(if (fboundp 'next-error-found)
(next-error-found buffer (current-buffer))
@@ -881,6 +889,7 @@ beginning of the line."
;; it gets reset to that window's point from time to time).
(let ((win (get-buffer-window (current-buffer))))
(and win (set-window-point win (point))))
+ (xref--set-arrow)
(let ((xref--current-item xref))
(xref--show-location (xref-item-location xref) t)))
(t
@@ -1026,6 +1035,7 @@ Return an alist of the form ((FILENAME . (XREF ...))
...)."
(let ((inhibit-read-only t)
(buffer-undo-list t))
(erase-buffer)
+ (setq overlay-arrow-position nil)
(xref--insert-xrefs xref-alist)
(add-hook 'post-command-hook 'xref--apply-truncation nil t)
(goto-char (point-min))
- master updated (20e32f3 -> f415956), Mattias Engdegård, 2021/08/21
- master 4d6e770 2/6: Re-type the :location slot in `xref-match-item` to `xref-location`, Mattias Engdegård, 2021/08/21
- master 6993d45 4/6: Add "Find References" to context menu (bug#50067), Mattias Engdegård, 2021/08/21
- master b483090 3/6: Indicate progress while searching for references in xref, Mattias Engdegård, 2021/08/21
- master 49435be 1/6: Add xref operations to context menu unconditionally, Mattias Engdegård, 2021/08/21
- master f415956 6/6: Remove default "Select" title from NS popup menus (bug#50067), Mattias Engdegård, 2021/08/21
- master d6ad208 5/6: Use overlay arrow to indicate current *xref* selection,
Mattias Engdegård <=