aboutsummaryrefslogtreecommitdiff
path: root/modules/ui-navigation.el
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ui-navigation.el')
-rw-r--r--modules/ui-navigation.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/ui-navigation.el b/modules/ui-navigation.el
index f1324c16..f2181d97 100644
--- a/modules/ui-navigation.el
+++ b/modules/ui-navigation.el
@@ -160,7 +160,9 @@ This function won't work with more than one split window."
;; UNDO KILL BUFFER
(defun cj/undo-kill-buffer (arg)
- "Re-open the last buffer killed. With ARG, re-open the nth buffer."
+ "Re-open the last buffer killed.
+With numeric prefix ARG, re-open the ARGth most-recently-killed file
+\(1-based, so no prefix re-opens the most recent)."
(interactive "p")
(require 'recentf)
(unless recentf-mode
@@ -177,9 +179,11 @@ This function won't work with more than one split window."
(delq buf-file recently-killed-list)))
buffer-files-list)
(when recently-killed-list
- (find-file
- (if arg (nth arg recently-killed-list)
- (car recently-killed-list))))))
+ (let ((file (nth (1- arg) recently-killed-list)))
+ (if file
+ (find-file file)
+ (user-error "Only %d killed file(s) to choose from"
+ (length recently-killed-list)))))))
(keymap-global-set "M-S-z" #'cj/undo-kill-buffer) ;; was M-Z, overrides zap-to-char
;; ---------------------------- Undo Layout Changes ----------------------------