[Top][All Lists]

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

How to do write-region, but modify

From: Marcin Borkowski
Subject: How to do write-region, but modify
Date: Sat, 25 Oct 2014 16:58:22 +0200

Hi all,

I'd like to have a variant of write-region, which (instead of saving to
a file) "saves" the region to a temporary buffer and lets me change it
somehow there.

What I'm doing now is something like this:

--8<---------------cut here---------------start------------->8---
(let ((text (buffer-substring beg end)))
    (insert text)
    (do-some manipulation)
    (write-region (point-min) (point-max) filename)))
--8<---------------cut here---------------end--------------->8---

This feels not optimal, since the text is copied twice (once to the
variable `text' and then to the temporary buffer).

Any suggestions on how to improve this code?


Marcin Borkowski
Adam Mickiewicz University

reply via email to

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