From: Tino Calancha Date: Mon, 26 Jun 2017 05:22:27 +0000 (+0900) Subject: Don't quote lambda forms X-Git-Tag: emacs-26.0.90~521^2~11^2~41 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cb5d6e0260e8937acea511d9e824df1868cd1249;p=emacs.git Don't quote lambda forms * 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. --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index ec07f9bf735..21c8e78f2bb 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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. diff --git a/lisp/dired.el b/lisp/dired.el index 909735a3b54..5a4e95d5f3b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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