summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-11-16 23:43:50 -0500
committerKyle Meyer <kyle@kyleam.com>2015-11-16 23:43:50 -0500
commit3eda2253d80322640be4ec0381194d4f387e6cc9 (patch)
tree1c460822c04e0a7be3a9779e511671976664f3ad /lisp
parent0a0ba646409e2abc98ea674ab60b44f2c3e59029 (diff)
downloademacs.d-3eda2253d80322640be4ec0381194d4f387e6cc9.tar.gz
project-filename-at-point: Support Dired
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-projectile.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/init-projectile.el b/lisp/init-projectile.el
index 67f37da..2ed383b 100644
--- a/lisp/init-projectile.el
+++ b/lisp/init-projectile.el
@@ -52,14 +52,21 @@ Interactive arguments are processed according to
(view-mode 1))
(defun km/project-filename-at-point ()
- "Return file name relative to `projectile-project-root'."
+ "Return file name relative to `projectile-project-root'.
+In the case of multiple files marked in Dired, return the file
+names separated by a space."
(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))
+ (and (derived-mode-p 'dired-mode)
+ (dired-get-marked-files 'nodir nil))
(thing-at-point 'filename))))
(when fname
- (file-relative-name fname (projectile-project-root)))))
+ (mapconcat
+ `(lambda (f) (file-relative-name f ,(projectile-project-root)))
+ (if (listp fname) fname (list fname))
+ " "))))
(defun km/projectile-copy-project-filename-as-kill ()
"Copy name of project file.