summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-21 22:03:07 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-28 00:29:49 -0500
commitbc45dcdc3065d2d6fc111a390cdeae1f9a4c4a1d (patch)
tree55f273bb73c3d2ef3404c56e67a38583b7372463
parent6b4001dbeea32cae9df7e15efeacc1eac5b4fdee (diff)
downloademacs.d-bc45dcdc3065d2d6fc111a390cdeae1f9a4c4a1d.tar.gz
Pass ARG to dired-get-marked-files
-rw-r--r--lisp/init-dired.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/init-dired.el b/lisp/init-dired.el
index e8bebb8..1de657f 100644
--- a/lisp/init-dired.el
+++ b/lisp/init-dired.el
@@ -50,13 +50,15 @@
(derived-mode-p 'dired-mode))
(buffer-list)))
-(defun km/org-open-dired-marked-files (&optional in-emacs)
- (interactive "P")
- (let* ((files (dired-get-marked-files))
+(defun km/org-open-dired-marked-files (&optional arg)
+ "Open marked files (or next ARG) with `org-open-file'."
+ (interactive "p")
+ (setq arg (and current-prefix-arg arg))
+ (let* ((files (dired-get-marked-files nil arg))
(num-files (length files)))
(when (or (< num-files 5)
(yes-or-no-p (format "Open %s files?" num-files)))
- (--each files (org-open-file it in-emacs)))))
+ (dolist (f files) (org-open-file f)))))
(defun km/dired-view-file-other-window ()
"In Dired, view this file in another window."
@@ -119,22 +121,23 @@ path is always relative to `projectile-project-root'."
(km/dired-copy-filename-relative-to-directory
(projectile-project-root)))
-(defun km/dired-copy-relative-filename-as-kill ()
- "Copy names of marked files into kill ring.
+(defun km/dired-copy-relative-filename-as-kill (&optional arg)
+ "Copy names of marked (or next ARG) files into kill ring.
This is similar to `dired-copy-filename-as-kill', but the leading
path is always relative to the `default-directory' of the other
window."
- (interactive)
+ (interactive "p")
+ (setq arg (and current-prefix-arg arg))
(km/dired-copy-filename-relative-to-directory
- (km/other-default-directory)))
+ (km/other-default-directory) arg))
-(defun km/dired-copy-filename-relative-to-directory (directory)
+(defun km/dired-copy-filename-relative-to-directory (directory &optional arg)
"Like `dired-copy-filename-as-kill', but the filename is always
relative to DIRECTORY."
(let* ((string
- (mapconcat 'identity
- (--map (file-relative-name it directory)
- (dired-get-marked-files t))
+ (mapconcat #'identity
+ (mapcar (lambda (f) (file-relative-name f directory))
+ (dired-get-marked-files t arg))
" ")))
(if (eq last-command 'kill-region)
(kill-append string nil)