From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 36967@debbugs.gnu.org
Subject: bug#36967: 27.0.50; Duplicate lines in xref output
Date: Sun, 06 Dec 2020 22:31:02 +0200 [thread overview]
Message-ID: <87v9deais9.fsf@mail.linkov.net> (raw)
In-Reply-To: <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> (Dmitry Gutov's message of "Fri, 4 Dec 2020 01:44:47 +0200")
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
> I'm _slightly_ worried about extra garbage if we do seq-group-by twice
> (with an extra list for every line, even those that don't need it), but
> that's what benchmarking is for (can do that later).
I'm worried about extra garbage too, so this patch doesn't cause extra lists.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: multiline-xref-insert-xrefs.patch --]
[-- Type: text/x-diff, Size: 2217 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 220 bytes --]
However, there is a problem: when xref--insert-xrefs is called by
'M-.' that uses etags, then it signals an error:
cl-no-applicable-method xref-file-location-column
And I don't know how to fix etags to add columns.
next prev parent reply other threads:[~2020-12-06 20:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 21:52 bug#36967: 27.0.50; Duplicate lines in xref output Juri Linkov
2019-08-07 22:13 ` Dmitry Gutov
2020-12-02 21:30 ` Juri Linkov
2020-12-03 1:35 ` Dmitry Gutov
2020-12-03 21:30 ` Juri Linkov
2020-12-03 23:44 ` Dmitry Gutov
2020-12-06 20:31 ` Juri Linkov [this message]
2020-12-09 3:53 ` Dmitry Gutov
2020-12-09 13:57 ` Dmitry Gutov
2020-12-21 1:42 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9deais9.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=36967@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).