From 762e7868031cf8a90fb81217c4b877b0d178d4d4 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 13 May 2014 20:38:44 -0400 Subject: km/org-open-dired-file: Handle marked files --- lisp/init-dired.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/init-dired.el b/lisp/init-dired.el index 9c52a36..63f5a98 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -48,12 +48,16 @@ ;; This overrides the binding for `list-directory'. (global-set-key (kbd "C-x C-d") 'km/dired-switch-to-buffer) -(defun km/org-open-dired-file () +(defun km/org-open-dired-marked-files () (interactive) - (org-open-file (dired-get-filename))) + (let* ((files (dired-get-marked-files)) + (num-files (length files))) + (when (or (< num-files 5) + (yes-or-no-p (format "Open %s files?" num-files))) + (-each files 'org-open-file)))) (eval-after-load 'org ;; This overrides `dired-find-file', which is also bound to "f". - '(define-key dired-mode-map "e" 'km/org-open-dired-file)) + '(define-key dired-mode-map "e" 'km/org-open-dired-marked-files)) (provide 'init-dired) -- cgit v1.2.3