From: Seweryn Kokot <s.kokot@po.opole.pl>
To: help-gnu-emacs@gnu.org
Subject: Re: what can I do with regexp match?
Date: Mon, 14 May 2007 15:17:16 +0200 [thread overview]
Message-ID: <87lkfrzgrn.fsf@poczta.po.opole.pl> (raw)
In-Reply-To: 46485922.1010608@gmail.com
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Seweryn Kokot wrote:
>> Hello,
>>
>> I would like to have a function that visits all the tex files included
>> in main.tex file. I wrote the following function:
>> (defun my-document-files ()
>> "Open all document files"
>> (interactive)
>> (while (re-search-forward "\\\\include{\\(.*\\)}")
>> (find-file (concat "~/nauka/doktorat/thesis/" "\\1" ".tex"))))
>>
>> But it doesn't work since \\1 is not replaced by regexp match. The
>> result is that the function visits \1.tex file. The question is how to
>> process the regexp match to make it argument for find-file or more
>> general question how to save the match in a variable or list?
>
>
> (match-string 1) ;; At least in Emacs 22
Thanks, the prolbem with \1 is solved but then the function only finds
first occurrence of \include{filename} and then I get in the echo buffer:
while: Search failed: "\\\\include{\\(.*\\)}"
Now my function is:
(defun my-document-files ()
"Open all document files"
(interactive)
(while (re-search-forward "\\\\include{\\(.*\\)}")
(find-file (concat "~/nauka/doktorat/thesis/" (match-string 1) ".tex"))))
why it failed although I have much more occurences of \include{...} in
the main.tex file? Any idea?
next prev parent reply other threads:[~2007-05-14 13:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 12:36 what can I do with regexp match? Seweryn Kokot
2007-05-14 12:42 ` Lennart Borgman (gmail)
2007-05-14 13:17 ` Seweryn Kokot [this message]
2007-05-14 15:09 ` Lennart Borgman (gmail)
2007-05-14 17:07 ` Seweryn Kokot
2007-05-14 17:14 ` Lennart Borgman (gmail)
2007-05-14 17:46 ` Seweryn Kokot
2007-05-14 15:36 ` Michaël Cadilhac
[not found] ` <mailman.649.1179157491.32220.help-gnu-emacs@gnu.org>
2007-06-09 22:01 ` Stefan Monnier
[not found] <mailman.635.1179146680.32220.help-gnu-emacs@gnu.org>
2007-05-14 17:38 ` David Kastrup
2007-05-14 20:17 ` Seweryn Kokot
2007-05-14 20:33 ` Lennart Borgman (gmail)
2007-05-14 19:01 ` Ralf Angeli
2007-05-14 20:06 ` Seweryn Kokot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lkfrzgrn.fsf@poczta.po.opole.pl \
--to=s.kokot@po.opole.pl \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).