50 |
|
|
51 |
;;;###autoload |
;;;###autoload |
52 |
(defcustom dired-listing-switches "-al" |
(defcustom dired-listing-switches "-al" |
53 |
"*Switches passed to `ls' for dired. MUST contain the `l' option. |
"*Switches passed to `ls' for Dired. MUST contain the `l' option. |
54 |
May contain all other options that don't contradict `-l'; |
May contain all other options that don't contradict `-l'; |
55 |
may contain even `F', `b', `i' and `s'. See also the variable |
may contain even `F', `b', `i' and `s'. See also the variable |
56 |
`dired-ls-F-marks-symlinks' concerning the `F' switch. |
`dired-ls-F-marks-symlinks' concerning the `F' switch. |
57 |
On systems such as MS-DOS and MS-Windows, which use `ls' emulation in Lisp, |
On systems such as MS-DOS and MS-Windows, which use `ls' emulation in Lisp, |
58 |
some of the `ls' switches are not supported; see the doc string of |
some of the `ls' switches are not supported; see the doc string of |
59 |
`insert-directory' on ls-lisp.el for more details." |
`insert-directory' on `ls-lisp.el' for more details." |
60 |
:type 'string |
:type 'string |
61 |
:group 'dired) |
:group 'dired) |
62 |
|
|
88 |
|
|
89 |
;;;###autoload |
;;;###autoload |
90 |
(defcustom dired-ls-F-marks-symlinks nil |
(defcustom dired-ls-F-marks-symlinks nil |
91 |
"*Informs dired about how `ls -lF' marks symbolic links. |
"*Informs Dired about how `ls -lF' marks symbolic links. |
92 |
Set this to t if `ls' (or whatever program is specified by |
Set this to t if `ls' (or whatever program is specified by |
93 |
`insert-directory-program') with `-lF' marks the symbolic link |
`insert-directory-program') with `-lF' marks the symbolic link |
94 |
itself with a trailing @ (usually the case under Ultrix). |
itself with a trailing @ (usually the case under Ultrix). |
153 |
|
|
154 |
;;;###autoload |
;;;###autoload |
155 |
(defcustom dired-dwim-target nil |
(defcustom dired-dwim-target nil |
156 |
"*If non-nil, dired tries to guess a default target directory. |
"*If non-nil, Dired tries to guess a default target directory. |
157 |
This means: if there is a dired buffer displayed in the next window, |
This means: if there is a dired buffer displayed in the next window, |
158 |
use its current subdir, instead of the current subdir of this dired buffer. |
use its current subdir, instead of the current subdir of this dired buffer. |
159 |
|
|
176 |
;;; Hook variables |
;;; Hook variables |
177 |
|
|
178 |
(defcustom dired-load-hook nil |
(defcustom dired-load-hook nil |
179 |
"Run after loading dired. |
"Run after loading Dired. |
180 |
You can customize key bindings or load extensions with this." |
You can customize key bindings or load extensions with this." |
181 |
:group 'dired |
:group 'dired |
182 |
:type 'hook) |
:type 'hook) |
183 |
|
|
184 |
(defcustom dired-mode-hook nil |
(defcustom dired-mode-hook nil |
185 |
"Run at the very end of dired-mode." |
"Run at the very end of `dired-mode'." |
186 |
:group 'dired |
:group 'dired |
187 |
:type 'hook) |
:type 'hook) |
188 |
|
|
229 |
(defvar dired-del-marker ?D |
(defvar dired-del-marker ?D |
230 |
"Character used to flag files for deletion.") |
"Character used to flag files for deletion.") |
231 |
|
|
232 |
(defvar dired-shrink-to-fit |
(defvar dired-shrink-to-fit t |
|
t |
|
233 |
;; I see no reason ever to make this nil -- rms. |
;; I see no reason ever to make this nil -- rms. |
234 |
;; (> baud-rate search-slow-speed) |
;; (> baud-rate search-slow-speed) |
235 |
"Non-nil means Dired shrinks the display buffer to fit the marked files.") |
"Non-nil means Dired shrinks the display buffer to fit the marked files.") |
240 |
|
|
241 |
;;;###autoload |
;;;###autoload |
242 |
(defvar dired-directory nil |
(defvar dired-directory nil |
243 |
"The directory name or wildcard spec that this Dired directory lists. |
"The directory name or wildcard spec that this dired directory lists. |
244 |
Local to each dired buffer. May be a list, in which case the car is the |
Local to each dired buffer. May be a list, in which case the car is the |
245 |
directory name and the cdr is the list of files to mention. |
directory name and the cdr is the list of files to mention. |
246 |
The directory name must be absolute, but need not be fully expanded.") |
The directory name must be absolute, but need not be fully expanded.") |
294 |
Subexpression 2 must end right before the \\n or \\r.") |
Subexpression 2 must end right before the \\n or \\r.") |
295 |
|
|
296 |
(defgroup dired-faces nil |
(defgroup dired-faces nil |
297 |
"Faces used by dired." |
"Faces used by Dired." |
298 |
:group 'dired |
:group 'dired |
299 |
:group 'faces) |
:group 'faces) |
300 |
|
|
597 |
You can move around in it with the usual commands. |
You can move around in it with the usual commands. |
598 |
You can flag files for deletion with \\[dired-flag-file-deletion] and then |
You can flag files for deletion with \\[dired-flag-file-deletion] and then |
599 |
delete them by typing \\[dired-do-flagged-delete]. |
delete them by typing \\[dired-do-flagged-delete]. |
600 |
Type \\[describe-mode] after entering dired for more info. |
Type \\[describe-mode] after entering Dired for more info. |
601 |
|
|
602 |
If DIRNAME is already in a dired buffer, that buffer is used without refresh." |
If DIRNAME is already in a dired buffer, that buffer is used without refresh." |
603 |
;; Cannot use (interactive "D") because of wildcards. |
;; Cannot use (interactive "D") because of wildcards. |
910 |
(move-to-column curcol) |
(move-to-column curcol) |
911 |
(when (looking-at |
(when (looking-at |
912 |
(concat |
(concat |
913 |
(if (eq (char-before) ?\ ) " *" "[^ ]* *") |
(if (eq (char-before) ?\s) " *" "[^ ]* *") |
914 |
(if num-align "[0-9][^ ]*"))) |
(if num-align "[0-9][^ ]*"))) |
915 |
(- (match-end 0) (match-beginning 0))))) |
(- (match-end 0) (match-beginning 0))))) |
916 |
;; Now, the number of spaces to insert is align-pt-offset |
;; Now, the number of spaces to insert is align-pt-offset |
1019 |
|
|
1020 |
(defun dired-revert (&optional arg noconfirm) |
(defun dired-revert (&optional arg noconfirm) |
1021 |
"Reread the dired buffer. |
"Reread the dired buffer. |
1022 |
Must also be called after dired-actual-switches have changed. |
Must also be called after `dired-actual-switches' have changed. |
1023 |
Should not fail even on completely garbaged buffers. |
Should not fail even on completely garbaged buffers. |
1024 |
Preserves old cursor, marks/flags, hidden-p." |
Preserves old cursor, marks/flags, hidden-p." |
1025 |
(widen) ; just in case user narrowed |
(widen) ; just in case user narrowed |
1499 |
Type \\[dired-maybe-insert-subdir] to Insert a subdirectory in this buffer. |
Type \\[dired-maybe-insert-subdir] to Insert a subdirectory in this buffer. |
1500 |
Type \\[dired-do-rename] to Rename a file or move the marked files to another directory. |
Type \\[dired-do-rename] to Rename a file or move the marked files to another directory. |
1501 |
Type \\[dired-do-copy] to Copy files. |
Type \\[dired-do-copy] to Copy files. |
1502 |
Type \\[dired-sort-toggle-or-edit] to toggle sorting by name/date or change the `ls' switches. |
Type \\[dired-sort-toggle-or-edit] to toggle Sorting by name/date or change the `ls' switches. |
1503 |
Type \\[revert-buffer] to read all currently expanded directories again. |
Type \\[revert-buffer] to read all currently expanded directories aGain. |
1504 |
This retains all marks and hides subdirs again that were hidden before. |
This retains all marks and hides subdirs again that were hidden before. |
1505 |
SPC and DEL can be used to move down and up by lines. |
SPC and DEL can be used to move down and up by lines. |
1506 |
|
|
1507 |
If dired ever gets confused, you can either type \\[revert-buffer] \ |
If Dired ever gets confused, you can either type \\[revert-buffer] \ |
1508 |
to read the |
to read the |
1509 |
directories again, type \\[dired-do-redisplay] \ |
directories again, type \\[dired-do-redisplay] \ |
1510 |
to relist a single or the marked files or a |
to relist a single or the marked files or a |
1574 |
;; Idiosyncratic dired commands that don't deal with marks. |
;; Idiosyncratic dired commands that don't deal with marks. |
1575 |
|
|
1576 |
(defun dired-summary () |
(defun dired-summary () |
1577 |
"Summarize basic Dired commands and show recent Dired errors." |
"Summarize basic Dired commands and show recent dired errors." |
1578 |
(interactive) |
(interactive) |
1579 |
(dired-why) |
(dired-why) |
1580 |
;>> this should check the key-bindings and use substitute-command-keys if non-standard |
;>> this should check the key-bindings and use substitute-command-keys if non-standard |
1589 |
(let (buffer-read-only) |
(let (buffer-read-only) |
1590 |
(undo)) |
(undo)) |
1591 |
(dired-build-subdir-alist) |
(dired-build-subdir-alist) |
1592 |
(message "Change in Dired buffer undone. |
(message "Change in dired buffer undone. |
1593 |
Actual changes in files cannot be undone by Emacs.")) |
Actual changes in files cannot be undone by Emacs.")) |
1594 |
|
|
1595 |
(defun dired-next-line (arg) |
(defun dired-next-line (arg) |
1653 |
file-name |
file-name |
1654 |
(if (file-symlink-p file-name) |
(if (file-symlink-p file-name) |
1655 |
(error "File is a symlink to a nonexistent target") |
(error "File is a symlink to a nonexistent target") |
1656 |
(error "File no longer exists; type `g' to update Dired buffer"))))) |
(error "File no longer exists; type `g' to update dired buffer"))))) |
1657 |
|
|
1658 |
;; Force `f' rather than `e' in the mode doc: |
;; Force `f' rather than `e' in the mode doc: |
1659 |
(defalias 'dired-advertised-find-file 'dired-find-file) |
(defalias 'dired-advertised-find-file 'dired-find-file) |
1695 |
(find-file-other-window (file-name-sans-versions file t))))) |
(find-file-other-window (file-name-sans-versions file t))))) |
1696 |
|
|
1697 |
(defun dired-view-file () |
(defun dired-view-file () |
1698 |
"In Dired, examine a file in view mode, returning to dired when done. |
"In Dired, examine a file in view mode, returning to Dired when done. |
1699 |
When file is a directory, show it in this buffer if it is inserted. |
When file is a directory, show it in this buffer if it is inserted. |
1700 |
Otherwise, display it in another buffer." |
Otherwise, display it in another buffer." |
1701 |
(interactive) |
(interactive) |
1975 |
"Copy names of marked (or next ARG) files into the kill ring. |
"Copy names of marked (or next ARG) files into the kill ring. |
1976 |
The names are separated by a space. |
The names are separated by a space. |
1977 |
With a zero prefix arg, use the absolute file name of each marked file. |
With a zero prefix arg, use the absolute file name of each marked file. |
1978 |
With \\[universal-argument], use the file name relative to the Dired buffer's |
With \\[universal-argument], use the file name relative to the dired buffer's |
1979 |
`default-directory'. (This still may contain slashes if in a subdirectory.) |
`default-directory'. (This still may contain slashes if in a subdirectory.) |
1980 |
|
|
1981 |
If on a subdir headerline, use absolute subdirname instead; |
If on a subdir headerline, use absolute subdirname instead; |
2360 |
(defun dired-delete-file (file &optional recursive) "\ |
(defun dired-delete-file (file &optional recursive) "\ |
2361 |
Delete FILE or directory (possibly recursively if optional RECURSIVE is true.) |
Delete FILE or directory (possibly recursively if optional RECURSIVE is true.) |
2362 |
RECURSIVE determines what to do with a non-empty directory. If RECURSIVE is: |
RECURSIVE determines what to do with a non-empty directory. If RECURSIVE is: |
2363 |
Nil, do not delete. |
nil, do not delete. |
2364 |
`always', delete recursively without asking. |
`always', delete recursively without asking. |
2365 |
`top', ask for each directory at top level. |
`top', ask for each directory at top level. |
2366 |
Anything else, ask for each sub-directory." |
Anything else, ask for each sub-directory." |
2553 |
))) |
))) |
2554 |
|
|
2555 |
(defvar dired-no-confirm nil |
(defvar dired-no-confirm nil |
2556 |
"A list of symbols for commands dired should not confirm. |
"A list of symbols for commands Dired should not confirm. |
2557 |
Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress', |
Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress', |
2558 |
`copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink', |
`copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink', |
2559 |
`touch' and `uncompress'.") |
`touch' and `uncompress'.") |
2890 |
"Flag all backup files (names ending with `~') for deletion. |
"Flag all backup files (names ending with `~') for deletion. |
2891 |
With prefix argument, unflag these files." |
With prefix argument, unflag these files." |
2892 |
(interactive "P") |
(interactive "P") |
2893 |
(let ((dired-marker-char (if unflag-p ?\ dired-del-marker))) |
(let ((dired-marker-char (if unflag-p ?\s dired-del-marker))) |
2894 |
(dired-mark-if |
(dired-mark-if |
2895 |
;; Don't call backup-file-name-p unless the last character looks like |
;; Don't call backup-file-name-p unless the last character looks like |
2896 |
;; it might be the end of a backup file name. This isn't very general, |
;; it might be the end of a backup file name. This isn't very general, |
2924 |
(save-excursion |
(save-excursion |
2925 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2926 |
(while (search-forward string nil t) |
(while (search-forward string nil t) |
2927 |
(if (if (= old ?\ ) |
(if (if (= old ?\s) |
2928 |
(save-match-data |
(save-match-data |
2929 |
(dired-get-filename 'no-dir t)) |
(dired-get-filename 'no-dir t)) |
2930 |
t) |
t) |
2932 |
(match-end 0) old new))))))) |
(match-end 0) old new))))))) |
2933 |
|
|
2934 |
(defun dired-unmark-all-marks () |
(defun dired-unmark-all-marks () |
2935 |
"Remove all marks from all files in the Dired buffer." |
"Remove all marks from all files in the dired buffer." |
2936 |
(interactive) |
(interactive) |
2937 |
(dired-unmark-all-files ?\r)) |
(dired-unmark-all-files ?\r)) |
2938 |
|
|
2960 |
(dired-query 'query "Unmark file `%s'? " |
(dired-query 'query "Unmark file `%s'? " |
2961 |
file)))) |
file)))) |
2962 |
(progn (subst-char-in-region (1- (point)) (point) |
(progn (subst-char-in-region (1- (point)) (point) |
2963 |
(preceding-char) ?\ ) |
(preceding-char) ?\s) |
2964 |
(setq count (1+ count))))) |
(setq count (1+ count))))) |
2965 |
(message (if (= count 1) "1 mark removed" |
(message (if (= count 1) "1 mark removed" |
2966 |
"%d marks removed") |
"%d marks removed") |
3047 |
(defvar dired-sort-by-date-regexp |
(defvar dired-sort-by-date-regexp |
3048 |
(concat "^-[^" dired-ls-sorting-switches |
(concat "^-[^" dired-ls-sorting-switches |
3049 |
"]*t[^" dired-ls-sorting-switches "]*$") |
"]*t[^" dired-ls-sorting-switches "]*$") |
3050 |
"Regexp recognized by dired to set `by date' mode.") |
"Regexp recognized by Dired to set `by date' mode.") |
3051 |
|
|
3052 |
(defvar dired-sort-by-name-regexp |
(defvar dired-sort-by-name-regexp |
3053 |
(concat "^-[^t" dired-ls-sorting-switches "]+$") |
(concat "^-[^t" dired-ls-sorting-switches "]+$") |
3054 |
"Regexp recognized by dired to set `by name' mode.") |
"Regexp recognized by Dired to set `by name' mode.") |
3055 |
|
|
3056 |
(defvar dired-sort-inhibit nil |
(defvar dired-sort-inhibit nil |
3057 |
"Non-nil means the Dired sort command is disabled. |
"Non-nil means the Dired sort command is disabled. |
3058 |
The idea is to set this buffer-locally in special Dired buffers.") |
The idea is to set this buffer-locally in special dired buffers.") |
3059 |
|
|
3060 |
(defun dired-sort-set-modeline () |
(defun dired-sort-set-modeline () |
3061 |
;; Set modeline display according to dired-actual-switches. |
;; Set modeline display according to dired-actual-switches. |
3077 |
With a prefix argument you can edit the current listing switches instead." |
With a prefix argument you can edit the current listing switches instead." |
3078 |
(interactive "P") |
(interactive "P") |
3079 |
(when dired-sort-inhibit |
(when dired-sort-inhibit |
3080 |
(error "Cannot sort this Dired buffer")) |
(error "Cannot sort this dired buffer")) |
3081 |
(if arg |
(if arg |
3082 |
(dired-sort-other |
(dired-sort-other |
3083 |
(read-string "ls switches (must contain -l): " dired-actual-switches)) |
(read-string "ls switches (must contain -l): " dired-actual-switches)) |
3120 |
(concat result (substring string start)))) |
(concat result (substring string start)))) |
3121 |
|
|
3122 |
(defun dired-sort-other (switches &optional no-revert) |
(defun dired-sort-other (switches &optional no-revert) |
3123 |
"Specify new ls SWITCHES for current dired buffer. |
"Specify new `ls' SWITCHES for current dired buffer. |
3124 |
Values matching `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' |
Values matching `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' |
3125 |
set the minor mode accordingly, others appear literally in the mode line. |
set the minor mode accordingly, others appear literally in the mode line. |
3126 |
With optional second arg NO-REVERT, don't refresh the listing afterwards." |
With optional second arg NO-REVERT, don't refresh the listing afterwards." |