From: Tino Calancha Date: Mon, 26 Jun 2017 05:22:34 +0000 (+0900) Subject: Use #' instead of (function ...) X-Git-Tag: emacs-26.0.90~521^2~11^2~40 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6dd0462f5a67e8306eb8681cd02668810ce93a96;p=emacs.git Use #' instead of (function ...) * lisp/dired-aux.el (dired-do-chxxx, dired-clean-directory) (dired-mark-confirm, dired-query, dired-byte-compile) (dired-load, dired-update-file-line, dired-after-subdir-garbage) (dired-relist-file, dired-rename-subdir, dired-do-create-files) (dired-mark-read-file-name, dired-do-copy, dired-do-symlink) (dired-do-hardlink, dired-do-rename, dired-do-rename-regexp) (dired-do-copy-regexp, dired-do-hardlink-regexp) (dired-do-symlink-regexp, dired-create-files-non-directory) (dired-upcase, dired-downcase) * lisp/dired.el (dired-mode, dired-copy-filename-as-kill) (dired-internal-do-deletions, dired-internal-do-deletions): Prefer #' instead of (function ...). --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 21c8e78f2bb..aede83e61cc 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -308,7 +308,7 @@ List has a form of (file-name full-file-name (attribute-list))." failures) (setq failures (dired-bunch-files 10000 - (function dired-check-process) + #'dired-check-process (append (list operation program) (unless (or (string-equal new-attribute "") @@ -512,7 +512,7 @@ with a prefix argument." ;; If the file has numeric backup versions, ;; put on dired-file-version-alist an element of the form ;; (FILENAME . VERSION-NUMBER-LIST) - (dired-map-dired-file-lines (function dired-collect-file-versions)) + (dired-map-dired-file-lines #'dired-collect-file-versions) ;; Sort each VERSION-NUMBER-LIST, ;; and remove the versions not to be deleted. (let ((fval dired-file-version-alist)) @@ -528,7 +528,7 @@ with a prefix argument." (setq fval (cdr fval)))) ;; Look at each file. If it is a numeric backup file, ;; find it in a VERSION-NUMBER-LIST and maybe flag it for deletion. - (dired-map-dired-file-lines (function dired-trample-file-versions)) + (dired-map-dired-file-lines #'dired-trample-file-versions) (message "Cleaning numerical backups...done"))) ;;; Subroutines of dired-clean-directory. @@ -722,9 +722,9 @@ can be produced by `dired-get-marked-files', for example." (if on-each (dired-bunch-files (- 10000 (length command)) - (function (lambda (&rest files) - (dired-run-shell-command - (dired-shell-stuff-it command files t arg)))) + (lambda (&rest files) + (dired-run-shell-command + (dired-shell-stuff-it command files t arg))) nil file-list) ;; execute the shell command @@ -1122,7 +1122,7 @@ Return nil if no change in files." (let ((files (dired-get-marked-files t arg nil t)) (string (if (eq op-symbol 'compress) "Compress or uncompress" (capitalize (symbol-name op-symbol))))) - (dired-mark-pop-up nil op-symbol files (function y-or-n-p) + (dired-mark-pop-up nil op-symbol files #'y-or-n-p (concat string " " (dired-mark-prompt arg files) "? "))))) @@ -1190,7 +1190,7 @@ return t; if SYM is q or ESC, return nil." (defun dired-do-compress (&optional arg) "Compress or uncompress marked (or next ARG) files." (interactive "P") - (dired-map-over-marks-check (function dired-compress) arg 'compress t)) + (dired-map-over-marks-check #'dired-compress arg 'compress t)) ;; Commands for Emacs Lisp files - load and byte compile @@ -1218,7 +1218,7 @@ return t; if SYM is q or ESC, return nil." (defun dired-do-byte-compile (&optional arg) "Byte compile marked (or next ARG) Emacs Lisp files." (interactive "P") - (dired-map-over-marks-check (function dired-byte-compile) arg 'byte-compile t)) + (dired-map-over-marks-check #'dired-byte-compile arg 'byte-compile t)) (defun dired-load () ;; Return nil for success, offending file name else. @@ -1235,7 +1235,7 @@ return t; if SYM is q or ESC, return nil." (defun dired-do-load (&optional arg) "Load the marked (or next ARG) Emacs Lisp files." (interactive "P") - (dired-map-over-marks-check (function dired-load) arg 'load t)) + (dired-map-over-marks-check #'dired-load arg 'load t)) ;;;###autoload (defun dired-do-redisplay (&optional arg test-for-subdir) @@ -1308,7 +1308,7 @@ See Info node `(emacs)Subdir switches' for more details." (defun dired-add-file (filename &optional marker-char) (dired-fun-in-all-buffers (file-name-directory filename) (file-name-nondirectory filename) - (function dired-add-entry) filename marker-char)) + #'dired-add-entry filename marker-char)) (defvar dired-omit-mode) (declare-function dired-omit-regexp "dired-x" ()) @@ -1445,7 +1445,7 @@ files matching `dired-omit-regexp'." (defun dired-remove-file (file) (dired-fun-in-all-buffers (file-name-directory file) (file-name-nondirectory file) - (function dired-remove-entry) file)) + #'dired-remove-entry file)) (defun dired-remove-entry (file) (save-excursion @@ -1459,7 +1459,7 @@ files matching `dired-omit-regexp'." "Create or update the line for FILE in all Dired buffers it would belong in." (dired-fun-in-all-buffers (file-name-directory file) (file-name-nondirectory file) - (function dired-relist-entry) file)) + #'dired-relist-entry file)) (defun dired-relist-entry (file) ;; Relist the line for FILE, or just add it if it did not exist. @@ -1553,7 +1553,7 @@ Special value `always' suppresses confirmation." (setq from-dir (file-name-as-directory from-dir) to-dir (file-name-as-directory to-dir)) (dired-fun-in-all-buffers from-dir nil - (function dired-rename-subdir-1) from-dir to-dir) + #'dired-rename-subdir-1 from-dir to-dir) ;; Update visited file name of all affected buffers (let ((expanded-from-dir (expand-file-name from-dir)) (blist (buffer-list))) @@ -1788,7 +1788,7 @@ Optional arg HOW-TO determines how to treat the target. For any other return value, TARGET is treated as a directory." (or op1 (setq op1 operation)) (let* ((fn-list (dired-get-marked-files nil arg)) - (rfn-list (mapcar (function dired-make-relative) fn-list)) + (rfn-list (mapcar #'dired-make-relative fn-list)) (dired-one-file ; fluid variable inside dired-create-files (and (consp fn-list) (null (cdr fn-list)) (car fn-list))) (target-dir (dired-dwim-target-directory)) @@ -1856,7 +1856,7 @@ Optional arg HOW-TO determines how to treat the target. &optional default) (dired-mark-pop-up nil op-symbol files - (function read-file-name) + #'read-file-name (format prompt (dired-mark-prompt arg files)) dir default)) (defun dired-dwim-target-directory () @@ -1984,7 +1984,7 @@ This command copies symbolic links by creating new ones, similar to the \"-d\" option for the \"cp\" shell command." (interactive "P") (let ((dired-recursive-copies dired-recursive-copies)) - (dired-do-create-files 'copy (function dired-copy-file) + (dired-do-create-files 'copy #'dired-copy-file "Copy" arg dired-keep-marker-copy nil dired-copy-how-to-fn))) @@ -2001,7 +2001,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 (function make-symbolic-link) + (dired-do-create-files 'symlink #'make-symbolic-link "Symlink" arg dired-keep-marker-symlink)) ;;;###autoload @@ -2014,7 +2014,7 @@ with the same names that the files currently have. The default suggested for the target directory depends on the value of `dired-dwim-target', which see." (interactive "P") - (dired-do-create-files 'hardlink (function dired-hardlink) + (dired-do-create-files 'hardlink #'dired-hardlink "Hardlink" arg dired-keep-marker-hardlink)) (defun dired-hardlink (file newname &optional ok-if-already-exists) @@ -2033,7 +2033,7 @@ This command also renames any buffers that are visiting the files. The default suggested for the target directory depends on the value of `dired-dwim-target', which see." (interactive "P") - (dired-do-create-files 'move (function dired-rename-file) + (dired-do-create-files 'move #'dired-rename-file "Move" arg dired-keep-marker-rename "Rename")) ;;;###end dired-cp.el @@ -2127,7 +2127,7 @@ With a zero prefix arg, renaming by regexp affects the absolute file name. Normally, only the non-directory part of the file name is used and changed." (interactive (dired-mark-read-regexp "Rename")) (dired-do-create-files-regexp - (function dired-rename-file) + #'dired-rename-file "Rename" arg regexp newname whole-name dired-keep-marker-rename)) ;;;###autoload @@ -2137,7 +2137,7 @@ See function `dired-do-rename-regexp' for more info." (interactive (dired-mark-read-regexp "Copy")) (let ((dired-recursive-copies nil)) ; No recursive copies. (dired-do-create-files-regexp - (function dired-copy-file) + #'dired-copy-file (if dired-copy-preserve-time "Copy [-p]" "Copy") arg regexp newname whole-name dired-keep-marker-copy))) @@ -2147,7 +2147,7 @@ See function `dired-do-rename-regexp' for more info." See function `dired-do-rename-regexp' for more info." (interactive (dired-mark-read-regexp "HardLink")) (dired-do-create-files-regexp - (function add-name-to-file) + #'add-name-to-file "HardLink" arg regexp newname whole-name dired-keep-marker-hardlink)) ;;;###autoload @@ -2156,7 +2156,7 @@ See function `dired-do-rename-regexp' for more info." See function `dired-do-rename-regexp' for more info." (interactive (dired-mark-read-regexp "SymLink")) (dired-do-create-files-regexp - (function make-symbolic-link) + #'make-symbolic-link "SymLink" arg regexp newname whole-name dired-keep-marker-symlink)) (defvar rename-non-directory-query) @@ -2189,20 +2189,20 @@ Type SPC or `y' to %s one file, DEL or `n' to skip to next, (defun dired-rename-non-directory (basename-constructor operation arg) (dired-create-files-non-directory - (function dired-rename-file) + #'dired-rename-file basename-constructor operation arg)) ;;;###autoload (defun dired-upcase (&optional arg) "Rename all marked (or next ARG) files to upper case." (interactive "P") - (dired-rename-non-directory (function upcase) "Rename upcase" arg)) + (dired-rename-non-directory #'upcase "Rename upcase" arg)) ;;;###autoload (defun dired-downcase (&optional arg) "Rename all marked (or next ARG) files to lower case." (interactive "P") - (dired-rename-non-directory (function downcase) "Rename downcase" arg)) + (dired-rename-non-directory #'downcase "Rename downcase" arg)) ;;;###end dired-re.el diff --git a/lisp/dired.el b/lisp/dired.el index 5a4e95d5f3b..0c1f3e4af64 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1994,8 +1994,8 @@ Keybindings: ;; Ignore dired-hide-details-* value of invisible text property by default. (when (eq buffer-invisibility-spec t) (setq buffer-invisibility-spec (list t))) - (setq-local revert-buffer-function (function dired-revert)) - (setq-local buffer-stale-function (function dired-buffer-stale-p)) + (setq-local revert-buffer-function #'dired-revert) + (setq-local buffer-stale-function #'dired-buffer-stale-p) (setq-local page-delimiter "\n\n") (setq-local dired-directory (or dirname default-directory)) ;; list-buffers uses this to display the dir being edited in this buffer. @@ -2468,7 +2468,7 @@ You can then feed the file name(s) to other commands with \\[yank]." (interactive "P") (let ((string (or (dired-get-subdir) - (mapconcat (function identity) + (mapconcat #'identity (if arg (cond ((zerop (prefix-numeric-value arg)) (dired-get-marked-files)) @@ -2970,12 +2970,12 @@ non-empty directories is allowed." ;; lines still to be changed, so the (point) values in L stay valid. ;; Also, for subdirs in natural order, a subdir's files are deleted ;; before the subdir itself - the other way around would not work. - (let* ((files (mapcar (function car) l)) + (let* ((files (mapcar #'car l)) (count (length l)) (succ 0) (trashing (and trash delete-by-moving-to-trash))) ;; canonicalize file list for pop up - (setq files (nreverse (mapcar (function dired-make-relative) files))) + (setq files (nreverse (mapcar #'dired-make-relative files))) (if (dired-mark-pop-up " *Deletions*" 'delete files dired-deletion-confirmer (format "%s %s " @@ -2998,7 +2998,7 @@ non-empty directories is allowed." (progress-reporter-update progress-reporter succ) (dired-fun-in-all-buffers (file-name-directory fn) (file-name-nondirectory fn) - (function dired-delete-entry) fn)) + #'dired-delete-entry fn)) (error ;; catch errors from failed deletions (dired-log "%s\n" err) (setq failures (cons (car (car l)) failures)))))