summaryrefslogtreecommitdiff
path: root/lisp/dired.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/dired.el')
-rw-r--r--lisp/dired.el44
1 files changed, 32 insertions, 12 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 942a6e4c905..09695bfa7cd 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -70,7 +70,7 @@ If nil, `dired-listing-switches' is used.")
;;;###autoload
(defvar dired-chown-program
- (if (memq system-type '(hpux dgux usg-unix-v irix linux gnu/linux cygwin))
+ (if (memq system-type '(hpux usg-unix-v irix linux gnu/linux cygwin))
"chown"
(if (file-exists-p "/usr/sbin/chown")
"/usr/sbin/chown"
@@ -595,8 +595,12 @@ Don't use that together with FILTER."
(if (next-read-file-uses-dialog-p)
(read-directory-name (format "Dired %s(directory): " str)
nil default-directory nil)
- (read-file-name (format "Dired %s(directory): " str)
- nil default-directory nil)))))
+ (let ((default (and buffer-file-name
+ (abbreviate-file-name buffer-file-name))))
+ (minibuffer-with-setup-hook
+ (lambda () (setq minibuffer-default default))
+ (read-file-name (format "Dired %s(directory): " str)
+ nil default-directory nil)))))))
;;;###autoload (define-key ctl-x-map "d" 'dired)
;;;###autoload
@@ -1258,6 +1262,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map "$" 'dired-hide-subdir)
(define-key map "\M-$" 'dired-hide-all)
;; misc
+ (define-key map "\C-x\C-q" 'dired-toggle-read-only)
(define-key map "?" 'dired-summary)
(define-key map "\177" 'dired-unmark-backward)
(define-key map [remap undo] 'dired-undo)
@@ -1363,7 +1368,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map [menu-bar immediate create-directory]
'(menu-item "Create Directory..." dired-create-directory))
(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]
(cons "Regexp" (make-sparse-keymap "Regexp")))
@@ -1462,6 +1468,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map [menu-bar operate]
(cons "Operate" (make-sparse-keymap "Operate")))
+
(define-key map
[menu-bar operate image-dired-delete-tag]
'(menu-item "Delete Image Tag..." image-dired-delete-tag
@@ -1665,18 +1672,28 @@ You can use it to recover marks, killed lines or subdirs."
(message "Change in dired buffer undone.
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)
"Move down lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line."
(interactive "p")
- (next-line arg)
+ (forward-line arg)
(dired-move-to-filename))
(defun dired-previous-line (arg)
"Move up lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line."
(interactive "p")
- (previous-line arg)
+ (forward-line (- arg))
(dired-move-to-filename))
(defun dired-next-dirline (arg &optional opoint)
@@ -1992,7 +2009,7 @@ Return the position of the beginning of the filename, or nil if none found."
(forward-char -1))))
(or no-error
(not (eq opoint (point)))
- (error (if hidden
+ (error "%s" (if hidden
(substitute-command-keys
"File line is hidden, type \\[dired-hide-subdir] to unhide")
"No file on this line")))
@@ -2418,8 +2435,8 @@ Anything else, ask for each sub-directory."
"In Dired, delete the files flagged for deletion.
If NOMESSAGE is non-nil, we don't display any message
if there are no flagged files.
-`dired-recursive-deletes' controls whether
-deletion of non-empty directories is allowed."
+`dired-recursive-deletes' controls whether deletion of
+non-empty directories is allowed."
(interactive)
(let* ((dired-marker-char dired-del-marker)
(regexp (dired-marker-regexp))
@@ -2436,8 +2453,8 @@ deletion of non-empty directories is allowed."
(defun dired-do-delete (&optional arg)
"Delete all marked (or next ARG) files.
-`dired-recursive-deletes' controls whether
-deletion of non-empty directories is allowed."
+`dired-recursive-deletes' controls whether deletion of
+non-empty directories is allowed."
;; This is more consistent with the file marking feature than
;; dired-do-flagged-delete.
(interactive "P")
@@ -3253,6 +3270,9 @@ Anything else means ask for each directory."
(dired-dnd-handle-local-file uri action)
nil)))
+(declare-function dired-relist-entry "dired-aux" (file))
+(declare-function make-symbolic-link "fileio.c")
+
(defun dired-dnd-handle-local-file (uri action)
"Copy, move or link a file to the dired directory.
URI is the file to handle, ACTION is one of copy, move, link or ask.
@@ -3336,7 +3356,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
(dired dired-dir)
;; The following elements of `desktop-buffer-misc' are the keys
;; from `dired-subdir-alist'.
- (mapcar 'dired-maybe-insert-subdir (cdr desktop-buffer-misc))
+ (mapc 'dired-maybe-insert-subdir (cdr desktop-buffer-misc))
(current-buffer))
(message "Desktop: Directory %s no longer exists." dir)
(when desktop-missing-file-warning (sit-for 1))