Re:fork() can fail
by swah on Wednesday August 20, 2014 @06:36PM
(#8205051)
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.
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:
Lots of dirty manipulation, but from outside its a pure function, and doesn't change the editor state in any way after it runs.