4 ms·
Nothing, of course. I just find the macros that give you a "modified environment" to run some code short and sweet. with-temp-buffer is another example: a macr
by swah 12y ago
Nothing, of course. I just find the macros that give you a "modified environment" to run some code short and sweet.
with-temp-buffer is another example: a macro that bridges the functions for "string manipulation" and the ones for "buffer manipulation", since you start writing stuff this way:
(defun replace-in-string (str from to)
(with-temp-buffer
(insert str)
(beginning-of-file)
;;; Here you can use all your normal text editing commands
(replace-regexp from to nil t)
(buffer-string)))
Lots of dirty manipulation, but from outside its a pure function, and doesn't change the editor state in any way after it runs.