emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1b1c4ef 1/4: Cleanup whitespace and comments in dired libraries


From: Jonas Bernoulli
Subject: master 1b1c4ef 1/4: Cleanup whitespace and comments in dired libraries
Date: Wed, 30 Jun 2021 16:25:53 -0400 (EDT)

branch: master
commit 1b1c4ef3cba235a97c424da4bc7ccfafea5b4bf8
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Cleanup whitespace and comments in dired libraries
    
    * lisp/dired-aux.el: Cleanup whitespace and comments.
    * lisp/dired-x.el: Cleanup whitespace and comments.
    * lisp/dired.el: Cleanup whitespace and comments.
---
 lisp/dired-aux.el | 66 +++++++++++++++++++++++++--------------------------
 lisp/dired-x.el   | 68 ++++++++++++++++++++++++++--------------------------
 lisp/dired.el     | 71 ++++++++++++++++++++++++++-----------------------------
 3 files changed, 101 insertions(+), 104 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d002d1f..73bceff 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -135,7 +135,7 @@ substituted, and will be passed through normally to the 
shell.
 
 %s
 
-(Press ^ to %s markers below these occurrences.)
+\(Press ^ to %s markers below these occurrences.)
 "
    "`"
    (string (aref command (car char-positions)))
@@ -288,12 +288,12 @@ If this file is a backup, diff it with its original.
 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
@@ -636,7 +636,7 @@ Uses the shell command coming from variables `lpr-command' 
and
     (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).
 
@@ -871,8 +871,8 @@ can be produced by `dired-get-marked-files', for example.
 `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
@@ -914,13 +914,13 @@ prompted for the shell command to use interactively."
   "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))
@@ -1382,19 +1382,19 @@ see `dired-compress-file-alist' for the supported 
suffixes list."
                                   (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))
@@ -1486,7 +1486,7 @@ uncompress and unpack all the files in the archive."
   ;; 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
@@ -1700,7 +1700,7 @@ files matching `dired-omit-regexp'."
     (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
@@ -2415,7 +2415,7 @@ suggested for the target directory depends on the value of
 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)
@@ -2428,7 +2428,7 @@ suggested for the target directory depends on the value of
 `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)
@@ -2455,7 +2455,7 @@ of `dired-dwim-target', which see."
 (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.
@@ -2575,7 +2575,7 @@ See function `dired-do-rename-regexp' for more info."
 (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.
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 6619a39..38a624f 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -623,7 +623,7 @@ you can relist single subdirs using \\[dired-do-redisplay]."
                     (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:
@@ -723,27 +723,27 @@ Also useful for `auto-mode-alist' like this:
 ;;; 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
@@ -1089,7 +1089,7 @@ results in
 
 ;;;###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
 
@@ -1102,7 +1102,7 @@ not absolute ones 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")
@@ -1120,27 +1120,27 @@ for more info."
 ;;; 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.
@@ -1196,8 +1196,8 @@ NOSELECT the files are merely found but not selected."
 
 (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))
diff --git a/lisp/dired.el b/lisp/dired.el
index bb428e2..1f90371 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -53,7 +53,6 @@
   :prefix "dired-"
   :group 'dired)
 
-
 ;;;###autoload
 (defcustom dired-listing-switches (purecopy "-al")
   "Switches passed to `ls' for Dired.  MUST contain the `l' option.
@@ -78,9 +77,9 @@ some of the `ls' switches are not supported; see the doc 
string of
 (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.
@@ -144,8 +143,8 @@ For more details, see Info node `(emacs)ls in Lisp'."
 
 (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.
@@ -220,7 +219,7 @@ or the most recently used window with a Dired buffer, or to 
use any other
 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."
@@ -247,9 +246,9 @@ 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
@@ -376,8 +375,8 @@ This is what the do-commands look for, and what the 
mark-commands store.")
   "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
@@ -425,7 +424,7 @@ The directory name must be absolute, but need not be fully 
expanded.")
                                  "[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]")
@@ -684,7 +683,7 @@ Subexpression 2 must end right before the \\n.")
    ;;
    ;; Directory headers.
    (list dired-subdir-regexp '(1 dired-header-face))
-)
+   )
   "Additional expressions to highlight in Dired mode.")
 
 (defvar dnd-protocol-alist)
@@ -1969,7 +1968,7 @@ Do so according to the former subdir alist 
OLD-SUBDIR-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.")
@@ -2282,7 +2281,8 @@ Keybindings:
   "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"))
 
@@ -2581,7 +2581,7 @@ Otherwise, an error occurs in these cases."
       (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.
@@ -2592,7 +2592,7 @@ Optional arg GLOBAL means to replace all matches."
          (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))))
@@ -2776,9 +2776,9 @@ If EOL, it should be an position to use instead of
       (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)))))
@@ -2887,8 +2887,6 @@ dired-buffers."
             (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.
@@ -2936,8 +2934,8 @@ dired-buffers."
       (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")
 
@@ -3046,11 +3044,11 @@ instead of `dired-actual-switches'."
                    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
@@ -3378,7 +3376,7 @@ non-empty directories is allowed."
 (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)
@@ -3860,8 +3858,7 @@ since it was last visited."
                  (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)
@@ -4406,10 +4403,10 @@ Ask means pop up a menu for the user to select one of 
copy, move or link."
      (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]