branch: externals/ztree commit 3273e1f84f9cded3794a6bf94dade8172fc4a251 Author: Alexey Veretennikov <alexey.veretenni...@gmail.com> Commit: Alexey Veretennikov <alexey.veretenni...@gmail.com>
Issue #60: ztree-dir change Emacs default directory Now callind ztree-dir and its widen/narrow operations will change the default directory, the same way as Dired does. --- ztree-dir.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ztree-dir.el b/ztree-dir.el index 5421ef0..5369269 100644 --- a/ztree-dir.el +++ b/ztree-dir.el @@ -155,6 +155,12 @@ Otherwise, the ztree window is used to find the file." (directory-files path 'full))) +(defun ztree-dir-change-directory (node) + "Change the start node to NODE and update current directory." + (ztree-change-start-node node) + (setq default-directory node)) + + (defun ztree-dir-narrow-to-dir () "Interactive command to narrow the current directory buffer. The buffer is narrowed to the directory under the cursor. @@ -164,9 +170,9 @@ If the cursor is on a file, the buffer is narrowed to the parent directory." (node (ztree-find-node-in-line line)) (parent (ztree-get-parent-for-line line))) (if (file-directory-p node) - (ztree-change-start-node node) + (ztree-dir-change-directory node) (when parent - (ztree-change-start-node (ztree-find-node-in-line parent)))))) + (ztree-dir-change-directory (ztree-find-node-in-line parent)))))) (defun ztree-dir-widen-to-parent () @@ -178,7 +184,7 @@ up of the opened." (let* ((node ztree-start-node) (parent (file-name-directory (directory-file-name node)))) (when parent - (ztree-change-start-node parent)))) + (ztree-dir-change-directory parent)))) (defun ztree-dir-open-dired-at-point ()