diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-06-12 01:18:39 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-06-12 01:18:39 -0400 |
commit | b98a78b34ae3d0686ebf2c9581db77c43314fc82 (patch) | |
tree | 6c44a42472455e6e5afdac3de947b68354d7029d /lisp | |
parent | 8021030ed8f723778b230ee09a4e8f89ca1fbf13 (diff) | |
download | emacs.d-b98a78b34ae3d0686ebf2c9581db77c43314fc82.tar.gz |
project-filename-at-point: Support Org links
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-projectile.el | 9 |
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. |