Commit 40aa8257 authored by Juri Linkov's avatar Juri Linkov
Browse files

(dired-mode-map): Bind C-x C-q to dired-toggle-read-only.

Filter out menu item "Edit File Names" `wdired-change-to-wdired-mode'
when major-mode is not dired-mode.
(dired-toggle-read-only): New function.
(dired-recursive-deletes): Remove obsolete comments about old
default value.
(dired-do-flagged-delete, dired-do-delete): Refill docstring.
parent f8f67141
...@@ -155,7 +155,9 @@ file copy is checked via the file's checksum. ...@@ -155,7 +155,9 @@ file copy is checked via the file's checksum.
If `default-directory' is a remote file name, subprocesses are started If `default-directory' is a remote file name, subprocesses are started
on the corresponding remote system. on the corresponding remote system.
** C-x C-q in dired-mode now runs the command wdired-change-to-wdired-mode. ** C-x C-q in dired-mode now runs the command wdired-change-to-wdired-mode,
and C-x C-q in wdired-mode exits it with asking a question about
saving changes.
* Changes in Emacs 23.1 on non-free operating systems * Changes in Emacs 23.1 on non-free operating systems
......
2007-07-29 Juri Linkov <juri@jurta.org>
* dired.el (dired-mode-map): Bind C-x C-q to dired-toggle-read-only.
Filter out menu item "Edit File Names" `wdired-change-to-wdired-mode'
when major-mode is not dired-mode.
(dired-toggle-read-only): New function.
(dired-recursive-deletes): Remove obsolete comments about old
default value.
(dired-do-flagged-delete, dired-do-delete): Refill docstring.
* wdired.el (wdired-exit): New function.
(wdired-mode-map): Bind C-x C-q to wdired-exit.
2007-07-28 Stefan Monnier <monnier@iro.umontreal.ca> 2007-07-28 Stefan Monnier <monnier@iro.umontreal.ca>
* cus-edit.el (customize-read-group): New fun. * cus-edit.el (customize-read-group): New fun.
......
...@@ -1247,7 +1247,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ...@@ -1247,7 +1247,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map "$" 'dired-hide-subdir) (define-key map "$" 'dired-hide-subdir)
(define-key map "\M-$" 'dired-hide-all) (define-key map "\M-$" 'dired-hide-all)
;; misc ;; misc
(define-key map "\C-x\C-q" 'wdired-change-to-wdired-mode) (define-key map "\C-x\C-q" 'dired-toggle-read-only)
(define-key map "?" 'dired-summary) (define-key map "?" 'dired-summary)
(define-key map "\177" 'dired-unmark-backward) (define-key map "\177" 'dired-unmark-backward)
(define-key map [remap undo] 'dired-undo) (define-key map [remap undo] 'dired-undo)
...@@ -1353,7 +1353,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ...@@ -1353,7 +1353,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map [menu-bar immediate create-directory] (define-key map [menu-bar immediate create-directory]
'(menu-item "Create Directory..." dired-create-directory)) '(menu-item "Create Directory..." dired-create-directory))
(define-key map [menu-bar immediate wdired-mode] (define-key map [menu-bar immediate wdired-mode]
'(menu-item "Edit File Names" wdired-change-to-wdired-mode)) '(menu-item "Edit File Names" wdired-change-to-wdired-mode
:filter (lambda (x) (if (eq major-mode 'dired-mode) x))))
(define-key map [menu-bar regexp] (define-key map [menu-bar regexp]
(cons "Regexp" (make-sparse-keymap "Regexp"))) (cons "Regexp" (make-sparse-keymap "Regexp")))
...@@ -1656,6 +1657,16 @@ You can use it to recover marks, killed lines or subdirs." ...@@ -1656,6 +1657,16 @@ You can use it to recover marks, killed lines or subdirs."
(message "Change in dired buffer undone. (message "Change in dired buffer undone.
Actual changes in files cannot be undone by Emacs.")) Actual changes in files cannot be undone by Emacs."))
(defun dired-toggle-read-only ()
"Edit dired buffer with Wdired, or set it read-only.
Call `wdired-change-to-wdired-mode' in dired buffers whose editing is
supported by Wdired (the major mode of the dired buffer is `dired-mode').
Otherwise, for buffers inheriting from dired-mode, call `toggle-read-only'."
(interactive)
(if (eq major-mode 'dired-mode)
(wdired-change-to-wdired-mode)
(toggle-read-only)))
(defun dired-next-line (arg) (defun dired-next-line (arg)
"Move down lines then position at filename. "Move down lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line." Optional prefix ARG says how many lines to move; default is one line."
...@@ -2360,7 +2371,7 @@ Optional argument means return a file name relative to `default-directory'." ...@@ -2360,7 +2371,7 @@ Optional argument means return a file name relative to `default-directory'."
;; Deleting files ;; Deleting files
(defcustom dired-recursive-deletes 'top ; Default only delete empty directories. (defcustom dired-recursive-deletes 'top
"*Decide whether recursive deletes are allowed. "*Decide whether recursive deletes are allowed.
A value of nil means no recursive deletes. A value of nil means no recursive deletes.
`always' means delete recursively without asking. This is DANGEROUS! `always' means delete recursively without asking. This is DANGEROUS!
...@@ -2409,8 +2420,8 @@ Anything else, ask for each sub-directory." ...@@ -2409,8 +2420,8 @@ Anything else, ask for each sub-directory."
"In Dired, delete the files flagged for deletion. "In Dired, delete the files flagged for deletion.
If NOMESSAGE is non-nil, we don't display any message If NOMESSAGE is non-nil, we don't display any message
if there are no flagged files. if there are no flagged files.
`dired-recursive-deletes' controls whether `dired-recursive-deletes' controls whether deletion of
deletion of non-empty directories is allowed." non-empty directories is allowed."
(interactive) (interactive)
(let* ((dired-marker-char dired-del-marker) (let* ((dired-marker-char dired-del-marker)
(regexp (dired-marker-regexp)) (regexp (dired-marker-regexp))
...@@ -2427,8 +2438,8 @@ deletion of non-empty directories is allowed." ...@@ -2427,8 +2438,8 @@ deletion of non-empty directories is allowed."
(defun dired-do-delete (&optional arg) (defun dired-do-delete (&optional arg)
"Delete all marked (or next ARG) files. "Delete all marked (or next ARG) files.
`dired-recursive-deletes' controls whether `dired-recursive-deletes' controls whether deletion of
deletion of non-empty directories is allowed." non-empty directories is allowed."
;; This is more consistent with the file marking feature than ;; This is more consistent with the file marking feature than
;; dired-do-flagged-delete. ;; dired-do-flagged-delete.
(interactive "P") (interactive "P")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment