(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,
(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)))
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)
(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"))))))
;; 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.
(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]")
(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))
(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.
(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