unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches
@ 2024-03-26 12:45 Spencer Baugh
  2024-03-28  3:25 ` Dmitry Gutov
  0 siblings, 1 reply; 2+ messages in thread
From: Spencer Baugh @ 2024-03-26 12:45 UTC (permalink / raw)
  To: 70008; +Cc: Dmitry Gutov

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correctly-check-buffer-mtime-when-displaying-xref-ma.patch --]
[-- Type: text/patch, Size: 1505 bytes --]

From 718f2dc2c23660bc002b852bb36f2ece292ed524 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches
  2024-03-26 12:45 bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches Spencer Baugh
@ 2024-03-28  3:25 ` Dmitry Gutov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2024-03-28  3:25 UTC (permalink / raw)
  To: Spencer Baugh, 70008-done

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!





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 12:45 bug#70008: [PATCH] Correctly check buffer mtime when displaying xref matches Spencer Baugh
2024-03-28  3:25 ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).