GNU bug report logs - #75946
[PATCH] Avoid infinite questions if TAGS file was removed

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Thu, 30 Jan 2025 14:17:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Cc: 75946 <at> debbugs.gnu.org
Subject: bug#75946: [PATCH] Avoid infinite questions if TAGS file was removed
Date: Sat, 01 Feb 2025 12:03:28 +0200
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Cc: 75946 <at> debbugs.gnu.org
> Date: Thu, 30 Jan 2025 18:44:31 +0300
> 
> On Thu, 2025-01-30 at 17:37 +0200, Eli Zaretskii wrote:
> > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > Date: Thu, 30 Jan 2025 17:16:13 +0300
> > >
> > > 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.
> >
> > Thanks, but can you please show a recipe, starting from "emacs -Q",
> > which could be used to reproduce this problem?
> 
> Sure. Idk of any Emacs tags auto-completion functions, but I don't it's particularly
> important in the context. I use below a `(tags-completion-table)` instead.
> 
> 1. Create empty tags `touch /tmp/TAGS`
> 2. Launch Emacs with `emacs -Q --eval '(visit-tags-table "/tmp/TAGS")'`
> 3. Remove the tags: `rm /tmp/TAGS`
> 4. In Emacs evaluate `(tags-completion-table)`
> 
> You'll get the question if you want to re-read from TAGS file, and disregarding
> whether you reply "yes" or "no", each time you execute `(tags-completion-table)`
> again you'll get the prompt again and again.

When I repeat these steps, Emacs signals an error:

  (error "File .../TAGS no longer exists!")

This comes from revert-buffer, called by tags-verify-table.  I wonder
why you see something different.

> In autocompletion context it results in complete inability type text, because the
> user gets spammed by the prompt on every letter.

Maybe the autocompletion runs with ignore-errors or something?

As for your patch: verify-visited-file-modtime returns t for files
that never existed -- is that case covered by the patch?  Maybe we
should text file-exists-p before calling verify-visited-file-modtime?




This bug report was last modified 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.