unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
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 19:07:36 +0200	[thread overview]
Message-ID: <87irav9vvr.fsf@poczta.po.opole.pl> (raw)
In-Reply-To: 46487BA2.9000807@gmail.com

"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"))))))

  reply	other threads:[~2007-05-14 17:07 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
2007-05-14 15:09     ` Lennart Borgman (gmail)
2007-05-14 17:07       ` Seweryn Kokot [this message]
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=87irav9vvr.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).