emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 31cfd6d311: Fix xref interaction with which-func (bug#59575)


From: Juanma Barranquero
Subject: master 31cfd6d311: Fix xref interaction with which-func (bug#59575)
Date: Sun, 27 Nov 2022 08:58:59 -0500 (EST)

branch: master
commit 31cfd6d3116d18c2c5b031369aeba0170d4920de
Author: Juanma Barranquero <lekktu@gmail.com>
Commit: Juanma Barranquero <lekktu@gmail.com>

    Fix xref interaction with which-func (bug#59575)
    
    * lisp/progmodes/xref.el (xref--add-log-current-defun):
    New function.
    (xref--xref-buffer-mode): Assign it buffer-locally to
    `add-log-current-defun-function'.
---
 lisp/progmodes/xref.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 9b8d37a28e..f3ba60fc05 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -985,6 +985,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
         #'xref--imenu-prev-index-position)
   (setq imenu-extract-index-name-function
         #'xref--imenu-extract-index-name)
+  (setq-local add-log-current-defun-function
+             #'xref--add-log-current-defun)
   (setq-local outline-minor-mode-cycle t
               outline-minor-mode-use-buttons t
               outline-search-function
@@ -1019,6 +1021,15 @@ beginning of the line."
   (buffer-substring-no-properties (line-beginning-position)
                                   (line-end-position)))
 
+(defun xref--add-log-current-defun ()
+  "Return the string used to group a set of locations.
+This function is used as a value for `add-log-current-defun-function'."
+  (xref--group-name-for-display
+   (if-let (item (xref--item-at-point))
+       (xref-location-group (xref-match-item-location item))
+     (xref--imenu-extract-index-name))
+   (xref--project-root (project-current))))
+
 (defun xref--next-error-function (n reset?)
   (when reset?
     (goto-char (point-min)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]