summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-18 02:01:17 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-18 02:01:17 -0500
commit5e6daf4ea6009bc6990bc83e55a103812bebe1ab (patch)
tree952185bb4a5ed7259c1ccd864ae88a8b8a039ded /lisp
parent547d77fbd47b320122e35008aa700bd4a45a5bb0 (diff)
downloademacs.d-5e6daf4ea6009bc6990bc83e55a103812bebe1ab.tar.gz
Add command org-open-link-directory
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-org.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el
index 1fe0c65..6a52eaa 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -268,6 +268,15 @@ called through the speed command interface."
(save-excursion
(call-interactively #'org-open-at-point)))
+(defun km/org-open-link-directory ()
+ "Open Dired for directory of file link at point."
+ (interactive)
+ (let ((el (org-element-lineage (org-element-context) '(link) t)))
+ (unless (and el (equal (org-element-property :type el) "file"))
+ (user-error "Not on file link"))
+ (dired (file-name-directory
+ (org-element-property :path el)))))
+
(after 'org
(define-key org-mode-map (kbd "C-c C-x B")
'km/org-tree-to-indirect-buffer-current-window)
@@ -298,11 +307,13 @@ called through the speed command interface."
(define-prefix-command 'km/org-prefix-map)
(define-key km/org-prefix-map "c" 'km/org-clone-and-shift-by-repeater)
-(define-key km/org-prefix-map "d" 'km/org-delete-checked-items)
+(define-key km/org-prefix-map "d" 'km/org-open-link-directory)
+(define-key km/org-prefix-map "D" 'km/org-delete-checked-items)
(define-key km/org-prefix-map "l" 'km/org-remove-title-leader)
(define-key km/org-prefix-map "n" 'km/org-normalize-spaces)
(define-key km/org-prefix-map "s" 'km/org-sort-parent)
+
(define-prefix-command 'km/global-org-map)
(global-set-key (kbd "C-c o") 'km/global-org-map)