Lars Madsen <[email protected]> writes:
Hi Lars,
> And tested it by looking for ' :' (space colon), it should find those
> outside math. It does, but a few files in I get an error
>
> wrong type argument: stringp, nil
>
> and the buffer has opened *next-file*
>
> It seems it was hit at the very first ' :' that is actually in math
> mode. So I'm guessing (not (texmathp)) is not the proper test?
The problem is that `texmathp' assumes that the buffer is in
(la)tex-mode. That's ok, but `tags-search' scans the files using
fundamental-mode in order to be as fast as possible. Therefore, the
variable `comment-start-skip' which is used by `texmathp' is nil, and
that's the cause of the error.
Long story short: this works.
--8<---------------cut here---------------start------------->8---
(defun daleif-tags-search (regexp &optional file-list-form)
"Search through all files listed in tags table for match for REGEXP.
Stops when a match is found.
To continue searching for next match, use command \\[tags-loop-continue].
If FILE-LIST-FORM is non-nil, it should be a form that, when
evaluated, will return a list of file names. The search will be
restricted to these files.
Also see the documentation of the `tags-file-name' variable."
(interactive "sTags search (regexp): ")
(if (and (equal regexp "")
(eq (car tags-loop-scan) 're-search-forward)
(null tags-loop-operate))
;; Continue last tags-search as if by M-,.
(tags-loop-continue nil)
(setq tags-loop-scan
`(and (re-search-forward ,regexp nil t)
(let ((comment-start-skip "\\(\\(^\\|[^\\
]\\)\\(\\\\\\\\\\)*\\)\\(%+[ ]*\\)"))
(not (texmathp))))
tags-loop-operate nil)
(tags-loop-continue (or file-list-form t))))
--8<---------------cut here---------------end--------------->8---
I just let-bound the standard latex-mode value of `comment-start-skip'
in the `tags-loop-scan' form.
Bye,
Tassilo
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel