From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>
Cc: 36967@debbugs.gnu.org
Subject: bug#36967: 27.0.50; Duplicate lines in xref output
Date: Wed, 9 Dec 2020 05:53:55 +0200 [thread overview]
Message-ID: <1c75343f-9215-624b-c314-90a01714478a@yandex.ru> (raw)
In-Reply-To: <87v9deais9.fsf@mail.linkov.net>
On 06.12.2020 22:31, Juri Linkov wrote:
>> 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.
Thanks! Seems to work well. Especially with this addition:
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 9f5fc57142..9ad956d496 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -595,7 +595,8 @@ xref-prev-line
(defun xref--item-at-point ()
(save-excursion
- (back-to-indentation)
+ (when (eolp)
+ (forward-char -1))
(get-text-property (point) 'xref-item)))
(defun xref-goto-xref (&optional quit)
> However, there is a problem: when xref--insert-xrefs is called by
> 'M-.' that uses etags, then it signals an error:
Does it happen when two symbols do indeed get defined on the same line?
Sounds like a rare situation.
> cl-no-applicable-method xref-file-location-column
>
> And I don't know how to fix etags to add columns.
Using xref-file-location-column there kind of breaks the abstraction. I
was thinking more along the lines of text-prop search for the column
inside the summary string:
(setq column
(with-temp-buffer
(insert summary)
(goto-char (point-min))
(let ((match
(text-property-search-forward
'face 'xref-match
(lambda (target value)
(or (eq target value)
(and (listp value)
(member target value)))))))
(and match
(1- (prop-match-beginning match))))))
That's quite a bit longer, though. And it still will work only with some
kinds of xrefs: I'm not sure I know how to add columns to etags either.
Not to mention third-party xref backends.
The rest won't get deduplication, but that's probably all right.
next prev parent reply other threads:[~2020-12-09 3:53 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
2020-12-09 3:53 ` Dmitry Gutov [this message]
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=1c75343f-9215-624b-c314-90a01714478a@yandex.ru \
--to=dgutov@yandex.ru \
--cc=36967@debbugs.gnu.org \
--cc=juri@linkov.net \
/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).