Slight simplificaiton

* lisp/progmodes/xref.el (xref--insert-xrefs):
Compute log only once.  Use 'dolist'.
This commit is contained in:
Dmitry Gutov 2021-10-09 03:33:57 +03:00
parent e139dd1b1e
commit bbcd8cc1a9

View file

@ -956,13 +956,11 @@ GROUP is a string for decoration purposes and XREF is an
`xref-item' object."
(require 'compile) ; For the compilation faces.
(cl-loop for (group . xrefs) in xref-alist
for max-line-width =
(cl-loop for xref in xrefs
maximize (let ((line (xref-location-line
(xref-item-location xref))))
(and line (1+ (floor (log line 10))))))
for line-format = (and max-line-width
(format "%%%dd: " max-line-width))
for max-line = (cl-loop for xref in xrefs
maximize (xref-location-line
(xref-item-location xref)))
for line-format = (and max-line
(format "%%%dd: " (1+ (floor (log max-line 10)))))
with item-text-props = (list 'mouse-face 'highlight
'keymap xref--button-map
'help-echo
@ -973,7 +971,7 @@ GROUP is a string for decoration purposes and XREF is an
do
(xref--insert-propertized '(face xref-file-header xref-group t)
group "\n")
(cl-loop for xref in xrefs do
(dolist (xref xrefs)
(pcase-let (((cl-struct xref-item summary location) xref))
(let* ((line (xref-location-line location))
(prefix