* lisp/dired-aux.el: Cleanup whitespace and comments.
* lisp/dired-x.el: Cleanup whitespace and comments.
* lisp/dired.el: Cleanup whitespace and comments.
%s
-(Press ^ to %s markers below these occurrences.)
+\(Press ^ to %s markers below these occurrences.)
"
"`"
(string (aref command (car char-positions)))
The backup file is the first file given to `diff'.
With prefix arg, prompt for argument SWITCHES which is options for `diff'."
(interactive
- (if current-prefix-arg
- (list (read-string "Options for diff: "
- (if (stringp diff-switches)
- diff-switches
- (mapconcat #'identity diff-switches " "))))
- nil))
+ (if current-prefix-arg
+ (list (read-string "Options for diff: "
+ (if (stringp diff-switches)
+ diff-switches
+ (mapconcat #'identity diff-switches " "))))
+ nil))
(diff-backup (dired-get-filename) switches))
;;;###autoload
(dired-run-shell-command (dired-shell-stuff-it command file-list nil))))
(defun dired-mark-read-string (prompt initial op-symbol arg files
- &optional default-value collection)
+ &optional default-value collection)
"Read args for a Dired marked-files command, prompting with PROMPT.
Return the user input (a string).
`dired-guess-shell-alist-default' and
`dired-guess-shell-alist-user' are consulted when the user is
prompted for the shell command to use interactively."
-;;Functions dired-run-shell-command and dired-shell-stuff-it do the
-;;actual work and can be redefined for customization.
+ ;; Functions dired-run-shell-command and dired-shell-stuff-it do the
+ ;; actual work and can be redefined for customization.
(interactive
(let ((files (dired-get-marked-files t current-prefix-arg nil nil t)))
(list
"Separates marked files in dired shell commands.")
(defun dired-shell-stuff-it (command file-list on-each &optional _raw-arg)
-;; "Make up a shell command line from COMMAND and FILE-LIST.
-;; If ON-EACH is t, COMMAND should be applied to each file, else
-;; simply concat all files and apply COMMAND to this.
-;; FILE-LIST's elements will be quoted for the shell."
-;; Might be redefined for smarter things and could then use RAW-ARG
-;; (coming from interactive P and currently ignored) to decide what to do.
-;; Smart would be a way to access basename or extension of file names.
+ ;; "Make up a shell command line from COMMAND and FILE-LIST.
+ ;; If ON-EACH is t, COMMAND should be applied to each file, else
+ ;; simply concat all files and apply COMMAND to this.
+ ;; FILE-LIST's elements will be quoted for the shell."
+ ;; Might be redefined for smarter things and could then use RAW-ARG
+ ;; (coming from interactive P and currently ignored) to decide what to do.
+ ;; Smart would be a way to access basename or extension of file names.
(let* ((in-background (string-match "[ \t]*&[ \t]*\\'" command))
(command (if in-background
(substring command 0 (match-beginning 0))
(dired-mark-prompt arg files) "? ")))))
(defun dired-map-over-marks-check (fun arg op-symbol &optional show-progress)
-; "Map FUN over marked files (with second ARG like in dired-map-over-marks)
-; and display failures.
+ ;; "Map FUN over marked files (with second ARG like in dired-map-over-marks)
+ ;; and display failures.
-; FUN takes zero args. It returns non-nil (the offending object, e.g.
-; the short form of the filename) for a failure and probably logs a
-; detailed error explanation using function `dired-log'.
+ ;; FUN takes zero args. It returns non-nil (the offending object, e.g.
+ ;; the short form of the filename) for a failure and probably logs a
+ ;; detailed error explanation using function `dired-log'.
-; OP-SYMBOL is a symbol describing the operation performed (e.g.
-; `compress'). It is used with `dired-mark-pop-up' to prompt the user
-; (e.g. with `Compress * [2 files]? ') and to display errors (e.g.
-; `Failed to compress 1 of 2 files - type W to see why ("foo")')
+ ;; OP-SYMBOL is a symbol describing the operation performed (e.g.
+ ;; `compress'). It is used with `dired-mark-pop-up' to prompt the user
+ ;; (e.g. with `Compress * [2 files]? ') and to display errors (e.g.
+ ;; `Failed to compress 1 of 2 files - type W to see why ("foo")')
-; SHOW-PROGRESS if non-nil means redisplay dired after each file."
+ ;; SHOW-PROGRESS if non-nil means redisplay dired after each file."
(if (dired-mark-confirm op-symbol arg)
(let* ((total-list;; all of FUN's return values
(dired-map-over-marks (funcall fun) arg show-progress))
;; Return nil for success, offending file name else.
(let ((file (dired-get-filename)) failure)
(condition-case err
- (load file nil nil t)
+ (load file nil nil t)
(error (setq failure err)))
(if (not failure)
nil
(forward-line 1)
(while (and (not (eolp)) ; don't cross subdir boundary
(not (dired-move-to-filename)))
- (forward-line 1))
+ (forward-line 1))
(point)))
;;;###autoload
For relative symlinks, use \\[dired-do-relsymlink]."
(interactive "P")
(dired-do-create-files 'symlink #'make-symbolic-link
- "Symlink" arg dired-keep-marker-symlink))
+ "Symlink" arg dired-keep-marker-symlink))
;;;###autoload
(defun dired-do-hardlink (&optional arg)
`dired-dwim-target', which see."
(interactive "P")
(dired-do-create-files 'hardlink #'dired-hardlink
- "Hardlink" arg dired-keep-marker-hardlink))
+ "Hardlink" arg dired-keep-marker-hardlink))
(defun dired-hardlink (file newname &optional ok-if-already-exists)
(dired-handle-overwrite newname)
(defvar rename-regexp-query)
(defun dired-do-create-files-regexp
- (file-creator operation arg regexp newname &optional whole-name marker-char)
+ (file-creator operation arg regexp newname &optional whole-name marker-char)
;; Create a new file for each marked file using regexps.
;; FILE-CREATOR and OPERATION as in dired-create-files.
;; ARG as in dired-get-marked-files.
(defvar rename-non-directory-query)
(defun dired-create-files-non-directory
- (file-creator basename-constructor operation arg)
+ (file-creator basename-constructor operation arg)
;; Perform FILE-CREATOR on the non-directory part of marked files
;; using function BASENAME-CONSTRUCTOR, with query for each file.
;; OPERATION like in dired-create-files, ARG as in dired-get-marked-files.
(and (looking-at "^ wildcard ")
(buffer-substring (match-end 0)
(line-end-position))))))
- (if wildcard
+ (if wildcard
(setq dirname (expand-file-name wildcard default-directory))))
;; If raw ls listing (not a saved old dired buffer), give it a
;; decent subdir headerline:
;;; GUESS SHELL COMMAND.
;; Brief Description:
-;;;
+;;
;; * `dired-do-shell-command' is bound to `!' by dired.el.
-;;;
+;;
;; * `dired-guess-shell-command' provides smarter defaults for
-;;; dired-aux.el's `dired-read-shell-command'.
-;;;
+;; dired-aux.el's `dired-read-shell-command'.
+;;
;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
-;;; marked files.
-;;;
+;; marked files.
+;;
;; * Parse `dired-guess-shell-alist-user' and
-;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP
-;;; that matches the first file in the file list.
-;;;
+;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP
+;; that matches the first file in the file list.
+;;
;; * If the REGEXP matches all the entries of the file list then evaluate
-;;; COMMAND, which is either a string or a Lisp expression returning a
-;;; string. COMMAND may be a list of commands.
-;;;
+;; COMMAND, which is either a string or a Lisp expression returning a
+;; string. COMMAND may be a list of commands.
+;;
;; * Return this command to `dired-guess-shell-command' which prompts user
-;;; with it. The list of commands is put into the list of default values.
-;;; If a command is used successfully then it is stored permanently in
-;;; `dired-shell-command-history'.
+;; with it. The list of commands is put into the list of default values.
+;; If a command is used successfully then it is stored permanently in
+;; `dired-shell-command-history'.
;; Guess what shell command to apply to a file.
(defvar dired-shell-command-history nil
;;;###autoload
(defun dired-do-relsymlink (&optional arg)
- "Relative symlink all marked (or next ARG) files into a directory.
+ "Relative symlink all marked (or next ARG) files into a directory.
Otherwise make a relative symbolic link to the current file.
This creates relative symbolic links like
For absolute symlinks, use \\[dired-do-symlink]."
(interactive "P")
(dired-do-create-files 'relsymlink #'dired-make-relative-symlink
- "RelSymLink" arg dired-keep-marker-relsymlink))
+ "RelSymLink" arg dired-keep-marker-relsymlink))
(autoload 'dired-mark-read-regexp "dired-aux")
(autoload 'dired-do-create-files-regexp "dired-aux")
;;; VISIT ALL MARKED FILES SIMULTANEOUSLY.
;; Brief Description:
-;;;
+;;
;; `dired-do-find-marked-files' is bound to `F' by dired-x.el.
-;;;
+;;
;; * Use `dired-get-marked-files' to collect the marked files in the current
-;;; Dired Buffer into a list of filenames `FILE-LIST'.
-;;;
+;; Dired Buffer into a list of filenames `FILE-LIST'.
+;;
;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with
-;;; `dired-do-find-marked-files''s prefix argument NOSELECT.
-;;;
+;; `dired-do-find-marked-files''s prefix argument NOSELECT.
+;;
;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the
-;;; list each time.
-;;;
+;; list each time.
+;;
;; * If NOSELECT is non-nil then just run `find-file-noselect' on each
-;;; element of FILE-LIST.
-;;;
+;; element of FILE-LIST.
+;;
;; * If NOSELECT is nil then calculate the `size' of the window for each file
-;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is
-;;; cognizant of the window-configuration.
-;;;
+;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is
+;; cognizant of the window-configuration.
+;;
;; * If `size' is too small abort, otherwise run `find-file' on each element
-;;; of FILE-LIST giving each a window of height `size'.
+;; of FILE-LIST giving each a window of height `size'.
(defun dired-do-find-marked-files (&optional noselect)
"Find all marked files displaying all of them simultaneously.
(defun dired-man ()
"Run `man' on this file."
-;; Used also to say: "Display old buffer if buffer name matches filename."
-;; but I have no idea what that means.
+ ;; Used also to say: "Display old buffer if buffer name matches filename."
+ ;; but I have no idea what that means.
(interactive)
(require 'man)
(let* ((file (dired-get-filename))
:prefix "dired-"
:group 'dired)
-
;;;###autoload
(defcustom dired-listing-switches (purecopy "-al")
"Switches passed to `ls' for Dired. MUST contain the `l' option.
(defcustom dired-subdir-switches nil
"If non-nil, switches passed to `ls' for inserting subdirectories.
If nil, `dired-listing-switches' is used."
- :group 'dired
- :type '(choice (const :tag "Use dired-listing-switches" nil)
- (string :tag "Switches")))
+ :group 'dired
+ :type '(choice (const :tag "Use dired-listing-switches" nil)
+ (string :tag "Switches")))
(defcustom dired-maybe-use-globstar nil
"If non-nil, enable globstar if the shell supports it.
(defcustom dired-touch-program "touch"
"Name of touch command (usually `touch')."
- :group 'dired
- :type 'file)
+ :group 'dired
+ :type 'file)
(defcustom dired-ls-F-marks-symlinks nil
"Informs Dired about how `ls -lF' marks symbolic links.
function. When the value is a function, it will be called with no
arguments and is expected to return a list of directories which will
be used as defaults (i.e. default target and \"future history\")
-(though, `dired-dwim-target-defaults' might modify it a bit).
+\(though, `dired-dwim-target-defaults' might modify it a bit).
The value t prefers the next windows on the same frame.
The target is used in the prompt for file copy, rename etc."
This is similar to the \"-L\" option for the \"cp\" shell command."
:type 'boolean
:group 'dired)
- ;
-; These variables were deleted and the replacements are on files.el.
-; We leave aliases behind for back-compatibility.
+
+;; These variables were deleted and the replacements are on files.el.
+;; We leave aliases behind for back-compatibility.
(define-obsolete-variable-alias 'dired-free-space-program
'directory-free-space-program "27.1")
(define-obsolete-variable-alias 'dired-free-space-args
"Character used to flag files for deletion.")
(defvar dired-shrink-to-fit t
-;; I see no reason ever to make this nil -- rms.
-;; (> baud-rate search-slow-speed)
+ ;; I see no reason ever to make this nil -- rms.
+ ;; (> baud-rate search-slow-speed)
"Non-nil means Dired shrinks the display buffer to fit the marked files.")
(make-obsolete-variable 'dired-shrink-to-fit
"use the Customization interface to add a new rule
"[bcsp][^:]"))
(defvar dired-re-exe;; match ls permission string of an executable file
(mapconcat (lambda (x)
- (concat dired-re-maybe-mark dired-re-inode-size x))
+ (concat dired-re-maybe-mark dired-re-inode-size x))
'("-[-r][-w][xs][-r][-w].[-r][-w]."
"-[-r][-w].[-r][-w][xs][-r][-w]."
"-[-r][-w].[-r][-w].[-r][-w][xst]")
;;
;; Directory headers.
(list dired-subdir-regexp '(1 dired-header-face))
-)
+ )
"Additional expressions to highlight in Dired mode.")
(defvar dnd-protocol-alist)
;; No need to do this, now that top-level items are fewer.
;;;;
;; Get rid of the Edit menu bar item to save space.
- ;(define-key map [menu-bar edit] 'undefined)
+ ;;(define-key map [menu-bar edit] 'undefined)
map)
"Local keymap for Dired mode buffers.")
"Summarize basic Dired commands and show recent Dired errors."
(interactive)
(dired-why)
- ;>> this should check the key-bindings and use substitute-command-keys if non-standard
+ ;; FIXME this should check the key-bindings and use
+ ;; substitute-command-keys if non-standard
(message
"d-elete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, h-elp"))
(concat (dired-current-directory localp) file)))))
(defun dired-string-replace-match (regexp string newtext
- &optional literal global)
+ &optional literal global)
"Replace first match of REGEXP in STRING with NEWTEXT.
If it does not match, nil is returned instead of the new string.
Optional arg LITERAL means to take NEWTEXT literally.
(let ((from-end (- (length string) (match-end 0))))
(setq ret (setq string (replace-match newtext t literal string)))
(setq start (- (length string) from-end))))
- ret)
+ ret)
(if (not (string-match regexp string 0))
nil
(replace-match newtext t literal string))))
(or no-error
(not (eq opoint (point)))
(error "%s" (if hidden
- (substitute-command-keys
- "File line is hidden, type \\[dired-hide-subdir] to unhide")
- "No file on this line")))
+ (substitute-command-keys
+ "File line is hidden, type \\[dired-hide-subdir] to unhide")
+ "No file on this line")))
(if (eq opoint (point))
nil
(point)))))
(substring pattern matched-in-pattern))
"\\'")))
-
-
(defun dired-advertise ()
;;"Advertise in variable `dired-buffers' that we dired `default-directory'."
;; With wildcards we actually advertise too much.
(beginning-of-line) ; alist stores b-o-l positions
(and (zerop (- (point)
(cdr (assoc cur-dir
- dired-subdir-alist))))
- cur-dir))))
+ dired-subdir-alist))))
+ cur-dir))))
(define-obsolete-function-alias 'dired-get-subdir-min 'cdr "27.1")
new-dir-name)
(setq new-dir-name res)))
(dired-alist-add-1 new-dir-name
- ;; Place a sub directory boundary between lines.
- (save-excursion
- (goto-char (match-beginning 0))
- (beginning-of-line)
- (point-marker)))))
+ ;; Place a sub directory boundary between lines.
+ (save-excursion
+ (goto-char (match-beginning 0))
+ (beginning-of-line)
+ (point-marker)))))
(if (and (> count 1) (called-interactively-p 'interactive))
(message "Buffer includes %d directories" count)))
;; We don't need to sort it because it is in buffer order per
(defun dired-fun-in-all-buffers (directory file fun &rest args)
"In all buffers dired'ing DIRECTORY, run FUN with ARGS.
If the buffer has a wildcard pattern, check that it matches FILE.
-(FILE does not include a directory component.)
+\(FILE does not include a directory component.)
FILE may be nil, in which case ignore it.
Return list of buffers where FUN succeeded (i.e., returned non-nil)."
(let (success-list)
(with-temp-buffer
(insert-file-contents fn)
(goto-char (point-min))
- (re-search-forward regexp nil t))))
- )))
+ (re-search-forward regexp nil t)))))))
"matching file")))
(defun dired-flag-files-regexp (regexp)
(desktop-file-name dired-directory dirname))
;; Subdirectories in `dired-subdir-alist'.
(cdr
- (nreverse
- (mapcar
- (lambda (f) (desktop-file-name (car f) dirname))
- dired-subdir-alist)))))
+ (nreverse
+ (mapcar
+ (lambda (f) (desktop-file-name (car f) dirname))
+ dired-subdir-alist)))))
(defun dired-restore-desktop-buffer (_file-name
_buffer-name