From 1183480906cf1f7d78888fa8d53b5c221e585462 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Tue, 27 Feb 2018 00:34:45 +0000 Subject: [PATCH] Advice helm to automatically hide and show neotree --- modules/siren-helm.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/siren-helm.el b/modules/siren-helm.el index 72a915f..9b56422 100644 --- a/modules/siren-helm.el +++ b/modules/siren-helm.el @@ -18,6 +18,8 @@ helm-file-name-case-fold-search 'smart helm-split-window-default-side 'below) + (setq siren-helm--did-hide-neotree nil) + ;; From: https://www.reddit.com/r/emacs/comments/3asbyn/new_and_very_useful_helm_feature_enter_search/ (defun siren-helm--hide-minibuffer-maybe () (when (with-helm-buffer helm-echo-input-in-header-line) @@ -55,6 +57,23 @@ (add-hook 'helm-cleanup-hook #'siren-helm--popwin-help-mode-on) + (defun siren-helm--hide-neotree (&rest plist) + (when (and (fboundp 'neotree-hide) + (fboundp 'neo-global--window-exists-p) + (neo-global--window-exists-p)) + (setq siren-helm--did-hide-neotree t) + (neotree-hide))) + + (advice-add 'helm :before 'siren-helm--hide-neotree) + + (defun siren-helm--show-neotree-maybe () + (when (and (fboundp 'neotree-show) + siren-helm--did-hide-neotree) + (setq siren-helm--did-hide-neotree nil) + (run-with-timer 0.01 nil #'neotree-show))) + + (add-hook 'helm-cleanup-hook #'siren-helm--show-neotree-maybe)) + (use-package helm-descbinds :defer t)