From 7f284e98b633eed15830e08ca71da28c3aa65667 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 21 Jul 2018 01:20:05 +0200 Subject: [PATCH] Fix helm-M-x help popup not properly closing On successive TAB presses on a command --- modules/ui/popup/+hacks.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/ui/popup/+hacks.el b/modules/ui/popup/+hacks.el index 6aa30cded..b8d1a4333 100644 --- a/modules/ui/popup/+hacks.el +++ b/modules/ui/popup/+hacks.el @@ -170,7 +170,16 @@ the command buffer." ;; `helm' (after! helm (setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window)) - (set-popup-rule! "^\\*helm" :ignore t)) + (set-popup-rule! "^\\*helm" :ignore t) + + ;; Fix left-over popup window when closing persistent help for `helm-M-x' + (defun +popup*helm-elisp--persistent-help (candidate fun &optional name) + (let (win) + (when (and (helm-attr 'help-running-p) + (string= candidate (helm-attr 'help-current-symbol)) + (setq win (get-buffer-window (get-buffer (help-buffer))))) + (delete-window win)))) + (advice-add #'helm-elisp--persistent-help :before #'+popup*helm-elisp--persistent-help)) ;; `helm-ag'