[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] extended reftex-search-document

From: Lars Madsen
Subject: Re: [AUCTeX-devel] extended reftex-search-document
Date: Tue, 2 Dec 2014 15:27:22 +0000

hmm, it sort of works, at least no errors

But If I just add 

sdfa s asdf sadf : sadfadfsdaf

to a file and then search for space-colon, then it does not always find it

(not sure why, the text file was the last to appear in the file list)

/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: / More information:

From: Tassilo Horn address@hidden
Sent: 02 December 2014 15:21
To: Lars Madsen
Cc: address@hidden
Subject: Re: [AUCTeX-devel] extended reftex-search-document

Lars Madsen <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]