branch: master commit 9de243f06906cb3e824c2bbe3d75fd1f3661c5e3 Author: Alexey Veretennikov <txm.four...@gmail.com> Commit: Alexey Veretennikov <txm.four...@gmail.com>
Issue #17: added variable ztree-dir-move-focus; if set move the focus to opened editor window when press Enter --- ztree-dir.el | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ztree-dir.el b/ztree-dir.el index 7506b84..d52aef1 100644 --- a/ztree-dir.el +++ b/ztree-dir.el @@ -54,6 +54,14 @@ "Hidden files regexp. By default all filest starting with dot '.', including . and ..") +;; +;; Configurable variables +;; + +(defvar ztree-dir-move-focus nil + "If set to true moves the focus to opened window when the +user press RETURN on file ")t + ;; ;; Faces @@ -92,9 +100,12 @@ By default all filest starting with dot '.', including . and ..") 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)))) + (cond ((and hard ztree-dir-move-focus) + (find-file-other-window node)) + (hard + (save-selected-window (find-file-other-window node))) + (t + (find-file node))))) ;;;###autoload (defun ztree-dir (path)