]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't quote lambda forms
authorTino Calancha <tino.calancha@gmail.com>
Mon, 26 Jun 2017 05:22:27 +0000 (14:22 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Mon, 26 Jun 2017 05:22:27 +0000 (14:22 +0900)
* lisp/dired.el (dired-re-maybe-mark, dired-map-over-marks)
(dired-mark, dired-desktop-buffer-misc-data)

* lisp/dired-aux.el (dired-do-create-files, dired-do-create-files-regexp)
(dired-create-files-non-directory, dired-insert-subdir-validate)
(dired-alist-sort, dired-do-shell-command): Don't quote lambda forms.

lisp/dired-aux.el
lisp/dired.el

index ec07f9bf7355009f25997e1193ab9a96ccc5d9f2..21c8e78f2bbdc614eee4c922f5b8e022d676f744 100644 (file)
@@ -1838,10 +1838,9 @@ Optional arg HOW-TO determines how to treat the target.
        (if into-dir                    ; target is a directory
           ;; This function uses fluid variable target when called
           ;; inside dired-create-files:
-          (function
-           (lambda (from)
-             (expand-file-name (file-name-nondirectory from) target)))
-        (function (lambda (_from) target)))
+          (lambda (from)
+            (expand-file-name (file-name-nondirectory from) target))
+        (lambda (_from) target))
        marker-char))))
 
 ;; Read arguments for a marked-files command that wants a file name,
@@ -2062,37 +2061,35 @@ Type SPC or `y' to %s one match, DEL or `n' to skip to next,
         (regexp-name-constructor
          ;; Function to construct new filename using REGEXP and NEWNAME:
          (if whole-name                ; easy (but rare) case
-             (function
-              (lambda (from)
-                (let ((to (dired-string-replace-match regexp from newname))
-                      ;; must bind help-form directly around call to
-                      ;; dired-query
-                      (help-form rename-regexp-help-form))
-                  (if to
-                      (and (dired-query 'rename-regexp-query
-                                        operation-prompt
-                                        from
-                                        to)
-                           to)
-                    (dired-log "%s: %s did not match regexp %s\n"
-                               operation from regexp)))))
-           ;; not whole-name, replace non-directory part only
-           (function
-            (lambda (from)
-              (let* ((new (dired-string-replace-match
-                           regexp (file-name-nondirectory from) newname))
-                     (to (and new      ; nil means there was no match
-                              (expand-file-name new
-                                                (file-name-directory from))))
+             (lambda (from)
+               (let ((to (dired-string-replace-match regexp from newname))
+                     ;; must bind help-form directly around call to
+                     ;; dired-query
                      (help-form rename-regexp-help-form))
-                (if to
-                    (and (dired-query 'rename-regexp-query
-                                      operation-prompt
-                                      (dired-make-relative from)
-                                      (dired-make-relative to))
-                         to)
-                  (dired-log "%s: %s did not match regexp %s\n"
-                             operation (file-name-nondirectory from) regexp)))))))
+                 (if to
+                     (and (dired-query 'rename-regexp-query
+                                       operation-prompt
+                                       from
+                                       to)
+                          to)
+                   (dired-log "%s: %s did not match regexp %s\n"
+                              operation from regexp))))
+           ;; not whole-name, replace non-directory part only
+           (lambda (from)
+             (let* ((new (dired-string-replace-match
+                          regexp (file-name-nondirectory from) newname))
+                    (to (and new       ; nil means there was no match
+                             (expand-file-name new
+                                               (file-name-directory from))))
+                    (help-form rename-regexp-help-form))
+               (if to
+                   (and (dired-query 'rename-regexp-query
+                                     operation-prompt
+                                     (dired-make-relative from)
+                                     (dired-make-relative to))
+                        to)
+                 (dired-log "%s: %s did not match regexp %s\n"
+                            operation (file-name-nondirectory from) regexp))))))
         rename-regexp-query)
     (dired-create-files
      file-creator operation fn-list regexp-name-constructor marker-char)))
@@ -2174,21 +2171,20 @@ See function `dired-do-rename-regexp' for more info."
      file-creator
      operation
      (dired-get-marked-files nil arg)
-     (function
-      (lambda (from)
-       (let ((to (concat (file-name-directory from)
-                         (funcall basename-constructor
-                                  (file-name-nondirectory from)))))
-         (and (let ((help-form (format-message "\
+     (lambda (from)
+       (let ((to (concat (file-name-directory from)
+                        (funcall basename-constructor
+                                 (file-name-nondirectory from)))))
+        (and (let ((help-form (format-message "\
 Type SPC or `y' to %s one file, DEL or `n' to skip to next,
 `!' to %s all remaining matches with no more questions."
-                                               (downcase operation)
-                                               (downcase operation))))
-                (dired-query 'rename-non-directory-query
-                             (concat operation " `%s' to `%s'")
-                             (dired-make-relative from)
-                             (dired-make-relative to)))
-              to))))
+                                              (downcase operation)
+                                              (downcase operation))))
+               (dired-query 'rename-non-directory-query
+                            (concat operation " `%s' to `%s'")
+                            (dired-make-relative from)
+                            (dired-make-relative to)))
+             to)))
      dired-keep-marker-rename)))
 
 (defun dired-rename-non-directory (basename-constructor operation arg)
@@ -2316,12 +2312,11 @@ This function takes some pains to conform to `ls -lR' output."
     (when real-switches
       (let (case-fold-search)
        (mapcar
-        (function
-         (lambda (x)
-           (or (eq (null (string-match-p x real-switches))
-                   (null (string-match-p x dired-actual-switches)))
-               (error
-                "Can't have dirs with and without -%s switches together" x))))
+        (lambda (x)
+          (or (eq (null (string-match-p x real-switches))
+                  (null (string-match-p x dired-actual-switches)))
+              (error
+               "Can't have dirs with and without -%s switches together" x)))
         ;; all switches that make a difference to dired-get-filename:
         '("F" "b"))))))
 
@@ -2334,9 +2329,9 @@ This function takes some pains to conform to `ls -lR' output."
   ;; Keep the alist sorted on buffer position.
   (setq dired-subdir-alist
        (sort dired-subdir-alist
-             (function (lambda (elt1 elt2)
-                         (> (dired-get-subdir-min elt1)
-                            (dired-get-subdir-min elt2)))))))
+             (lambda (elt1 elt2)
+               (> (dired-get-subdir-min elt1)
+                  (dired-get-subdir-min elt2))))))
 
 (defun dired-kill-tree (dirname &optional remember-marks kill-root)
   "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
index 909735a3b54e3dbde926b8972651a5af63ad5459..5a4e95d5f3b1684fed91c0598cb3079e68667c78 100644 (file)
@@ -335,9 +335,8 @@ The directory name must be absolute, but need not be fully expanded.")
 (defvar dired-re-dir (concat dired-re-maybe-mark dired-re-inode-size "d[^:]"))
 (defvar dired-re-sym (concat dired-re-maybe-mark dired-re-inode-size "l[^:]"))
 (defvar dired-re-exe;; match ls permission string of an executable file
-  (mapconcat (function
-             (lambda (x)
-               (concat dired-re-maybe-mark dired-re-inode-size x)))
+  (mapconcat (lambda (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]")
@@ -607,9 +606,9 @@ marked file, return (t FILENAME) instead of (FILENAME)."
                 (progn ;; no save-excursion, want to move point.
                   (dired-repeat-over-lines
                    ,arg
-                   (function (lambda ()
-                               (if ,show-progress (sit-for 0))
-                               (setq results (cons ,body results)))))
+                   (lambda ()
+                     (if ,show-progress (sit-for 0))
+                     (setq results (cons ,body results))))
                   (if (< ,arg 0)
                       (nreverse results)
                     results))
@@ -3293,7 +3292,7 @@ this subdir."
     (let ((inhibit-read-only t))
       (dired-repeat-over-lines
        (prefix-numeric-value arg)
-       (function (lambda () (delete-char 1) (insert dired-marker-char))))))))
+       (lambda () (delete-char 1) (insert dired-marker-char)))))))
 
 (defun dired-unmark (arg &optional interactive)
   "Unmark the file at point in the Dired buffer.
@@ -3928,7 +3927,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
    (cdr
      (nreverse
        (mapcar
-         (function (lambda (f) (desktop-file-name (car f) dirname)))
+        (lambda (f) (desktop-file-name (car f) dirname))
          dired-subdir-alist)))))
 
 (defun dired-restore-desktop-buffer (_file-name