summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-06-12 01:18:39 -0400
committerKyle Meyer <kyle@kyleam.com>2015-06-12 01:18:39 -0400
commitb98a78b34ae3d0686ebf2c9581db77c43314fc82 (patch)
tree6c44a42472455e6e5afdac3de947b68354d7029d /lisp
parent8021030ed8f723778b230ee09a4e8f89ca1fbf13 (diff)
downloademacs.d-b98a78b34ae3d0686ebf2c9581db77c43314fc82.tar.gz
project-filename-at-point: Support Org links
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-projectile.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/init-projectile.el b/lisp/init-projectile.el
index c11a9e9..9c0ecc1 100644
--- a/lisp/init-projectile.el
+++ b/lisp/init-projectile.el
@@ -45,8 +45,13 @@ Interactive arguments are processed according to
(defun km/project-filename-at-point ()
"Return file name relative to `projectile-project-root'."
- (--when-let (thing-at-point 'filename)
- (file-relative-name it (projectile-project-root))))
+ (let* ((el (and (derived-mode-p 'org-mode)
+ (org-element-lineage (org-element-context) '(link) t)))
+ (fname (or (and (eq (org-element-type el) 'link)
+ (org-element-property :path el))
+ (thing-at-point 'filename))))
+ (when fname
+ (file-relative-name fname (projectile-project-root)))))
(defun km/projectile-copy-project-filename-as-kill ()
"Copy name of project file.