Fork me on GitHub
#emacs
<
2018-01-13
>
qqq04:01:39

does emacs have something more powerful than save-excursion ?

qqq04:01:50

I want to save the entire buffer, do some work, get a string out of it, then restore the buffer

dpsutton04:01:44

@qqq check out the with-temp-buffer and replace-buffer-contents. the latter can take a buffer and use the text from it

dpsutton04:01:16

so just make a new temp buffer, use the contents from the buffer you came from and then the buffer goes away when the form is done

qqq05:01:41

@dpsutton creating temporary buffers is simultaneously: 1. so weird from the clojure perpsective of pure functions and 2. so reasoanble given how things work in emacs

bozhidar10:01:51

It’s a text editor after all. Allegedly. 😄