all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit)
@ 2015-08-01  9:53 phs
  2015-08-01 11:45 ` Dmitry Gutov
  0 siblings, 1 reply; 2+ messages in thread
From: phs @ 2015-08-01  9:53 UTC (permalink / raw
  To: 21175

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.







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

* bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit)
  2015-08-01  9:53 bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit) phs
@ 2015-08-01 11:45 ` Dmitry Gutov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2015-08-01 11:45 UTC (permalink / raw
  To: phs, 21175-done

Version: 25.1

On 08/01/2015 12:53 PM, phs wrote:

> 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.

Thanks, this is fixed now as well.

> The comment too is incorrect.

I think the comment refers to the code below it.






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

end of thread, other threads:[~2015-08-01 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-01  9:53 bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit) phs
2015-08-01 11:45 ` Dmitry Gutov

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.