Created
August 26, 2012 16:05
-
-
Save clarkgrubb/3481345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun undo-only (&optional arg) | |
"Undo some previous changes. | |
Repeat this command to undo more changes. | |
A numeric ARG serves as a repeat count. | |
Contrary to `undo', this will not redo a previous undo." | |
(interactive "*p") | |
(let ((undo-no-redo t)) | |
(undo arg) | |
;; assume undo succeeded and overwrite | |
;; what it wrote. | |
(message "%s" (if (or (region-active-p) (and arg (not (numberp arg)))) | |
"Undo in region!" | |
"Undo!")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment