From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#32510: acknowledged by developer (control message for bug #32510) Date: Tue, 30 Jul 2019 03:06:18 +0300 Message-ID: <77c6d179-4499-4a99-db58-b0c7c2cee2f5@yandex.ru> References: <87ftnazlz3.fsf@mouse.gnus.org> <87o91xwwxp.fsf@samuel> <83k1clyywc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="81731"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Cc: 32510@debbugs.gnu.org To: Eli Zaretskii , Ludovic Brenta Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 30 02:07:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hsFfZ-000L2O-9J for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Jul 2019 02:07:09 +0200 Original-Received: from localhost ([::1]:57098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsFfY-0002qj-Bo for geb-bug-gnu-emacs@m.gmane.org; Mon, 29 Jul 2019 20:07:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55300) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsFfT-0002qR-TZ for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 20:07:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsFfS-0006UC-Nx for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 20:07:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsFfS-0006U4-Km for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 20:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hsFfS-0000Vl-Em for bug-gnu-emacs@gnu.org; Mon, 29 Jul 2019 20:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Jul 2019 00:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32510 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 32510-submit@debbugs.gnu.org id=B32510.15644451911928 (code B ref 32510); Tue, 30 Jul 2019 00:07:02 +0000 Original-Received: (at 32510) by debbugs.gnu.org; 30 Jul 2019 00:06:31 +0000 Original-Received: from localhost ([127.0.0.1]:49342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsFew-0000V2-HG for submit@debbugs.gnu.org; Mon, 29 Jul 2019 20:06:30 -0400 Original-Received: from mail-wr1-f42.google.com ([209.85.221.42]:45815) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsFeu-0000Uo-5L for 32510@debbugs.gnu.org; Mon, 29 Jul 2019 20:06:28 -0400 Original-Received: by mail-wr1-f42.google.com with SMTP id f9so63685146wre.12 for <32510@debbugs.gnu.org>; Mon, 29 Jul 2019 17:06:28 -0700 (PDT) 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=PC/CJxN0t2ELBqaJkWqtam0wsQG2yLB2HEl5IGDId58=; b=GfdyY+4904U5WqrdgdGjGOuIeI5eWhINWbwbAYgfEXMuF1cJF5Lq8nD7RC3baSaWr2 gdrzW5b0/B4ydlGUt0UmKYA1ADHOl+KwCk80vPuIrpzxCc6MDcbVbEpNOyrWkBbGcE58 +Q6aul9dbGyraOvlK5rlqTblrk6JExTn7GYDmtZeScUIq3NnbFkvTFQqGLeIGIhjU7Rc lXsKWk63YpFZN1nPEq1sPbTj8KIwG/LPUFEK4hHXtRWydaYOAiCn2y7jjdnwb5EtGVl4 ru6A6aF8BodO4xSJkywWIWI9eii4OwDZc+v9rc4gS0LyGpp9ZWwUkaTqdPgqdGnD3g7N tC7A== 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=PC/CJxN0t2ELBqaJkWqtam0wsQG2yLB2HEl5IGDId58=; b=W0XoI/5As3rvRIOygF+HabCGIlZqVwXFfV7/SMwokjekzptznvV7BvbgSdk5fw+Tnp zLUoT2wKR/t7rZGBKEOa12FlF3jaWKjx5P2F0B2V+Oop9HMkh8phvDaoxYo9bwOO8oGA vRwiPYIDquZVZp50jMvW2Bd2qR3JqEXVMu0Xdp1ekRmt1tFqoUQfTVc98SfoIBYcXYAh 95DPaVZXg3ehFC13nad8cHxVmn+lmQr940SZ0EKKSI6k/AEPJdtqLEDGMv5M4lFbKW1x ugW9qxngunOYwaz8cEQMQzax18Upyflenw3hSySEvtIfURql1ayCtL+fPzgiypJ/J84J wsgQ== X-Gm-Message-State: APjAAAVO5cPP7fbg2il8NZc4S5EXUXq5lCrG5JcBnKhUQKWIGJujeIuj nuwqhh2oElonyQjP1ObQ8SQYEK5vLMU= X-Google-Smtp-Source: APXvYqy7ZO6IRaVFVUg8fYOujEay+/R+3YK7MXA3Wpi+hi3UyaSgiqf+Ccg03CXHMed+rY3ZMv796g== X-Received: by 2002:adf:e541:: with SMTP id z1mr31970574wrm.48.1564445182133; Mon, 29 Jul 2019 17:06:22 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.174.23]) by smtp.googlemail.com with ESMTPSA id v65sm69451178wme.31.2019.07.29.17.06.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jul 2019 17:06:21 -0700 (PDT) In-Reply-To: <83k1clyywc.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164083 Archived-At: On 14.07.2019 8:21, Eli Zaretskii wrote: >> From: Ludovic Brenta >> Date: Sat, 13 Jul 2019 21:34:26 +0200 >> >> This bug report states that a useful functionality of find-tag is *not* >> provided by its official replacement, xref-find-definitions. This is a >> regression. Just because you think this missing functionality should be >> provided elsewhere is not a good reason to close this bug without >> providing any solution. > > With the patch below, you should be able to have what you want if you > add tag-partial-file-name-match-p to the list in Finally got around to reviewing it... > diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el > index 7bf5753..b092c63 100644 > --- a/lisp/progmodes/etags.el > +++ b/lisp/progmodes/etags.el > @@ -2070,13 +2070,16 @@ etags--xref-find-definitions > (beginning-of-line) > (pcase-let* ((tag-info (etags-snarf-tag)) > (`(,hint ,line . _) tag-info)) > - (unless (eq hint t) ; hint==t if we are in a filename line > + (unless (and (eq hint t) ; we are in a filename line > + (not (eq order-fun > + 'tag-partial-file-name-match-p))) First, I was thinking we shouldn't check for the exact order-fun value (because others could be used, too) and replace it with something like (save-excursion (forward-line 0) (forward-char -2) (not (looking-at "\f\n"))) But then, I'm not sure why that check is there in the first place (the order functions make sure not to match the wrong like). Maybe because the code inside couldn't handle hint=t? So if it does now, the (unless ...) conditional can be removed. > (let* ((file (file-of-tag)) > (mark-key (cons file line))) > (unless (gethash mark-key marks) > (let ((loc (xref-make-etags-location > tag-info (expand-file-name file)))) > - (push (xref-make hint loc) xrefs) > + (push (xref-make (if (eq hint t) pattern hint) loc) > + xrefs) I'm not sure using pattern as a hint works well. How about we say something like "(file name match)" instead? Or you could pick a better wording. The full proposed patch is below. I see that it doesn't work exactly perfectly, e.g. moving point within the quotes in #include "composite.h" and pressing M-. brings up three matches (composite.c, composite.h and composite.el), whereas only one of them is correct, but find-tag probably has the same problem anyway. Maybe CC Mode should set up find-tag-default-function to return the full file name when inside #include statements. diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 7bf575340e..a052ad2ce5 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2070,14 +2070,15 @@ etags--xref-find-definitions (beginning-of-line) (pcase-let* ((tag-info (etags-snarf-tag)) (`(,hint ,line . _) tag-info)) - (unless (eq hint t) ; hint==t if we are in a filename line - (let* ((file (file-of-tag)) - (mark-key (cons file line))) - (unless (gethash mark-key marks) - (let ((loc (xref-make-etags-location - tag-info (expand-file-name file)))) - (push (xref-make hint loc) xrefs) - (puthash mark-key t marks))))))))))) + (let* ((file (file-of-tag)) + (mark-key (cons file line))) + (unless (gethash mark-key marks) + (let ((loc (xref-make-etags-location + tag-info (expand-file-name file)))) + (push (xref-make (if (eq hint t) "(filename match)" hint) + loc) + xrefs) + (puthash mark-key t marks)))))))))) (nreverse xrefs))) (defclass xref-etags-location (xref-location)