Subject: [PATCH] Avoid infinite questions if TAGS file was removed
From: Konstantin Kharlamov <[email-masked]>
To: [email-masked]
Date: Thu, 30 Jan 2025 17:16:13 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

When the visited TAGS file was removed, commands that depend on TAGS
such as auto-completion may invoke an interactive question whether a
user wants to re-read the file.  From that point on, the question will
be asked over and over, because the file no longer exists, which
results in mtime mismatch and inability to "fix the mismatch" by
reading from the file.  Fix that by simply ignoring the mismatch if
the file no longer exists.
From 1e44e66db918b725afd5fc5c9b6c077c2d653ab0 Mon Sep 17 00:00:00 2001
From: Konstantin Kharlamov <[email-masked]>
Date: Thu, 30 Jan 2025 17:09:48 +0300
Subject: [PATCH] Avoid infinite questions if TAGS file was removed

When the visited TAGS file was removed, commands that depend on TAGS
such as auto-completion may invoke an interactive question whether a
user wants to re-read the file.  From that point on, the question will
be asked over and over, because the file no longer exists, which
results in mtime mismatch and inability to "fix the mismatch" by
reading from the file.  Fix that by simply ignoring the mismatch if
the file no longer exists.

* lisp/progmodes/etags.el (tags-verify-table): Avoid infinite
questions if TAGS file was removed
---
 lisp/progmodes/etags.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 352356ddbc5..3bb553ab550 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -445,6 +445,9 @@ tags-verify-table
 	(set-buffer (get-file-buffer file))
         (or verify-tags-table-function (tags-table-mode))
 	(unless (or (verify-visited-file-modtime (current-buffer))
+                    ;; Avoid an infinte loop of questions about
+                    ;; re-reading content if file was removed.
+                    (not (file-exists-p file))
 		    ;; Decide whether to revert the file.
 		    ;; revert-without-query can say to revert
 		    ;; or the user can say to revert.
-- 
2.48.1