branch: master commit 557024f975550130542ab55031a0c2083fb4c1ea Merge: b772a0c 4086298 Author: Alexey Veretennikov <txm.four...@gmail.com> Commit: Alexey Veretennikov <txm.four...@gmail.com>
Merge pull request #6 from jpkotta/master 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 d321d16..64edaed 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)