The default yes-or-no-p function in Emacs is a total nightmare. However, one can alias it to y-or-n-p in order to enter y for "yes" and n for "no". But, it has its own quirk, which is not to clear the minibuffer after entering y or n. So, I wrote this tiny function to clear the minibuffer after the y/n response is typed. It's a useless & fun function to have.
(defun clear-y-or-n-p (prompt)
(interactive)
(prog1 (y-or-no-p prompt) (message nil)))
Another function, that actually does something is this:
(defun indent-buffer ()
"Indent the current buffer"
(interactive)
(indent-region (point-min) (point-max) nil))
This indents the entire buffer (or the rectangle) according to the current indentation. Very handy when editing files which have various levels of "2-spaces/4-spaces per tab" indentation(Ugh!).
Monday, August 21, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment