branch: master
commit 40862989b66a589025eb2cfc4e52f30570a58a54
Author: Jonathan Kotta <[email protected]>
Commit: Jonathan Kotta <[email protected]>
add ztree-find-file as the action for ztree-dir
---
ztree-dir.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/ztree-dir.el b/ztree-dir.el
index 5d67b64..29939b0 100644
--- a/ztree-dir.el
+++ b/ztree-dir.el
@@ -89,6 +89,16 @@ including . and ..")
(not (string-match ztree-hidden-files-regexp
(file-short-name filename))))
+(defun ztree-find-file (node hard)
+ "Finds the file at NODE.
+
+If HARD is non-nil, the file is opened in another window.
+Otherwise, the ztree window is used to find the file."
+ (when (and (stringp node) (file-readable-p node))
+ (if hard
+ (save-selected-window (find-file-other-window node))
+ (find-file node))))
+
;;;###autoload
(defun ztree-dir (path)
"Creates an interactive buffer with the directory tree of the path given"
@@ -104,7 +114,7 @@ including . and ..")
'string-equal
'(lambda (x) (directory-files x 'full))
nil ; face
- nil)))) ; action
+ 'ztree-find-file)))) ; action
(provide 'ztree-dir)