mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
(wdired-exit): New function.
(wdired-mode-map): Bind C-x C-q to wdired-exit.
This commit is contained in:
parent
a0247dcf39
commit
f8f67141f1
1 changed files with 17 additions and 0 deletions
|
|
@ -175,6 +175,7 @@ program `dired-chmod-program', which must exist."
|
|||
(define-key map "\C-c\C-c" 'wdired-finish-edit)
|
||||
(define-key map "\C-c\C-k" 'wdired-abort-changes)
|
||||
(define-key map "\C-c\C-[" 'wdired-abort-changes)
|
||||
(define-key map "\C-x\C-q" 'wdired-exit)
|
||||
(define-key map "\C-m" 'ignore)
|
||||
(define-key map "\C-j" 'ignore)
|
||||
(define-key map "\C-o" 'ignore)
|
||||
|
|
@ -423,6 +424,22 @@ non-nil means return old filename."
|
|||
(set-buffer-modified-p nil)
|
||||
(setq buffer-undo-list nil))
|
||||
|
||||
(defun wdired-exit ()
|
||||
"Exit wdired and return to dired mode.
|
||||
Just return to dired mode if there are no changes. Otherwise,
|
||||
ask a yes-or-no question whether to save or cancel changes,
|
||||
and proceed depending on the answer."
|
||||
(interactive)
|
||||
(if (buffer-modified-p)
|
||||
(if (y-or-n-p (format "Buffer %s modified; save changes? "
|
||||
(current-buffer)))
|
||||
(wdired-finish-edit)
|
||||
(wdired-abort-changes))
|
||||
(wdired-change-to-dired-mode)
|
||||
(set-buffer-modified-p nil)
|
||||
(setq buffer-undo-list nil)
|
||||
(message "(No changes need to be saved)")))
|
||||
|
||||
;; Rename a file, searching it in a modified dired buffer, in order
|
||||
;; to be able to use `dired-do-create-files-regexp' and get its
|
||||
;; "benefits".
|
||||
|
|
|
|||
Loading…
Reference in a new issue