help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: what can I do with regexp match?


From: Lennart Borgman (gmail)
Subject: Re: what can I do with regexp match?
Date: Mon, 14 May 2007 19:14:59 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666

Seweryn Kokot wrote:
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

Now my function is:
(defun my-document-files ()
  "Open all document files"
  (interactive)
  (while (re-search-forward "\\\\include{\\(.*\\)}")
         (find-file (concat "~/" (match-string 1) ".tex"))))

why it failed although I have much more occurences of \include{...} in
the main.tex file? Any idea?
Read the documentation for find-file.
Ok I see the problem I wonder if it would be better first to read a
buffer to a variable, then to search regexp, then assign matches to a
list and finally visit files from the list using dolist? But the problem
is how to create a list from regexp matches?


It does not really matter if you use find-file-noselect or create a list for this particular problem. The most easy way to build a list is perhaps this:

  (add-to-list 'my-list (match-string 1))




reply via email to

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