I'm trying to hide the modeline whenever helm pops up. I have configure helm to always show up at the bottom. It should look like this (two windows above the helm completion window):
Opposed of the regular way, where modelines from *scratch*
and test.el
buffer are shown like this:
I want to hide the modeline only in the bottom windows so if there are other windows above, their modeline should still be visible like this (three windows above the helm completion window):
I have written the following code to achieve this:
(defun toggle-mode-line ()
"toggles the visibility of modeline in bottom windows"
(interactive)
(dolist (current-window (window-list))
(with-current-buffer (window-buffer current-window)
(unless (window-in-direction 'below current-window)
(setq mode-line-format
(unless mode-line-format
(default-value 'mode-line-format)))))))
Now this has to be called before helm is activated to make the modeline invisible and after helm was activated it has to be called again to make it visible again. So far the following code works for hiding it:
(add-hook 'helm-before-initialize-hook 'helm-toggle-mode-line)
But I couldn't find a way to make it visible again when the completion buffer is gone. This does not work:
(add-hook 'helm-exit-minibuffer-hook 'toggle-mode-line)
And this does not work, too:
(add-hook 'helm-cleanup-hook 'toggle-mode-line)
What's the proper way to achieve this?
EDIT:
The following works if I select a command in the helm completion buffer:
(add-hook 'helm-before-action-hook 'toggle-mode-line)
But I still don't know how to make it visible again when I quit with C-g
or calling helm-keyboard-quit
. I tried this but it dosen't work:
(define-key helm-map (kbd "C-q") 'my-helm-keyboard-quit)
(defun my-helm-keyboard-quit ()
(interactive)
(helm-keyboard-quit)
(message "this and the line below is not called for some reason")
(toggle-mode-line))
helm-buffer
(that is, the completing buffer) by saying "all bottom windows"? I ask this because thehelm-buffer
can be placed in anywhere by using different user configs, not just the bottom.my-helm-keyboard-quit
, code afterhelm-keyboard-quit
didn't work because it had been terminated inhelm-keyboard-quit
, it is like: you are unable to cleanup after you have killed your app.("\`\\*helm.*?\\*\\'" :regexp t :align below :ratio 0.4)