[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: global-replace to include linked files?
From: |
lee |
Subject: |
Re: global-replace to include linked files? |
Date: |
Sun, 25 May 2014 01:23:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Sharon Kimble <boudiccas@skimble.plus.com> writes:
> I have a master document with 14 files linked into it like this
>
> \include{020-ob2014}
>
> is it possible to do a "global-replace" of
> ╭────
> │\begin{verbatim}
> ╰────
> to
> ╭────
> │\begin{lstlisting}[frame=single]
> ╰────
> please?
>
> I tried "M-x replace-string" but that wasn't able to follow the
> import links to the subsidiary files.
Hm, multisearch[1] is capable of following "include" statements. It`s
designed for "#include", and you can easily change or expand it to go
for "\include{.*}" instead.
Look at multisearch-make-directory-files-list in [2], line 333:
,----
| (multisearch-make-token-list buffer
| "^#include\\s-*[\"<]")))
`----
You can probably get away with changing that to something like
(multisearch-make-token-list buffer
"^\\\include\\s-*{")))
The function multisearch-make-directory-files-list gives you a list of
the relevant files, and you can simply run your own function that does
the replacement you need in each file.
[1]: https://github.com/lee-/emacs
[2]: https://github.com/lee-/emacs/blob/master/multisearch/multisearch.el
--
Knowledge is volatile and fluid. Software is power.