all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: phs <phs@lsv.ens-cachan.fr>
To: 21175@debbugs.gnu.org
Subject: bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit)
Date: Sat, 01 Aug 2015 11:53:04 +0200	[thread overview]
Message-ID: <55BC9700.1030806@lsv.ens-cachan.fr> (raw)

when submitting bug #21167 I looked at the source code in 
progmodes/etags.el and wondered why next-file
passes the novisit flag when calling find-file.

novisit asks tags to use a temp buffer " *next-file*" rather than 
visiting the file unless it is already visited (in which case we want 
tags to search the version that we are currently editing and modifying). 
It is t by default.

What is actually done is (line 1765 in v24.5):

     (if (not (and new novisit))
       (find-file next novisit)
       ;; Like find-file, but avoids random warning messages.

So when the file is already visited, new is nil in the above code and we 
just use find-file.

Passing novisit is dangerous since find-file takes this as the wildcards 
flag, nothing to do with the meaning of novisit. Actually, if the 
filename contains * or ? (and is currently visited, or "not new") tags 
may create many buffers visiting many files that match the filename 
interpreted as a pattern, not an actual file name. What buffer will be 
searched next is maybe not the one associated with filename.

The comment too is incorrect.

To trip the bug in an empty directory:
% touch foo1.c foo2.c foo3.c "*.c" ;  etags "*.c"; emacs -q "*.c"
Now modify the *.c buffer, just type foo in it
Now M-x etags-search foo
I get the message "Symbolic link that points to nonexistent file" and 
emacs has buffers visiting foo{1,2,3}.c that are not listed in the TAGS 
file.

---
All this seems to be inherited from older versions. I just checked 21.4 
from 10+ years ago and it had

     (if (not (and new novisit))
       (set-buffer (find-file-noselect next novisit))
       ;; Like find-file, but avoids random warning messages.

Here too the novisit flag was already misinterpreted but the comment 
made sense.







             reply	other threads:[~2015-08-01  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-01  9:53 phs [this message]
2015-08-01 11:45 ` bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit) Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BC9700.1030806@lsv.ens-cachan.fr \
    --to=phs@lsv.ens-cachan.fr \
    --cc=21175@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.