From unknown Wed Jun 18 00:29:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Mar 2024 15:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 70008@debbugs.gnu.org Cc: Dmitry Gutov X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171146825411357 (code B ref -1); Tue, 26 Mar 2024 15:51:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Mar 2024 15:50:54 +0000 Received: from localhost ([127.0.0.1]:34570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp94g-0002x1-Ca for submit@debbugs.gnu.org; Tue, 26 Mar 2024 11:50:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp94c-0002wI-T0 for submit@debbugs.gnu.org; Tue, 26 Mar 2024 11:50:52 -0400 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 1rp6BQ-0000GR-UZ for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 08:45:40 -0400 Received: from mxout2.mail.janestreet.com ([38.105.200.79]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rp6BO-0002nE-II for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 08:45:40 -0400 From: Spencer Baugh Date: Tue, 26 Mar 2024 08:45:36 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1711457137; bh=E1sgGTyBU0k9ydPKDCHri45OTcjvWeEQegYBZ3Ipjy8=; h=From:To:Cc:Subject:Date; b=mNNR5b001TzRyERuktNoGH1amwmCNkqracjYzlzaVJkpDxJLwliG/t6Cn4Pz3Lqn8 9YxNnyB5rA4f7IgtADo2UAlHCIpchrp9rAQBya9/mVkUqXecu7bcI4ZosHMxyEgEQB WA+CTrn4qwqbLoYhAlzQFWZ6NXKbRlyts6SFOCBwox+YfOBUnTXRUkZrQK+VofAsSM hNyOnPC1SvrhnNy3rZ/HFwnUx9b2Bb7EdyXIdJoLwQws9XXk0lJnvzxH/CCs4noMVT 1Jd503JQetkq58rwundPB4g+FcLKJPC1zdNSrbtdlPmAS82L/Tm6ZxbXuNG1/18o8q CVArZFJ6ML/Kg== Received-SPF: pass client-ip=38.105.200.79; envelope-from=sbaugh@janestreet.com; helo=mxout2.mail.janestreet.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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.1 (/) --=-=-= Content-Type: text/plain Tags: patch This fixes what appears to just be an oversight, although maybe I am missing some subtle reason it's correct to check current-buffer here. In GNU Emacs 29.2.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-02-28 built on igm-qws-u22796a Repository revision: 46e23709d37943a20faa735c97af520196a443e9 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.9 (Green Obsidian) Configured using: 'configure 'CFLAGS=-O0 -g3' --with-gif=ifavailable --with-x-toolkit=lucid' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Correctly-check-buffer-mtime-when-displaying-xref-ma.patch >From 718f2dc2c23660bc002b852bb36f2ece292ed524 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Tue, 26 Mar 2024 08:44:25 -0400 Subject: [PATCH] Correctly check buffer mtime when displaying xref matches This was just a typo: we were checking the modification time of current-buffer instead of checking the modification time of the passed-in buffer. This caused matches to not be shown if they weren't present in the current in-Emacs state of the buffer. This was easily reproduced by writing a string to a file outside Emacs, then searching for that string with e.g. project-find-regexp. The string would seemingly not be found, although in reality it was found, just not displayed. * lisp/progmodes/xref.el (xref--find-file-buffer): Check buf, not current-buffer. --- lisp/progmodes/xref.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 717b837a2e5..755c3db04fd 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -2176,7 +2176,7 @@ xref--find-file-buffer (or (buffer-modified-p buf) (unless xref--hits-remote-id - (not (verify-visited-file-modtime (current-buffer)))))) + (not (verify-visited-file-modtime buf))))) ;; We can't use buffers whose contents diverge from disk (bug#54025). (setq buf nil)) (setq xref--last-file-buffer (cons file buf)))) -- 2.39.3 --=-=-=-- From unknown Wed Jun 18 00:29:31 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Spencer Baugh Subject: bug#70008: closed (Re: bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches) Message-ID: References: X-Gnu-PR-Message: they-closed 70008 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 70008@debbugs.gnu.org Date: Thu, 28 Mar 2024 03:26:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1711596363-27181-1" This is a multi-part message in MIME format... ------------=_1711596363-27181-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #70008: [PATCH] Correctly check buffer mtime when displaying xref matches which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 70008@debbugs.gnu.org. --=20 70008: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70008 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1711596363-27181-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 70008-done) by debbugs.gnu.org; 28 Mar 2024 03:25:58 +0000 Received: from localhost ([127.0.0.1]:38648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpgOr-00073a-NZ for submit@debbugs.gnu.org; Wed, 27 Mar 2024 23:25:57 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpgOm-00072e-GN for 70008-done@debbugs.gnu.org; Wed, 27 Mar 2024 23:25:56 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 813C25C0082; Wed, 27 Mar 2024 23:25:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 27 Mar 2024 23:25:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1711596345; x=1711682745; bh=Gw+DERxkTeOtS1/4fUFBCY4px52ge4JMiNh9JjjCJYE=; b= Rp9WUsrel2uY/n2/5yLmXQO0+N0vVUELEx3NzpvqSoaNk4w8jrImdp5D2ppWQ+fF pAekRp1JruLCKUpvhIafCljPbnIAYxcDoO4CnrgoKGeNnpT1Lw3+52omhUJnNocp J9TKjq5iWFZ+g02vyMjAgXiJjFX/VAWNVTyFtWv1MUZGrzh9PX5Y9Q48UEyAr4i2 R6Do66IxLl4gHDo6omSRT7lTB0JWWS8ef+D99Gj5bfSA5S1HQViYRq0QUhtwHoRj LUZXfZDBs8eAIGNTvmBur7FgXuMOgyd0OVMS0qfaU+xYEgvSuI/fJDTTPxhV1pg7 Ox8A6XIrSskj/rFw129LJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711596345; x= 1711682745; bh=Gw+DERxkTeOtS1/4fUFBCY4px52ge4JMiNh9JjjCJYE=; b=V G9LJ8MmIa463RSavit318H3neqxumSBFN/Gc0wDhGkxIl/3mbs3cOCDw2ZipMoQG 5NkGYBJWs6pdFxmGD7MHTygJ81tWMy9D6muVPywnUIIubRhCatfZ/Dmt2vaQ2NoV UF5MlkhCsioa5HBDTpdIcT+r4J+0ERnfX6q3ZIUem7Z+ytYJiCv0HrM6Szbwzb3I UaG9L908chOCLaROJtvjImssKdYi8ZSW6opgTHJ0lJXhyqHdxIvXBr+j7uQCxSLn 2N0KRZoog7KKZjJ8vW9Y5UH2BuK0RizO5X7CMRmgHLwCGcpOERh4+31cPD3J8vIW 73uPtATrFqWww5KaXLtTw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddukedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpedthfeuvddtveelgeeuleevvdejveehffevveehvdeuffdtfefhvdeugefgtefg tdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 27 Mar 2024 23:25:44 -0400 (EDT) Message-ID: Date: Thu, 28 Mar 2024 05:25:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches Content-Language: en-US To: Spencer Baugh , 70008-done@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 70008-done 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 (-) On 26/03/2024 14:45, Spencer Baugh wrote: > This fixes what appears to just be an oversight, although maybe I am > missing some subtle reason it's correct to check current-buffer here. Yep, looks like an oversight. Thanks, Spencer! ------------=_1711596363-27181-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Mar 2024 15:50:54 +0000 Received: from localhost ([127.0.0.1]:34570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp94g-0002x1-Ca for submit@debbugs.gnu.org; Tue, 26 Mar 2024 11:50:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rp94c-0002wI-T0 for submit@debbugs.gnu.org; Tue, 26 Mar 2024 11:50:52 -0400 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 1rp6BQ-0000GR-UZ for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 08:45:40 -0400 Received: from mxout2.mail.janestreet.com ([38.105.200.79]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rp6BO-0002nE-II for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 08:45:40 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: [PATCH] Correctly check buffer mtime when displaying xref matches Date: Tue, 26 Mar 2024 08:45:36 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1711457137; bh=E1sgGTyBU0k9ydPKDCHri45OTcjvWeEQegYBZ3Ipjy8=; h=From:To:Cc:Subject:Date; b=mNNR5b001TzRyERuktNoGH1amwmCNkqracjYzlzaVJkpDxJLwliG/t6Cn4Pz3Lqn8 9YxNnyB5rA4f7IgtADo2UAlHCIpchrp9rAQBya9/mVkUqXecu7bcI4ZosHMxyEgEQB WA+CTrn4qwqbLoYhAlzQFWZ6NXKbRlyts6SFOCBwox+YfOBUnTXRUkZrQK+VofAsSM hNyOnPC1SvrhnNy3rZ/HFwnUx9b2Bb7EdyXIdJoLwQws9XXk0lJnvzxH/CCs4noMVT 1Jd503JQetkq58rwundPB4g+FcLKJPC1zdNSrbtdlPmAS82L/Tm6ZxbXuNG1/18o8q CVArZFJ6ML/Kg== Received-SPF: pass client-ip=38.105.200.79; envelope-from=sbaugh@janestreet.com; helo=mxout2.mail.janestreet.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit Cc: Dmitry Gutov 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.1 (/) --=-=-= Content-Type: text/plain Tags: patch This fixes what appears to just be an oversight, although maybe I am missing some subtle reason it's correct to check current-buffer here. In GNU Emacs 29.2.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-02-28 built on igm-qws-u22796a Repository revision: 46e23709d37943a20faa735c97af520196a443e9 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.9 (Green Obsidian) Configured using: 'configure 'CFLAGS=-O0 -g3' --with-gif=ifavailable --with-x-toolkit=lucid' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Correctly-check-buffer-mtime-when-displaying-xref-ma.patch >From 718f2dc2c23660bc002b852bb36f2ece292ed524 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Tue, 26 Mar 2024 08:44:25 -0400 Subject: [PATCH] Correctly check buffer mtime when displaying xref matches This was just a typo: we were checking the modification time of current-buffer instead of checking the modification time of the passed-in buffer. This caused matches to not be shown if they weren't present in the current in-Emacs state of the buffer. This was easily reproduced by writing a string to a file outside Emacs, then searching for that string with e.g. project-find-regexp. The string would seemingly not be found, although in reality it was found, just not displayed. * lisp/progmodes/xref.el (xref--find-file-buffer): Check buf, not current-buffer. --- lisp/progmodes/xref.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 717b837a2e5..755c3db04fd 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -2176,7 +2176,7 @@ xref--find-file-buffer (or (buffer-modified-p buf) (unless xref--hits-remote-id - (not (verify-visited-file-modtime (current-buffer)))))) + (not (verify-visited-file-modtime buf))))) ;; We can't use buffers whose contents diverge from disk (bug#54025). (setq buf nil)) (setq xref--last-file-buffer (cons file buf)))) -- 2.39.3 --=-=-=-- ------------=_1711596363-27181-1--