Set popwin:special-display-config to nil and let us manage it from scratch. Doing so, we avoid popwin to mess up windows of some package i.e. SLIME. Similar to how auto-completion layer is managed, if a layer want to have popwin support, it must be explicitly specified in that layer. The default popwin:special-display-config contains obsolete config such as anything (predecessor of Helm) and buffer that should be stick around until we press C-g (like shell command output since we may need the output for doing something else). We don't need to use popwin:display-buffer since it can still mess up window configuration, like this issue #1409. Simply add helm buffers to display-buffer-alist, and use display-buffer-in-side-window; without any argument, the default is bottom. We also inhibit Helm buffers to reuse the existing windows with (inhibit-same-window . t) and a window height (window-height . 0.4). Also prevent popwin from piling up display-buffer-alist since everytime it is reactivated, it adds its own buffers that already existed in display-buffer-alist, by restoring display-buffer-alist after popwin-mode is enabled again.
This commit is contained in:
parent
858bb7a733
commit
a740923dd9
|
@ -1376,22 +1376,36 @@ If ARG is non nil then `ag' and `pt' and ignored."
|
||||||
(unless (configuration-layer/package-usedp 'smex)
|
(unless (configuration-layer/package-usedp 'smex)
|
||||||
(evil-leader/set-key dotspacemacs-command-key 'helm-M-x))))
|
(evil-leader/set-key dotspacemacs-command-key 'helm-M-x))))
|
||||||
|
|
||||||
;; disable popwin-mode in an active Helm session It should be disabled
|
(defvar spacemacs-helm-display-buffer-regexp `(,(rx bos "*helm" (* not-newline) "*" eos)
|
||||||
;; otherwise it will conflict with other window opened by Helm persistent
|
(display-buffer-in-side-window)
|
||||||
;; action, such as *Help* window.
|
(inhibit-same-window . t)
|
||||||
(when (configuration-layer/package-usedp 'popwin)
|
(window-height . 0.4)))
|
||||||
(push '("^\*helm.+\*$" :regexp t) popwin:special-display-config))
|
(defvar spacemacs-display-buffer-alist nil)
|
||||||
|
|
||||||
(defun spacemacs//display-helm-at-bottom ()
|
(defun spacemacs//display-helm-at-bottom ()
|
||||||
"Display the helm buffer at the bottom of the frame."
|
"Display the helm buffer at the bottom of the frame."
|
||||||
;; avoid Helm buffer being diplaye twice when user
|
;; avoid Helm buffer being diplaye twice when user
|
||||||
;; sets this variable to some function that pop buffer to
|
;; sets this variable to some function that pop buffer to
|
||||||
;; a window. See https://github.com/syl20bnr/spacemacs/issues/1396
|
;; a window. See https://github.com/syl20bnr/spacemacs/issues/1396
|
||||||
(let ((display-buffer-base-action '(nil)))
|
(let ((display-buffer-base-action '(nil)))
|
||||||
(popwin:display-buffer helm-buffer t)
|
;; backup old display-buffer-base-action
|
||||||
|
(setq spacemacs-display-buffer-alist display-buffer-alist)
|
||||||
|
;; the only buffer to display is Helm, nothing else we must set this
|
||||||
|
;; otherwise Helm cannot reuse its own windows for copyinng/deleting
|
||||||
|
;; etc... because of existing popwin buffers in the alist
|
||||||
|
(setq display-buffer-alist (list spacemacs-helm-display-buffer-regexp))
|
||||||
(popwin-mode -1)))
|
(popwin-mode -1)))
|
||||||
|
|
||||||
|
(defun spacemacs//restore-previous-display-config ()
|
||||||
|
(popwin-mode 1)
|
||||||
|
;; we must enable popwin-mode first then restore `display-buffer-alist'
|
||||||
|
;; Otherwise, popwin keeps adding up its own buffers to `display-buffer-alist'
|
||||||
|
;; and could slow down Emacs as the list grows
|
||||||
|
(setq display-buffer-alist spacemacs-display-buffer-alist))
|
||||||
|
|
||||||
(add-hook 'helm-after-initialize-hook 'spacemacs//display-helm-at-bottom)
|
(add-hook 'helm-after-initialize-hook 'spacemacs//display-helm-at-bottom)
|
||||||
;; Restore popwin-mode after a Helm session finishes.
|
;; Restore popwin-mode after a Helm session finishes.
|
||||||
(add-hook 'helm-cleanup-hook 'popwin-mode)
|
(add-hook 'helm-cleanup-hook 'spacemacs//restore-previous-display-config)
|
||||||
|
|
||||||
;; Add minibuffer history with `helm-minibuffer-history'
|
;; Add minibuffer history with `helm-minibuffer-history'
|
||||||
(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
|
(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
|
||||||
|
@ -2109,10 +2123,21 @@ Put (global-hungry-delete-mode) in dotspacemacs/config to enable by default."
|
||||||
(popwin-mode 1)
|
(popwin-mode 1)
|
||||||
(evil-leader/set-key "wpm" 'popwin:messages)
|
(evil-leader/set-key "wpm" 'popwin:messages)
|
||||||
(evil-leader/set-key "wpp" 'popwin:close-popup-window)
|
(evil-leader/set-key "wpp" 'popwin:close-popup-window)
|
||||||
(push '("*ert*" :dedicated t :position bottom :stick t :noselect t) popwin:special-display-config)
|
|
||||||
(push '("*grep*" :dedicated t :position bottom :stick t :noselect t) popwin:special-display-config)
|
;; don't use default value but manage it ourselves
|
||||||
(push '("*nosetests*" :dedicated t :position bottom :stick t :noselect t) popwin:special-display-config)
|
(setq popwin:special-display-config nil)
|
||||||
(push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config)
|
|
||||||
|
;; buffers that we manage
|
||||||
|
(push '("*Help*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
|
||||||
|
(push '("*compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
|
||||||
|
(push '("*Shell Command Output*" :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config)
|
||||||
|
(push '("*Async Shell Command*" :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config)
|
||||||
|
(push '(" *undo-tree*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
|
||||||
|
(push '("*ert*" :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config)
|
||||||
|
(push '("*grep*" :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config)
|
||||||
|
(push '("*nosetests*" :dedicated t :position bottom :stick t :noselect t ) popwin:special-display-config)
|
||||||
|
(push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config)
|
||||||
|
|
||||||
(defun spacemacs/remove-popwin-display-config (str)
|
(defun spacemacs/remove-popwin-display-config (str)
|
||||||
"Removes the popwin display configurations that matches the passed STR"
|
"Removes the popwin display configurations that matches the passed STR"
|
||||||
(setq popwin:special-display-config
|
(setq popwin:special-display-config
|
||||||
|
|
Loading…
Reference in a new issue