From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 07 18:03:05 2019 Received: (at submit) by debbugs.gnu.org; 7 Aug 2019 22:03:05 +0000 Received: from localhost ([127.0.0.1]:39595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvU1R-0003uF-D6 for submit@debbugs.gnu.org; Wed, 07 Aug 2019 18:03:05 -0400 Received: from lists.gnu.org ([209.51.188.17]:46363) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvU1P-0003td-U5 for submit@debbugs.gnu.org; Wed, 07 Aug 2019 18:03:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46507) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvU1P-0001Et-2v for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2019 18:03:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvU1O-0007eV-7B for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2019 18:03:03 -0400 Received: from cadetblue.birch.relay.mailchannels.net ([23.83.209.28]:29377) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hvU1N-0007dP-V5 for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2019 18:03:02 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 045D614297F for ; Wed, 7 Aug 2019 22:03:00 +0000 (UTC) Received: from pdx1-sub0-mail-a93.g.dreamhost.com (100-96-91-66.trex.outbound.svc.cluster.local [100.96.91.66]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 85388142E21 for ; Wed, 7 Aug 2019 22:02:59 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a93.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.5); Wed, 07 Aug 2019 22:02:59 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Callous-Stop: 3280f8bf0b9706ec_1565215379753_3367067180 X-MC-Loop-Signature: 1565215379753:765122602 X-MC-Ingress-Time: 1565215379753 Received: from pdx1-sub0-mail-a93.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTP id 65EC08115B for ; Wed, 7 Aug 2019 15:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=Rml0a/v+CW5J431+JrMMN/9kR/o=; b=nS8bhlYifzfytYP7k RPZkhSaO32QpqceyEzFbU2lbmLtP0x/MjwE8VqkgtN17hvEPXFxc/8UACy9tZM89 B6wxKLoN6+fVyRU14Vb/Mid2E49ZrDUE53u5V+Qi/VAEBt4kNRWrp59LYWaBJTZa q5gPKaBvh8WH7GiBChSZrMyWr0= Received: from mail.jurta.org (m91-129-103-91.cust.tele2.ee [91.129.103.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTPSA id 2BBFE7F015 for ; Wed, 7 Aug 2019 15:02:53 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a93 From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Duplicate lines in xref output Organization: LINKOV.NET Date: Thu, 08 Aug 2019 00:52:13 +0300 Message-ID: <87ef1wod82.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddufedgtdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtfedrledunecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtfedrledupdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 23.83.209.28 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) I tried to use project-find-regexp more often than rgrep, but unfortunately xref still has a fundamental flaw: 0. emacs -Q 1. M-x project-find-regexp RET regexp RET 2. The output buffer *xref* contains duplicate lines when regexp is found on the same line several times, each duplicate output line has separate highlighting for every regexp occurrence. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 07 18:13:17 2019 Received: (at 36967) by debbugs.gnu.org; 7 Aug 2019 22:13:18 +0000 Received: from localhost ([127.0.0.1]:39605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvUBJ-0004Ct-Ns for submit@debbugs.gnu.org; Wed, 07 Aug 2019 18:13:17 -0400 Received: from mail-lj1-f182.google.com ([209.85.208.182]:36673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvUBI-0004Cc-1M for 36967@debbugs.gnu.org; Wed, 07 Aug 2019 18:13:16 -0400 Received: by mail-lj1-f182.google.com with SMTP id i21so7688906ljj.3 for <36967@debbugs.gnu.org>; Wed, 07 Aug 2019 15:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+Sb1qWXU/CtgeW2pUXO2lEeB1b5bdpcdilqb/3+kX5A=; b=I2vgBdptZBy1Y7zCEdMSwy4QgkevQwhNhhbN2CK3tIFL4wmXBiRS3pBqkgGNluHrT8 x6MUAE4Mzw6HD6s+4Sfyv2Wmo4LQ2g4dukTMYfeIkbScYE3QCq6APw9e7eKurvJN5y3d SHyajfBiSwXqIvXtAThu/y98EFlgMHoGBC4we9S9ym89ifOJLXUIWNzz4bXyuIMiU4Mg RzRaUFC9ilN7gUWHnpuNxG5rtBTYFhy7oqKiTdisXm8aXQQAkY0KWgC39st5jADdzBEo hOeEPGZ7pVzHjycdLpjxz5p5BOcPP2+wO8ppOonOJOVvXIE3pUJQhug27JpEKiNMjAYJ XLPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+Sb1qWXU/CtgeW2pUXO2lEeB1b5bdpcdilqb/3+kX5A=; b=jhLUYyhFUxQ891sxUU6Ea8tVSizQE6kDqdkHFQr2ZwAs29nZMTkjvctlOWJ4gwaN6T HTKplaygFxbMR8mCR1a1kR2+7ciD9vcB1vRY1+UGJE9okUoDrzghQE9drYfqtIYS3SBJ +oL6JumA/YYmUbuEtvyrgAHP1i74BRMTMtFPmlMNzLq9+7t410YYN2YYikjmZCeMmwR1 g4AYr400dqYgqtiYokLRXEL1E+IhVZlKkDWWySzfZTMXfFr8/5yONwXjUAnJeMohIKNo CMyUCZMxa2qGP4qZ4wLnbYNUaznqIXRCIyzwO+tpUkxVS2j334th/5nbt+EKTz59ajMf fUqA== X-Gm-Message-State: APjAAAWBvPigZjnZqRjv+SJ5/CLMT7gP4lxba0sukNjZk4Ni92CKxnk6 sblHH237FCbjZggAiWmXM/SC6GMVO0X+FQ== X-Google-Smtp-Source: APXvYqyevVacH8ONvOJVlINzzjOihPgjsMNOWjNojVL0K0FBMJsvolLINrhZ4XHUWpl40+G6EMKdOQ== X-Received: by 2002:a2e:8155:: with SMTP id t21mr6086294ljg.80.1565215989981; Wed, 07 Aug 2019 15:13:09 -0700 (PDT) Received: from [192.168.1.142] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id h3sm18715320lja.93.2019.08.07.15.13.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 15:13:09 -0700 (PDT) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output To: Juri Linkov , 36967@debbugs.gnu.org References: <87ef1wod82.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: <950a9da4-4081-fe80-598f-eeb3931e24ad@yandex.ru> Date: Thu, 8 Aug 2019 01:13:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <87ef1wod82.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On 08.08.2019 0:52, Juri Linkov wrote: > I tried to use project-find-regexp more often than rgrep, > but unfortunately xref still has a fundamental flaw: > > 0. emacs -Q > 1. M-x project-find-regexp R [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [178.252.127.239 listed in dnsbl.sorbs.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dgutov[at]yandex.ru) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.208.182 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: 36967 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) On 08.08.2019 0:52, Juri Linkov wrote: > I tried to use project-find-regexp more often than rgrep, > but unfortunately xref still has a fundamental flaw: > > 0. emacs -Q > 1. M-x project-find-regexp RET regexp RET > 2. The output buffer *xref* contains duplicate lines > when regexp is found on the same line several times, > each duplicate output line has separate highlighting > for every regexp occurrence. I don't know how "fundamental" it is, but indeed, it's somewhat of a drawback. Suggestions for improving it (API change and/or implementation change) are welcome. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 30 15:28:13 2020 Received: (at control) by debbugs.gnu.org; 30 Sep 2020 19:28:13 +0000 Received: from localhost ([127.0.0.1]:33179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNhlt-0003MQ-DR for submit@debbugs.gnu.org; Wed, 30 Sep 2020 15:28:13 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:59123) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNhlp-0003M5-0T; Wed, 30 Sep 2020 15:28:12 -0400 X-Originating-IP: 91.129.108.13 Received: from mail.gandi.net (m91-129-108-13.cust.tele2.ee [91.129.108.13]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 6013420009; Wed, 30 Sep 2020 19:27:59 +0000 (UTC) From: Juri Linkov To: Lars Ingebrigtsen Subject: Re: bug#43715: 28.0.50; Duplicate results in project-find-regexp Organization: LINKOV.NET References: <87lfgr5psh.fsf@gnus.org> Date: Wed, 30 Sep 2020 22:25:25 +0300 In-Reply-To: <87lfgr5psh.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 30 Sep 2020 15:59:10 +0200") Message-ID: <87lfgrdq1q.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: control Cc: Dmitry Gutov , Pankaj Jangid , 43715@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) forcemerge 36967 43715 quit > So it this a feature or a bug? In bug#36967 it's labeled as a "drawback". From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 02 16:35:34 2020 Received: (at 36967) by debbugs.gnu.org; 2 Dec 2020 21:35:34 +0000 Received: from localhost ([127.0.0.1]:37583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkZmg-0004mu-4t for submit@debbugs.gnu.org; Wed, 02 Dec 2020 16:35:34 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:41039) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkZme-0004mh-4B for 36967@debbugs.gnu.org; Wed, 02 Dec 2020 16:35:32 -0500 X-Originating-IP: 91.129.99.98 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 93B1D240003; Wed, 2 Dec 2020 21:35:24 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output References: <87ef1wod82.fsf@mail.linkov.net> <950a9da4-4081-fe80-598f-eeb3931e24ad@yandex.ru> Date: Wed, 02 Dec 2020 23:30:18 +0200 In-Reply-To: <950a9da4-4081-fe80-598f-eeb3931e24ad@yandex.ru> (Dmitry Gutov's message of "Thu, 8 Aug 2019 01:13:07 +0300") Message-ID: <87wnxz6glx.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain >> I tried to use project-find-regexp more often than rgrep, >> but unfortunately xref still has a fundamental flaw: >> 0. emacs -Q >> 1. M-x project-find-regexp RET regexp RET >> 2. The output buffer *xref* contains duplicate lines >> when regexp is found on the same line several times, >> each duplicate output line has separate highlighting >> for every regexp occurrence. > > I don't know how "fundamental" it is, but indeed, it's somewhat of > a drawback. Suggestions for improving it (API change and/or implementation > change) are welcome. Here is the patch that makes the broken project-find-regexp usable: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref-usable.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 3b19debb79..1f5e45f20d 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1461,11 +1461,10 @@ xref--collect-matches syntax-needed))))) (defun xref--collect-matches-1 (regexp file line line-beg line-end syntax-needed) - (let (matches) + (let ((summary (buffer-substring line-beg line-end)) + matches) (when syntax-needed (syntax-propertize line-end)) - ;; FIXME: This results in several lines with the same - ;; summary. Solve with composite pattern? (while (and ;; REGEXP might match an empty string. Or line. (or (null matches) @@ -1473,12 +1472,12 @@ xref--collect-matches-1 (re-search-forward regexp line-end t)) (let* ((beg-column (- (match-beginning 0) line-beg)) (end-column (- (match-end 0) line-beg)) - (loc (xref-make-file-location file line beg-column)) - (summary (buffer-substring line-beg line-end))) + (loc (xref-make-file-location file line beg-column))) (add-face-text-property beg-column end-column 'xref-match t summary) - (push (xref-make-match summary loc (- end-column beg-column)) - matches))) + (unless matches + (push (xref-make-match summary loc (- end-column beg-column)) + matches)))) (nreverse matches))) (defun xref--find-file-buffer (file) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 02 20:35:30 2020 Received: (at 36967) by debbugs.gnu.org; 3 Dec 2020 01:35:31 +0000 Received: from localhost ([127.0.0.1]:37807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkdWs-00046Z-JZ for submit@debbugs.gnu.org; Wed, 02 Dec 2020 20:35:30 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:38528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkdWr-00046L-1K for 36967@debbugs.gnu.org; Wed, 02 Dec 2020 20:35:29 -0500 Received: by mail-wr1-f43.google.com with SMTP id p8so210984wrx.5 for <36967@debbugs.gnu.org>; Wed, 02 Dec 2020 17:35:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZGWUkX5pjwEUuzorbtLYK9KwsDiFFOD/cel7Fwmbz5U=; b=Gp9IJMhHDDXHmMECVGG4n5hNLjnNsKCwzHz0qsPkqRVQHtkXLF76fuh+Y6Ktv/PF0P W2CUstQG7uRpqbpzeVg6DhZHWJFamj5YiKdYR+F65OT9ODC0zM1JY5bsSaMGe6Sj6FaR 5EjTuFUoMCyXBJnv0ftJGy2M7K65/mTjxgoXR64vo3xglgVwFscCMVfXL2aKzlXlSkzU r1FJE+l9YLR8NAETFFsMqkzcqo5rb+F5SS1G63WLIt2WXtpdP58kLYupXw7sf0INrVG0 g7keR9bHhKhlew7orVQVj4Rjc6IkBQwL6DKpZ5eTj8rfqyqJ4IFcQzKPrJpjOAS1sfJd PleQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZGWUkX5pjwEUuzorbtLYK9KwsDiFFOD/cel7Fwmbz5U=; b=kZl7y4qu5zybCZ0NWXXNg1M1j1R0r3i15L3g/EC6MaTE2aWl8Qiekm8ckKIKov2i8b kBaB+rbVOZqYteekk/tvrF0ekFwoSkq9Y8Dlahxiljzsdp4tchEit24I6NV7p+glyStV EoyWF5BmbG2ak6/jT5C2RE0EWKMAlEQ97K/rHNu0amaQSV8g3XwimysL+J3hud1q/wDH iAnHQdEL8hdC3aVYoVTurcUAO/MLAE6BOYy3CvoVXAmL7w0l/r43KLYb99UDgVwYfPxi NV2A5ImTlMg38c7L7a7TC6Gag2SbSQdLXHZ4ELM5weELvCOzqbzmbK5QJ73MdT/APM6M N8lw== X-Gm-Message-State: AOAM530aTQaRLyzqt8VE2W6MuqQNmaXbjACCcD3tSyJCSliEAOV+VVec GJ+QgBB371Zi3+mn6/p/VEC5QtHPcyl5mQ== X-Google-Smtp-Source: ABdhPJxGd2I6yEUSpZr+bd9C3rdUginGldoWmlM8lxQWgalBvHmGkU46qc9+YcbWZzIhRQ+mBcvF2w== X-Received: by 2002:adf:f8d2:: with SMTP id f18mr816096wrq.379.1606959322638; Wed, 02 Dec 2020 17:35:22 -0800 (PST) Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id u26sm327252wmm.24.2020.12.02.17.35.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2020 17:35:21 -0800 (PST) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output To: Juri Linkov References: <87ef1wod82.fsf@mail.linkov.net> <950a9da4-4081-fe80-598f-eeb3931e24ad@yandex.ru> <87wnxz6glx.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: <20e61edd-9ee6-deab-7ff4-94b0ba527dc4@yandex.ru> Date: Thu, 3 Dec 2020 03:35:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87wnxz6glx.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 02.12.2020 23:30, Juri Linkov wrote: >>> I tried to use project-find-regexp more often than rgrep, >>> but unfortunately xref still has a fundamental flaw: >>> 0. emacs -Q >>> 1. M-x project-find-regexp RET regexp RET >>> 2. The output buffer *xref* contains duplicate lines >>> when regexp is found on the same line several times, >>> each duplicate output line has separate highlighting >>> for every regexp occurrence. >> >> I don't know how "fundamental" it is, but indeed, it's somewhat of >> a drawback. Suggestions for improving it (API change and/or implementation >> change) are welcome. > > Here is the patch that makes the broken Pretty harsh there. > project-find-regexp usable: Okay, impressions: When the line has two matches, the new code only collects the first match. So 'matches' is always an list with one element (or nil). Upside: repetitions are not shown anymore, but the match highlighting is still applied. 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. 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. As a bonus, 'n' and 'p' should then automatically change behavior to jump between locations when they are on the same line. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 03 16:39:15 2020 Received: (at 36967) by debbugs.gnu.org; 3 Dec 2020 21:39:15 +0000 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 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 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) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output Organization: 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> Date: Thu, 03 Dec 2020 23:30:05 +0200 In-Reply-To: <20e61edd-9ee6-deab-7ff4-94b0ba527dc4@yandex.ru> (Dmitry Gutov's message of "Thu, 3 Dec 2020 03:35:19 +0200") Message-ID: <87zh2u60iq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> 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? From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 03 18:44:58 2020 Received: (at 36967) by debbugs.gnu.org; 3 Dec 2020 23:44:58 +0000 Received: from localhost ([127.0.0.1]:42186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkyHS-0002BL-BH for submit@debbugs.gnu.org; Thu, 03 Dec 2020 18:44:58 -0500 Received: from mail-ej1-f42.google.com ([209.85.218.42]:46796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkyHQ-0002B8-Iw for 36967@debbugs.gnu.org; Thu, 03 Dec 2020 18:44:56 -0500 Received: by mail-ej1-f42.google.com with SMTP id bo9so6021150ejb.13 for <36967@debbugs.gnu.org>; Thu, 03 Dec 2020 15:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lbMa9XfEDW+zTrQVhaINAuw26tEmamdBsjAeyS9srAw=; b=VQn6I44xKq0lZ7NggkDGFw1QAAhbKN4/NGi2aXc/bBf+V1OSD8BhIOU0iz/XiVNVLa qP8JeFaGkiv4ueR/1AcR//cl634f7E7AYWjewN9sT03A/bZWx8iIIsUjr4h2TBgMxepd bi6dxpp+fsoX8P74OXA328i809L2zqVrlp//iFMgMHSbSG/J1xJLeWzI/2Sx3x36ksL4 Ijs1cN6+hHKaT1elvuhh9nUAPCyHVjWQBrhcAEWQD5wlZAVJYx9AQ7bFugkWYbzxeg+l DEaksWtRYdxZf+2pzXJU0hVOpgqa7NBYBYlqQGFWbcHjjJ6Ls7BnPvKr2V7sdeeHabEf Ehsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lbMa9XfEDW+zTrQVhaINAuw26tEmamdBsjAeyS9srAw=; b=gtqyLY1iB+M8WjbRB7bQ2u5eN29XvuFQEmRka684hdBvcncg3/4neAh1hptWEBWRa/ 0Q/11L9dtAxr3YQ2k7vv5p8enF4Sn2GmBBKBOg4Hv1BpO19HGy7cPvHOub87nbMcikXv 2MiPef/LbpVv0PMd8ox/ElvtXJPgZy5YWVB/bICdgd5igPWgkQyBoFXgr1ZBcRxSprvD Ft307aja+lO3Jg0LljEU14QaI87ccOoxuzhQT0yHyJ/lWIwFTmlPW6zoUeouqLAmO7e6 E8I2hHyQK2PYFdBT9HDsERZNGMrTvTwQNTnoLyg3fz71ztiMyvg6mbhIN0r0+2sf4upB 8VwQ== X-Gm-Message-State: AOAM533DSaUjdUjc7bHgo25+dG3FsbQftPlRVjtUYEkEWXKC5zZxI/NE EcE1ey93LM0yeax/Sx+pTlLDYpJOntVXNA== X-Google-Smtp-Source: ABdhPJy4Zjp/EbPtTtZz4VKADgPI+dS6Xorhzft6/yX81eK3AVQlcddDimRSn742XqkpTUfQPFE9RQ== X-Received: by 2002:a17:907:2122:: with SMTP id qo2mr2602055ejb.539.1607039090433; Thu, 03 Dec 2020 15:44:50 -0800 (PST) Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id dd18sm1851349ejb.53.2020.12.03.15.44.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2020 15:44:49 -0800 (PST) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output To: Juri Linkov 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> <87zh2u60iq.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> Date: Fri, 4 Dec 2020 01:44:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87zh2u60iq.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 03.12.2020 23:30, Juri Linkov wrote: >>> 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. It's great to see you get this ball rolling. >> 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? Not really, no. project.el pulls in seq already, why not have xref do it too. 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). From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 06 16:16:11 2020 Received: (at 36967) by debbugs.gnu.org; 6 Dec 2020 21:16:11 +0000 Received: from localhost ([127.0.0.1]:51494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km1O7-00035O-C3 for submit@debbugs.gnu.org; Sun, 06 Dec 2020 16:16:11 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:36339) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km1O4-00034d-3z for 36967@debbugs.gnu.org; Sun, 06 Dec 2020 16:16:10 -0500 X-Originating-IP: 91.129.99.98 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 73E501C0004; Sun, 6 Dec 2020 21:15:59 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output Organization: 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> <87zh2u60iq.fsf@mail.linkov.net> <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> Date: Sun, 06 Dec 2020 22:31:02 +0200 In-Reply-To: <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> (Dmitry Gutov's message of "Fri, 4 Dec 2020 01:44:47 +0200") Message-ID: <87v9deais9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain > 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=multiline-xref-insert-xrefs.patch 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) --=-=-= Content-Type: text/plain 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 08 22:54:07 2020 Received: (at 36967) by debbugs.gnu.org; 9 Dec 2020 03:54:08 +0000 Received: from localhost ([127.0.0.1]:60698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmqYJ-0002z1-Ki for submit@debbugs.gnu.org; Tue, 08 Dec 2020 22:54:07 -0500 Received: from mail-ej1-f43.google.com ([209.85.218.43]:44008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmqYG-0002yV-HN for 36967@debbugs.gnu.org; Tue, 08 Dec 2020 22:54:06 -0500 Received: by mail-ej1-f43.google.com with SMTP id jx16so53362ejb.10 for <36967@debbugs.gnu.org>; Tue, 08 Dec 2020 19:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KNShJtymUr5bOckHYK0ATLVJW2lrSG7KpLXjM57ev88=; b=cIYXxmfCHph31sVpV8Is9MraIlGGNP5u8rIOPO61VLSgruypm/YwFGazpI96mb4usw Zne1hbQpaasXUAJUVV6J6A5QP6Aks/Y4hNyzZkUD1wxu0lE/B5XJjPmZqVpa99lRfRR2 3psITPzIzdSIaKpAeH5L+MKZaFloIc1acIPjtIQaz52w1FsPD5WhEEfXesQK02qgJaoV iH38fbv4GnjIlcM7pwMFWJ+cCEzqCKUXTi5MSQ24UHl8RDzdi3hO80MIK30wYUf0NnJ+ xa0l5Lt7ppKg7SSHtTlbR1QeklvbGpNebtcbRB1GkfJaIP4rNxD3I5zH2h28W52bmuIj OWVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KNShJtymUr5bOckHYK0ATLVJW2lrSG7KpLXjM57ev88=; b=b9lmBWgFrmhCqJytEjE7NBlFs3TEg59mKdwBBVVZvBARw+Nd8twsBYP936cPXksLkM 0A7DcaBdFNVGD9gSwoExLvN4QDjgsU3IDY/A8qG+P4IdBFyyyKt1qwXI1eyuKjw3pKut b+1A1/3+gxUS+Lhd1LXdv6MpayEVmdcZPghcY6A/mMmIHDQOYPw4b4/xhJ0BXjU7yQQY w/iQmMT4CDMNFMrkSogeGsFd1clGklwFT51PL1l4Rc+hfoaCFFd2Ol4ukPsGdtXeC+aN ln2Id6Uc2+lBmaAy9uAr+0PndyqCPahQ1qmOFeaTOCvlC42QZiMF1LSbySVQOyBRzrAN X8rg== X-Gm-Message-State: AOAM532YJ7ja1hqAIzjvdoX5MU7XCGOX89+b/hE2ZIotO/kYEh2nr9T6 QF4o2oBkVgq0rYUspxI9ni5q2hmoAXp3Ww== X-Google-Smtp-Source: ABdhPJzp5N1lgh+gcKPjtaQAzlFS85hbLT/GpfAt/6Iv57nYpQuGFE1Caa5ALolDpfkPqmiXY6PtBQ== X-Received: by 2002:a17:906:d101:: with SMTP id b1mr460483ejz.80.1607486038334; Tue, 08 Dec 2020 19:53:58 -0800 (PST) Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id e3sm185404ejq.96.2020.12.08.19.53.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Dec 2020 19:53:57 -0800 (PST) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output To: Juri Linkov 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> <87zh2u60iq.fsf@mail.linkov.net> <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> <87v9deais9.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: <1c75343f-9215-624b-c314-90a01714478a@yandex.ru> Date: Wed, 9 Dec 2020 05:53:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87v9deais9.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) 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. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 09 08:57:20 2020 Received: (at 36967) by debbugs.gnu.org; 9 Dec 2020 13:57:20 +0000 Received: from localhost ([127.0.0.1]:33105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmzy4-0001Lp-Jr for submit@debbugs.gnu.org; Wed, 09 Dec 2020 08:57:20 -0500 Received: from mail-ej1-f43.google.com ([209.85.218.43]:34157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmzy2-0001Lb-KC for 36967@debbugs.gnu.org; Wed, 09 Dec 2020 08:57:18 -0500 Received: by mail-ej1-f43.google.com with SMTP id g20so2267043ejb.1 for <36967@debbugs.gnu.org>; Wed, 09 Dec 2020 05:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=atfduHwA7UeEBkbBuEuuIBJWoAZsTGpgsz0e8i09SuQ=; b=fUDVqwjaUUYwLRikdEpjqhPSLQw5BUK6sWjDmT9UNr9p6VHI3z4WluAlU+UeHfMk1E rBMxd5Bzw0+awizP6376Zn/+34QATE7HZDpp9l9KxN5YpblwMZDRZCYGItnPj/VshA46 oLCkxPjLOzuTpSckHsKpRVP/CfP5aAiaIhRYncq/ndYnJbgRYzdP7gb7FN+cGdYtJLEt OB8gr8HeFqVz2GlmwFSIpWkcqu6BYVWeDE57kffF3GB71wKM/3B5+xb6tU/DoP+b6WG9 KV1uvpmDXdA2OEsE9dJf4m470OKbMeX3XpYSGsRc6dKnKPvhNavhUvBg1bpXU5weyy9s 2rsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=atfduHwA7UeEBkbBuEuuIBJWoAZsTGpgsz0e8i09SuQ=; b=FBsa7jkPZvM7i4Y9EDuUwUyjYIVIWWEPHRUsR2RL/hc68ZSZq1SwlluAszPYaBMlCi fjOJnTUah3xSw5CBUDWWQwu2wkBE/5RxHt7DakXpRrC5b1VirkPCAB2LPF72TDM/ZiUT ZlyINFpXEWmySs0cf9ZJR2pk/oVq3Y+zumXKl5Uuxt458t1sN7E7Tit11ugaDvS+npCk CG5IKBpBoVm0IE6BTVpYEa3Rm1RS3vMXjij48nSHFX2hzVYRgz9WVYmi5f4tv1Ujpgdr F5tyiazv+9P3rPqBHIljTORjAiFOAlMBDgsq5xx2Vae/sXb6y7iR7QVzt/aISs+RJ3Gj eNeA== X-Gm-Message-State: AOAM532Nr6+JeK+CTi6zfCxyZ1B1ByE6PzTEeRlbx8tjUqmO7P2aiokb 5TM+uvF1RqkYiO3zzqjsxKcGIzMmqA8uzw== X-Google-Smtp-Source: ABdhPJy3/K3XpKLU3RuW3N2TJX6ANp+W+NMZWWwzd6YdEdZxNZAFMk1NoZNyAYow/VaTxGCuefKPZA== X-Received: by 2002:a17:906:a182:: with SMTP id s2mr2069564ejy.249.1607522232371; Wed, 09 Dec 2020 05:57:12 -0800 (PST) Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id bo20sm1758804edb.1.2020.12.09.05.57.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Dec 2020 05:57:11 -0800 (PST) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output From: Dmitry Gutov To: Juri Linkov 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> <87zh2u60iq.fsf@mail.linkov.net> <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> <87v9deais9.fsf@mail.linkov.net> <1c75343f-9215-624b-c314-90a01714478a@yandex.ru> Message-ID: <80f916f1-506f-379d-1719-83ce89efac2a@yandex.ru> Date: Wed, 9 Dec 2020 15:57:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1c75343f-9215-624b-c314-90a01714478a@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36967 Cc: 36967@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 09.12.2020 05:53, Dmitry Gutov wrote: > 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: Although we'll probably make it an optional method, just like xref-location-line is already. Then we won't have to do all that gymnastics with the temp buffer. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 20:42:53 2020 Received: (at 36967-done) by debbugs.gnu.org; 21 Dec 2020 01:42:53 +0000 Received: from localhost ([127.0.0.1]:45857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krADs-0002rt-S1 for submit@debbugs.gnu.org; Sun, 20 Dec 2020 20:42:53 -0500 Received: from mail-ed1-f44.google.com ([209.85.208.44]:42571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krADp-0002rf-OH for 36967-done@debbugs.gnu.org; Sun, 20 Dec 2020 20:42:51 -0500 Received: by mail-ed1-f44.google.com with SMTP id g24so8087995edw.9 for <36967-done@debbugs.gnu.org>; Sun, 20 Dec 2020 17:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Bwxv+C8Co7PIzd9j8i6AMtMP+moGGGUl03Mrhw4JjxM=; b=AvDtgk5pv79N9kKHzx7MCaqsDKzMKn02jtNISeuAVI77adfazw4ahC7x+pN8lJ9jkx W66cKK2HFADI7OqRRYJu4V6h6p5linwcUm1vzBh7+pzDnbgAO+Cr8CHH/j9BvoKslhQw 6venDXKDIF2dxNB6K7hd5UZUXS/Tt/HrO17T63lgMaqkP732DSh7KgKMhQnV4hnROzLb h8WztTRIbvUwQkBLNR3+wI5ldxe/iUGZkaBa9cfiuStxcvllvG6LODVTyX/pxMHPQ3yM nXSbzlfLqW6gjlpjLVpCSBVuRHfcm8hyM2c39+ubuPl9mCq1Y2xojKrIOMWZPS/ubHre wyOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Bwxv+C8Co7PIzd9j8i6AMtMP+moGGGUl03Mrhw4JjxM=; b=N5ScDv+57UKNt6bx/+9KGlfoB9s7kmu+UA2t0sw/rFErR3EfU9mKUUg5bQOiUxhy3G 4VC6TSYfw/ClRlMp1V4wsWb6A0dcdNieBMBN0wXh6fHLBvhmkvwRJK7reCr4rxkZs7Ye W1CCEVj8A0LPvFf1Vc8yGWRZM8GDiIzs3n9JsW4wlZfz0ShIYiDVGIJVReku3fnaRBBP NVyTNhrLor6TCFRgLWYi2Wn5VeJ9CCnysRtvvdTueit++03pbs/gCiKE4BKQ671JFRK/ Ju9OJVZ8jq1cbRTMRaC+EIXvG1CpJpN69x//tCR9/+Hu9yQhwY6hRvyIP36vgrWpkTdL BwZw== X-Gm-Message-State: AOAM530S8yrbmmn4IOeUoziZcAI1JnaJi0VBNl27HzX47EOy9sBkMc2v QI+WVT8kHf5CDgwfHcYYAzE= X-Google-Smtp-Source: ABdhPJzpztyEIwaSsX+OxibA04xRGWnSBFJObR0Kyp9Ps4fEGJti3vapfJyQnc/p5A24TvgWtQwA4A== X-Received: by 2002:a50:e0ce:: with SMTP id j14mr14283404edl.18.1608514963896; Sun, 20 Dec 2020 17:42:43 -0800 (PST) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id mc25sm8200363ejb.58.2020.12.20.17.42.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Dec 2020 17:42:42 -0800 (PST) Subject: Re: bug#36967: 27.0.50; Duplicate lines in xref output From: Dmitry Gutov To: Juri Linkov 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> <87zh2u60iq.fsf@mail.linkov.net> <14427ed0-a177-0524-c469-406fe6248197@yandex.ru> <87v9deais9.fsf@mail.linkov.net> <1c75343f-9215-624b-c314-90a01714478a@yandex.ru> <80f916f1-506f-379d-1719-83ce89efac2a@yandex.ru> Message-ID: <53aad279-912c-9b47-e5c3-d4373b1556a2@yandex.ru> Date: Mon, 21 Dec 2020 03:42:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <80f916f1-506f-379d-1719-83ce89efac2a@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 36967-done Cc: Pankaj Jangid , 36967-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) Version: 28.1 On 09.12.2020 15:57, Dmitry Gutov wrote: > On 09.12.2020 05:53, Dmitry Gutov wrote: >> 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: > > Although we'll probably make it an optional method, just like > xref-location-line is already. And now done. I've pushed the slightly tweaked Juri's patch and the change described above. With that, the bug should be fixed now. Please let me know if something is still amiss. Thanks all! From unknown Fri Jun 20 19:55:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 18 Jan 2021 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator