From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#59575: 29.0.50; add-log-current-defun-header-regexp matches Windows drive letter Date: Sun, 27 Nov 2022 09:29:56 +0100 Message-ID: References: <83zgcdsw90.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000090129405ee6f91aa" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37290"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 59575@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 27 09:31:38 2022 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 1ozD4b-0009Wy-AX for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Nov 2022 09:31:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozD4K-0004If-43; Sun, 27 Nov 2022 03:31:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozD43-0004HX-QP for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 03:31:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozD42-00029r-1K for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 03:31:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozD41-00081c-O6 for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 03:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2022 08:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59575 X-GNU-PR-Package: emacs Original-Received: via spool by 59575-submit@debbugs.gnu.org id=B59575.166953784430842 (code B ref 59575); Sun, 27 Nov 2022 08:31:01 +0000 Original-Received: (at 59575) by debbugs.gnu.org; 27 Nov 2022 08:30:44 +0000 Original-Received: from localhost ([127.0.0.1]:42058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozD3j-00081O-OI for submit@debbugs.gnu.org; Sun, 27 Nov 2022 03:30:44 -0500 Original-Received: from mail-ej1-f51.google.com ([209.85.218.51]:41764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozD3g-00081H-ED for 59575@debbugs.gnu.org; Sun, 27 Nov 2022 03:30:42 -0500 Original-Received: by mail-ej1-f51.google.com with SMTP id vp12so17776001ejc.8 for <59575@debbugs.gnu.org>; Sun, 27 Nov 2022 00:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=91KO4eZsJm81w0O/fbkW6L8bco8Rv8yMnn2UK8oXZB0=; b=Ypf1olc745SvyGNAP5Bx1XJzKXrESiC1IykuVaye+ATCLvLcceecCuLedACH1fYJnB ufm2j0KxBxJrNumQV1vPGGzkNjlECEFPBc4dq2mGDjhosLvDQP+RG9K4mSc5/4Q1635p 1Na83oKrZ/zpbz3fW8f5PIc0PS/1OF780P2ezFh6qynj0WNKznQK0UWWsnw6OiqmZpQY aHErP+kLJ8kogP/NZYfTFGG4B8GkvVzS2KGEesabAHyN/3ZWcJjbU0WWlj73SH9SFbtN mGJwqmyCL5Stc8zmom0B6jMKzbx+QJhohjEgtXVs2oGGQ8nc3VEKlwBh92e3wl75v1Dv SY1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=91KO4eZsJm81w0O/fbkW6L8bco8Rv8yMnn2UK8oXZB0=; b=CE4rcywwaOmCWUnKaTuEtd3CYkr5VQvk+DMHi9iWwmlPOTNEUEe0liTGZF8SrsPcuB T2sYdq/4sOOSGaLE7QPwS8btyYIQICkVb8jJx2NnOLha2nxrTehoU+pAQgq+aI6mPg9v e5XfOsdfWF9VmnSMX1HihhPGMDPINgkTLl6dRPyERSgGaKPxr18+SzVOGNRkELcSgkdY F41WeGPdUnxWKByPI6g48jvnMukEbrG/t6Rla+q1uR99p6XJKijLoDCt6B3RQZF2CF9i A4Yon8klHTeGd2RWOrjQYLN6B8VerTY6PLS5jaKcjcFRvzn8WwDA70CRNMltGOu5dm/k ensg== X-Gm-Message-State: ANoB5plhqqsrWF7ZamHApnLFhbLlFIAP1Lu49SV7G1jWp5Ig3zQrgdnK AdnqHaDJ4HXuBpPRrNKPrbZh2T/HjD/L0YIBnig= X-Google-Smtp-Source: AA0mqf7tZQxmR4tc8XfAHaxxrzhkMf1PJCqEVZSpuPXcoaCBaeQ5hqAIdO1WAKgnKI5gwvHypSr+FXShOExXEQBc5eQ= X-Received: by 2002:a17:906:a991:b0:7ba:85a7:2ec3 with SMTP id jr17-20020a170906a99100b007ba85a72ec3mr16104974ejb.36.1669537834470; Sun, 27 Nov 2022 00:30:34 -0800 (PST) In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249189 Archived-At: --00000000000090129405ee6f91aa Content-Type: text/plain; charset="UTF-8" On Sun, Nov 27, 2022 at 2:54 AM Dmitry Gutov wrote: > It seems like > > (setq add-log-current-defun-function nil) > > should suffice. That does not stop add-log-current-defun for working, in absence of an a-l-c-d-function it just uses the regexp, which is what is returning the spurious name. Either adding a custom add-log-current-defun-function, or setting add-log-current-defun-header-regexp to a buffer-local value so it recognizes filenames would work. (Buffer-locally, because the variable is in fact customizable so we can't be sure what its global value will be.) This works, for example: (defun xref--add-log-current-defun () (if-let (item (xref--item-at-point)) (xref-file-location-file (xref-match-item-location item)) (xref--imenu-extract-index-name))) (setq-local add-log-current-defun-function #'xref--add-log-current-defun) > Is that the intended behavior, to report the absence of the current defun? The final intended behavior, IIUC, is that the filenames in the xref--xref-buffer-mode get passed to which-function as "defun" names. --00000000000090129405ee6f91aa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Sun, Nov 27, 2022 at 2:54 AM Dmitry Gut= ov <dgutov@yandex.= ru> wrote:
> It seems= like
>
> =C2=A0 =C2=A0(setq add-log-current-defun-function nil)
>= =C2=A0
> should suffice.

That does not stop add-log-current-defun for wo= rking, in absence of an a-l-c-d-function it just uses the regexp, which is = what is returning the spurious name.

Either adding a custom add-log-current-defun-function, or setting= add-log-current-defun-header-regexp to a buffer-local value so it recognizes filenames would work. (Buffer-locally, because the variable is in f= act customizable so we can't be sure what its global value will be.)

This works, for example:


(defun xref--add-log-current-defun ()
= =C2=A0 (if-let (item (xref--item-at-point))
=C2=A0 =C2=A0 =C2=A0 (xref-f= ile-location-file (xref-match-item-location item))
=C2=A0 =C2=A0 (xref--= imenu-extract-index-name)))

(setq-local add-log-current-defun-functi= on #'xref--add-log-current-defun)

> Is that the inten= ded behavior, to report the absence of the current defun?

The final i= ntended behavior, IIUC, is that the filenames in the xref--xref-buffer-mode= get passed to which-function as "defun" names.

--00000000000090129405ee6f91aa--