I am writing a simple package for myself to try and learn some elisp - and to begin extending Emacs for my own personal workflow. This function processes the current buffer contents with a command line utility and pipes the output into a temporary buffer. This is what I have so far, and it processes the buffer as desired
(defun doStuff ()
(interactive)
(with-output-to-temp-buffer "*stuffed*"
(shell-command
(..cli stuff here...)
(pop-to-buffer "*stuffed*")
))
)
What I'm looking for is a way to replace the contents of the current buffer, in such a way that if I press "q" it will revert to the original buffer contents. Can anyone give me some pointers on how I might go about that?
(special-mode)
. Then when you hitq
in that buffer, that buffer window will quit without killing the buffer (default binding inspecial-mode-map
). HittingC-u q
will quit that window and kill that buffer. – Kaushal Modi Jul 31 '15 at 01:44doStuff
should bedo-stuff
or rathermy-package-do-stuff
. This will save you time fixing it later if you want to put it into some package archive after all. – Mark Karpov Jul 31 '15 at 07:50