[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what can I do with regexp match?
From: |
Seweryn Kokot |
Subject: |
Re: what can I do with regexp match? |
Date: |
Mon, 14 May 2007 19:07:36 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) |
"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?
(defun my-document-files ()
""
(interactive)
(save-excursion
(let ((bufor (buffer-substring-no-properties (point-min) (point-max)))
pliki wartosc)
(string-match "\\\\include{\\(.*?\\)}" bufor)
(setq (match-string 0) pliki)
(dolist (plik pliki wartosc)
(find-file (concat "~/foo/" plik ".tex"))))))