all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Francesco Potorti` <pot@gnu.org>
To: bug-gnu-emacs@gnu.org
Subject: Re: etags.el tags-search use global syntax table
Date: Tue, 17 Jul 2007 13:48:43 +0200	[thread overview]
Message-ID: <E1IAlXn-000690-C1@tucano.isti.cnr.it> (raw)
In-Reply-To: "isaac.to@gmail.com"'s message of Wed, 27 Jun 2007 12:15:28 -0000

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?

             reply	other threads:[~2007-07-17 11:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 11:48 Francesco Potorti` [this message]
2007-07-18  4:41 ` etags.el tags-search use global syntax table Richard Stallman
2007-07-18 12:54   ` 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
  -- strict thread matches above, loose matches on Subject: below --
2007-11-30 21:07 John Dennis
2007-12-01 17:59 ` Richard Stallman
2007-07-17 11:49 Francesco Potorti`
2007-06-27 12:15 isaac.to

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=E1IAlXn-000690-C1@tucano.isti.cnr.it \
    --to=pot@gnu.org \
    --cc=bug-gnu-emacs@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.