aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2007-07-29 09:17:30 +0000
committerJuri Linkov2007-07-29 09:17:30 +0000
commitf8f67141f10e299501ac66b496c6647b67a9d3d3 (patch)
tree70e0da4e3d9dae7d20592a30745a5b2aa23a1e03
parenta0247dcf3990ef954108d39d913d9cccc3a1b4fe (diff)
downloademacs-f8f67141f10e299501ac66b496c6647b67a9d3d3.tar.gz
emacs-f8f67141f10e299501ac66b496c6647b67a9d3d3.zip
(wdired-exit): New function.
(wdired-mode-map): Bind C-x C-q to wdired-exit.
-rw-r--r--lisp/wdired.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 0abb8647ce0..960d8990983 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -175,6 +175,7 @@ program `dired-chmod-program', which must exist."
175 (define-key map "\C-c\C-c" 'wdired-finish-edit) 175 (define-key map "\C-c\C-c" 'wdired-finish-edit)
176 (define-key map "\C-c\C-k" 'wdired-abort-changes) 176 (define-key map "\C-c\C-k" 'wdired-abort-changes)
177 (define-key map "\C-c\C-[" 'wdired-abort-changes) 177 (define-key map "\C-c\C-[" 'wdired-abort-changes)
178 (define-key map "\C-x\C-q" 'wdired-exit)
178 (define-key map "\C-m" 'ignore) 179 (define-key map "\C-m" 'ignore)
179 (define-key map "\C-j" 'ignore) 180 (define-key map "\C-j" 'ignore)
180 (define-key map "\C-o" 'ignore) 181 (define-key map "\C-o" 'ignore)
@@ -423,6 +424,22 @@ non-nil means return old filename."
423 (set-buffer-modified-p nil) 424 (set-buffer-modified-p nil)
424 (setq buffer-undo-list nil)) 425 (setq buffer-undo-list nil))
425 426
427(defun wdired-exit ()
428 "Exit wdired and return to dired mode.
429Just return to dired mode if there are no changes. Otherwise,
430ask a yes-or-no question whether to save or cancel changes,
431and proceed depending on the answer."
432 (interactive)
433 (if (buffer-modified-p)
434 (if (y-or-n-p (format "Buffer %s modified; save changes? "
435 (current-buffer)))
436 (wdired-finish-edit)
437 (wdired-abort-changes))
438 (wdired-change-to-dired-mode)
439 (set-buffer-modified-p nil)
440 (setq buffer-undo-list nil)
441 (message "(No changes need to be saved)")))
442
426;; Rename a file, searching it in a modified dired buffer, in order 443;; Rename a file, searching it in a modified dired buffer, in order
427;; to be able to use `dired-do-create-files-regexp' and get its 444;; to be able to use `dired-do-create-files-regexp' and get its
428;; "benefits". 445;; "benefits".