aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/xref.el54
1 files changed, 26 insertions, 28 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 980ef4c8d5d..093e3d36d51 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -956,13 +956,11 @@ GROUP is a string for decoration purposes and XREF is an
956`xref-item' object." 956`xref-item' object."
957 (require 'compile) ; For the compilation faces. 957 (require 'compile) ; For the compilation faces.
958 (cl-loop for (group . xrefs) in xref-alist 958 (cl-loop for (group . xrefs) in xref-alist
959 for max-line-width = 959 for max-line = (cl-loop for xref in xrefs
960 (cl-loop for xref in xrefs 960 maximize (xref-location-line
961 maximize (let ((line (xref-location-line 961 (xref-item-location xref)))
962 (xref-item-location xref)))) 962 for line-format = (and max-line
963 (and line (1+ (floor (log line 10)))))) 963 (format "%%%dd: " (1+ (floor (log max-line 10)))))
964 for line-format = (and max-line-width
965 (format "%%%dd: " max-line-width))
966 with item-text-props = (list 'mouse-face 'highlight 964 with item-text-props = (list 'mouse-face 'highlight
967 'keymap xref--button-map 965 'keymap xref--button-map
968 'help-echo 966 'help-echo
@@ -973,27 +971,27 @@ GROUP is a string for decoration purposes and XREF is an
973 do 971 do
974 (xref--insert-propertized '(face xref-file-header xref-group t) 972 (xref--insert-propertized '(face xref-file-header xref-group t)
975 group "\n") 973 group "\n")
976 (cl-loop for xref in xrefs do 974 (dolist (xref xrefs)
977 (pcase-let (((cl-struct xref-item summary location) xref)) 975 (pcase-let (((cl-struct xref-item summary location) xref))
978 (let* ((line (xref-location-line location)) 976 (let* ((line (xref-location-line location))
979 (prefix 977 (prefix
980 (cond 978 (cond
981 ((not line) " ") 979 ((not line) " ")
982 ((and (equal line prev-line) 980 ((and (equal line prev-line)
983 (equal prev-group group)) 981 (equal prev-group group))
984 "") 982 "")
985 (t (propertize (format line-format line) 983 (t (propertize (format line-format line)
986 'face 'xref-line-number))))) 984 'face 'xref-line-number)))))
987 ;; Render multiple matches on the same line, together. 985 ;; Render multiple matches on the same line, together.
988 (when (and (equal prev-group group) 986 (when (and (equal prev-group group)
989 (or (null line) 987 (or (null line)
990 (not (equal prev-line line)))) 988 (not (equal prev-line line))))
991 (insert "\n")) 989 (insert "\n"))
992 (xref--insert-propertized (nconc (list 'xref-item xref) 990 (xref--insert-propertized (nconc (list 'xref-item xref)
993 item-text-props) 991 item-text-props)
994 prefix summary) 992 prefix summary)
995 (setq prev-line line 993 (setq prev-line line
996 prev-group group)))) 994 prev-group group))))
997 (insert "\n")) 995 (insert "\n"))
998 (add-to-invisibility-spec '(ellipsis . t)) 996 (add-to-invisibility-spec '(ellipsis . t))
999 (save-excursion 997 (save-excursion