[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: etags.el tags-search use global syntax table
From: |
John Dennis |
Subject: |
Re: etags.el tags-search use global syntax table |
Date: |
Fri, 30 Nov 2007 16:07:10 -0500 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20070926) |
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.
There are two reasons for this. One is that some major modes can be
rather intrusive in what they do. The other is that visiting a file
is much slower.
Of course, it was all based on the idea that it wouldn't really
matter for searching, and if it actually finds a match, then it
visits the file properly. This bug shows that the major mode does
matter in some cases for searching.
The the major mode does matter for searching, in fact it's often
critical for correct searching. There are two key things a major mode
does which affects searching, it establishes a syntax and often defines
the value of case-fold-search. If either of these is not done before the
search proceeds you'll often get incorrect search results. This is
especially critical with program source code, which almost by definition
is the context when a tags search is performed.
I consider this to be a serious flaw in etags and have been fixing it in
my local version of emacs for quite a while now. The novisit behavior
has another down side to my thinking as well, the buffer is not
available in the buffer list unless a match was found. This makes for an
odd and arbitrary set of buffers. My preference is to have all buffers
which participated in the search to be available. Yes, this does mean
more memory is used and loading is slower. But virtual memory is a
wonderful thing, universally supported, and I can't see on any modern
system the performance difference. Plus, if one does repeated searches
isn't it more efficient to have the buffer already loaded rather than
repeatedly loading it and then throwing it away?
I've also been bothered by the interface to tags-search, unlike the
other tags functions it does not default to the word surrounded by
point. It's really nice to be able to put your point on what you want to
search for and just hit a function key.
Attached is a patch that I believe fixes these issues and allows for
customizing the behavior. I don't see an easy fix for establishing the
syntax table and value of case-fold-search for the novisit case. I guess
if a user want to continue to utilize novisit that's a liability you'll
have to live with in order to retain that feature.
Also, as an aside, should we still be supporting the slow baud rate
stuff? It adds complexity to the code which I suspect is no longer relevant.
--
John Dennis <jdennis@redhat.com>
--- etags.el.orig 2007-11-30 13:46:35.000000000 -0500
+++ etags.el 2007-11-30 15:12:28.000000000 -0500
@@ -102,6 +102,11 @@
:group 'etags
:type 'boolean)
+(defcustom tags-novisit t
+ "*Non-nil means use a temporary buffer to save time and avoid uninteresting
warnings."
+ :type 'boolean
+ :group 'etags)
+
(defvar tags-table-computed-list nil
"List of tags tables to search, computed from `tags-table-list'.
This includes tables implicitly included by other tables. The list is not
@@ -1698,7 +1703,8 @@
(with-current-buffer buffer
(revert-buffer t)))
(if (not (and new novisit))
- (set-buffer (find-file-noselect next novisit))
+ (progn (set-buffer (find-file-noselect next t))
+ (setq new nil))
;; Like find-file, but avoids random warning messages.
(set-buffer (get-buffer-create " *next-file*"))
(kill-all-local-variables)
@@ -1761,7 +1767,7 @@
(goto-char original-point))
(setq file-finished nil)
- (setq new (next-file first-time t))
+ (setq new (next-file first-time tags-novisit))
;; If NEW is non-nil, we got a temp buffer,
;; and NEW is the file name.
@@ -1803,7 +1809,7 @@
To continue searching for next match, use command \\[tags-loop-continue].
See documentation of variable `tags-file-name'."
- (interactive "sTags search (regexp): ")
+ (interactive (find-tag-interactive "Tags search (regexp): "))
(if (and (equal regexp "")
(eq (car tags-loop-scan) 're-search-forward)
(null tags-loop-operate))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: etags.el tags-search use global syntax table,
John Dennis <=