diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 9f5fc57142..260623180e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -832,17 +832,28 @@ xref--insert-xrefs (length (and line (format "%d" line))))) for line-format = (and max-line-width (format "%%%dd: " max-line-width)) + with prev-line-key = nil do (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (cl-loop for (xref . more2) on xrefs do (with-slots (summary location) xref (let* ((line (xref-location-line location)) + (line-key (list (xref-location-group location) line)) (prefix (if line (propertize (format line-format line) 'face 'xref-line-number) " "))) + (when (equal prev-line-key line-key) + (let ((column (xref-file-location-column location))) + (delete-region + (save-excursion + (forward-line -1) + (move-to-column (+ (length prefix) column)) + (point)) + (point)) + (setq summary (substring summary column) prefix ""))) (xref--insert-propertized (list 'xref-item xref 'mouse-face 'highlight @@ -850,7 +861,8 @@ xref--insert-xrefs 'help-echo (concat "mouse-2: display in another window, " "RET or mouse-1: follow reference")) - prefix summary))) + prefix summary) + (setq prev-line-key line-key))) (insert "\n")))) (defun xref--analyze (xrefs)