Fix the bug with duplicate entries in xref output

* lisp/progmodes/etags.el (xref-backend-definitions): Make sure to
save the changed intermediate value of the list (bug#52734).
This commit is contained in:
Dmitry Gutov 2021-12-24 15:27:00 +02:00
parent 04be23f19f
commit c09ad0cabd

View file

@ -2084,6 +2084,7 @@ file name, add `tag-partial-file-name-match-p' to the list value.")
(definitions (etags--xref-find-definitions symbol)) (definitions (etags--xref-find-definitions symbol))
same-file-definitions) same-file-definitions)
(when (and etags-xref-prefer-current-file file) (when (and etags-xref-prefer-current-file file)
(setq definitions
(cl-delete-if (cl-delete-if
(lambda (definition) (lambda (definition)
(when (equal file (when (equal file
@ -2091,7 +2092,7 @@ file name, add `tag-partial-file-name-match-p' to the list value.")
(xref-item-location definition))) (xref-item-location definition)))
(push definition same-file-definitions) (push definition same-file-definitions)
t)) t))
definitions) definitions))
(setq definitions (nconc (nreverse same-file-definitions) (setq definitions (nconc (nreverse same-file-definitions)
definitions))) definitions)))
definitions)) definitions))