unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: etags.el tags-search use global syntax table
@ 2007-07-17 11:49 Francesco Potorti`
  0 siblings, 0 replies; 9+ messages in thread
From: Francesco Potorti` @ 2007-07-17 11:49 UTC (permalink / raw)
  To: Emacs developers

isaac.to@gmail.com:
>When using AucTeX to edit some LaTeX files, I want to search for some
>word globally.  My version is not new enough to support inter-file
>searching directly, so I've used tags-search.  I'm searching for
>something like "\bx\b".  It turned out that some of the matches are
>missed, because $ is considered as a word (as in the fundamental
>mode).  This is out of my expectation, since it is a LaTeX file and in
>the LaTeX mode of AucTeX, $ is considered not a word.  Perhaps when
>Emacs performs a tags-search it do it in a temp buffer which does not
>have the correct mode loaded?  I consider this a bug in etags.

This is indeed a bug in etags.el that was present in Emacs 21 and is
still there in Emacs 22.  It has nothing to do with Auctex, but pops up
whenever:
- you start a tags-search
- the file where you should see a match is not currently visited
- the search in Fundamental mode gives different results from the search
  in the proper mode of the buffer

The reason is that the next-file function in etags.el loads non-visited
files in a temporary buffer with insert-file-contents, rather than using
find-file, so the mode remains Fundamental.  I am not sure why it is so.
These are the relevant lines at the end of next-file:

      ;; Like find-file, but avoids random warning messages.
      (set-buffer (get-buffer-create " *next-file*"))
      (kill-all-local-variables)
      (erase-buffer)
      (setq new next)
      (insert-file-contents new nil))

Generally speaking, tags-search looks for all files in the TAGS file: if
they are visited, they are searched and when no match is found point is
restored.  If they are not visited, they are loaded into a temporary
buffer which is overwritten when no matches are found.  However, search
in this buffer is performed in Fundamental mode.

The cure is to use the syntax table relative to the natural mode of the
file when doing the search.  Is it really necessary to avoid using
find-file?  If yes, how can one guess the right syntax table and apply
it to the temporary buffer?

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

end of thread, other threads:[~2007-07-22 10:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1IAlXn-000690-C1@tucano.isti.cnr.it>
     [not found] ` <E1IB1MF-0008Id-Cg@fencepost.gnu.org>
2007-07-18 12:54   ` etags.el tags-search use global syntax table Francesco Potorti`
2007-07-18 13:38     ` Andreas Schwab
2007-07-18 14:21       ` Francesco Potorti`
2007-07-19  4:25     ` Richard Stallman
2007-07-19 16:49       ` Francesco Potorti`
2007-07-20 13:42         ` Richard Stallman
2007-07-21 16:58           ` Francesco Potorti`
2007-07-22 10:05             ` Richard Stallman
2007-07-17 11:49 Francesco Potorti`

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