Fix warnings about unrecognized keys without helm or ivy layers
In perspective transient state. b and l keys in the docstring have no corresponding functions declared whenever both helm and ivy layers are not used. Add two private variables to fix the issue: - spacemacs--persp-display-buffers-func - spacemacs--persp-display-perspectives-func These variables are set to the correct functions by the helm and ivy layers via a use-package hook. Default is `ignore` function so b and l does nothing if both helm and ivy layers are not used, TODO: we should find a better default function.
This commit is contained in:
parent
dc58801c7d
commit
3bce69aba1
|
@ -709,10 +709,13 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
|
|||
;; Restore popwin-mode after a Helm session finishes.
|
||||
(add-hook 'helm-cleanup-hook #'spacemacs//helm-restore-display))
|
||||
|
||||
(defun helm/pre-init-persp-mode ()
|
||||
(spacemacs|use-package-add-hook persp-mode
|
||||
:post-config
|
||||
(setq
|
||||
spacemacs--persp-display-buffers-func 'spacemacs/persp-helm-mini
|
||||
spacemacs--persp-display-perspectives-func 'spacemacs/helm-perspectives)))
|
||||
|
||||
(defun helm/post-init-projectile ()
|
||||
(setq projectile-completion-system 'helm))
|
||||
|
||||
(defun helm/post-init-persp-mode ()
|
||||
(spacemacs/transient-state-register-add-bindings 'layouts
|
||||
'(("b" spacemacs/persp-helm-mini :exit t)
|
||||
("l" spacemacs/helm-perspectives :exit t))))
|
||||
|
|
|
@ -214,6 +214,13 @@
|
|||
(use-package ivy-hydra)
|
||||
(define-key hydra-ivy/keymap [escape] 'hydra-ivy/keyboard-escape-quit-and-exit))
|
||||
|
||||
(defun ivy/pre-init-persp-mode ()
|
||||
(spacemacs|use-package-add-hook presp-mode
|
||||
:post-config
|
||||
(setq
|
||||
spacemacs--persp-display-buffers-func 'spacemacs/ivy-spacemacs-layout-buffer
|
||||
spacemacs--persp-display-perspectives-func 'spacemacs/ivy-spacemacs-layouts)))
|
||||
|
||||
(defun ivy/post-init-persp-mode ()
|
||||
;; based on https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-ivy-el
|
||||
(add-hook 'ivy-ignore-buffers #'spacemacs//layout-not-contains-buffer-p)
|
||||
|
@ -230,12 +237,12 @@
|
|||
'spacemacs/ivy-spacemacs-layouts
|
||||
'(("c" persp-kill-without-buffers "Close layout(s)")
|
||||
("k" persp-kill "Kill layout(s)")))
|
||||
;; TODO: better handling of C and X bindings for ivy
|
||||
;; check ivy/pre-init-persp-mode
|
||||
(spacemacs/transient-state-register-remove-bindings 'layouts
|
||||
'("C" "X"))
|
||||
(spacemacs/transient-state-register-add-bindings 'layouts
|
||||
'(("b" spacemacs/ivy-spacemacs-layout-buffer :exit t)
|
||||
("l" spacemacs/ivy-spacemacs-layouts :exit t)
|
||||
("C" spacemacs/ivy-spacemacs-layout-close-other :exit t)
|
||||
'(("C" spacemacs/ivy-spacemacs-layout-close-other :exit t)
|
||||
("X" spacemacs/ivy-spacemacs-layout-kill-other :exit t))))
|
||||
|
||||
(defun ivy/post-init-projectile ()
|
||||
|
|
|
@ -59,6 +59,20 @@ Cancels autosave on exiting perspectives mode."
|
|||
|
||||
;; Persp transient-state
|
||||
|
||||
(defvar spacemacs--persp-display-buffers-func 'ignore
|
||||
"Function to display buffers in the prespective.")
|
||||
(defun spacemacs/presp-buffers ()
|
||||
"Call the function defined in `spacemacs--persp-display-buffers-func'"
|
||||
(interactive)
|
||||
(call-interactively spacemacs--persp-display-buffers-func))
|
||||
|
||||
(defvar spacemacs--persp-display-perspectives-func 'ignore
|
||||
"Function to display perspectives.")
|
||||
(defun spacemacs/presp-buffers ()
|
||||
"Call the function defined in `spacemacs--persp-display-perspectives-func'"
|
||||
(interactive)
|
||||
(call-interactively spacemacs--persp-display-perspectives-func))
|
||||
|
||||
(defun spacemacs//layouts-ts-toggle-hint ()
|
||||
"Toggle the full hint docstring for the layouts transient-state."
|
||||
(interactive)
|
||||
|
|
|
@ -188,10 +188,12 @@
|
|||
("C-l" persp-next)
|
||||
("a" persp-add-buffer :exit t)
|
||||
("A" persp-import-buffers :exit t)
|
||||
("b" spacemacs/presp-buffers :exit t)
|
||||
("d" spacemacs/layouts-ts-close)
|
||||
("D" spacemacs/layouts-ts-close-other :exit t)
|
||||
("h" spacemacs/layout-goto-default :exit t)
|
||||
("L" persp-load-state-from-file :exit t)
|
||||
("l" spacemacs/presp-perspectives :exit t)
|
||||
("n" persp-next)
|
||||
("N" persp-prev)
|
||||
("o" spacemacs/select-custom-layout :exit t)
|
||||
|
|
Loading…
Reference in New Issue