From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#36967: 27.0.50; Duplicate lines in xref output Date: Thu, 03 Dec 2020 23:30:05 +0200 Organization: LINKOV.NET Message-ID: <87zh2u60iq.fsf@mail.linkov.net> References: <87ef1wod82.fsf@mail.linkov.net> <950a9da4-4081-fe80-598f-eeb3931e24ad@yandex.ru> <87wnxz6glx.fsf@mail.linkov.net> <20e61edd-9ee6-deab-7ff4-94b0ba527dc4@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26955"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 36967@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 03 22:40:32 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkwL0-0006rb-RU for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Dec 2020 22:40:30 +0100 Original-Received: from localhost ([::1]:55054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkwKz-0005R1-OU for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Dec 2020 16:40:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkwKZ-00050l-EE for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 16:40:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkwKZ-0000Mt-6x for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 16:40:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkwKZ-0007Wp-3x for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 16:40:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Dec 2020 21:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36967 X-GNU-PR-Package: emacs Original-Received: via spool by 36967-submit@debbugs.gnu.org id=B36967.160703155528822 (code B ref 36967); Thu, 03 Dec 2020 21:40:03 +0000 Original-Received: (at 36967) by debbugs.gnu.org; 3 Dec 2020 21:39:15 +0000 Original-Received: from localhost ([127.0.0.1]:41968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkwJm-0007Un-S0 for submit@debbugs.gnu.org; Thu, 03 Dec 2020 16:39:15 -0500 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:54113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkwJk-0007UN-TY for 36967@debbugs.gnu.org; Thu, 03 Dec 2020 16:39:13 -0500 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id B378B200003; Thu, 3 Dec 2020 21:39:05 +0000 (UTC) In-Reply-To: <20e61edd-9ee6-deab-7ff4-94b0ba527dc4@yandex.ru> (Dmitry Gutov's message of "Thu, 3 Dec 2020 03:35:19 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:194925 Archived-At: >> Here is the patch that makes the broken > > Pretty harsh there. But true: I can't use it in the current form, and was waiting when someone will fix it. >> project-find-regexp usable: > > Downside: xref-query-replace-in-results won't work in those cases anymore; > it will only replace one match. Because the list only contains one > location, and not all of them. And that command is pretty nice to have. Sorry, I missed this use case because I still know too little about details of xref.el. > Here's an alternative proposal: > > Combine the lines inside the rendering code instead. > > So each xref will have a separate location, but then xref--insert-xrefs > will see that xref-location-line value repeats across some consecutive > locations, and will combine them into single line with some text property > magic (basically, copying the summary from one of them, and then applying > 'xref-item and 'face properties appropriately). This retains the xref item > semantics (as opposed to, say, associating an xref item with multiple > locations). And _hopefully_ the replace-related code won't need > any changes. I tried to improve xref--insert-xrefs to group matches by lines by using the most convenient function seq-group-by. But then noticed that xref.el doesn't rely on seq.el. Even xref--alistify that groups matches by files could be replaced by seq-group-by. Is it a requirement to avoid using seq functions in xref.el?