core-ui: fix doom-hide-modeline-mode resetting on major-mode changes

This commit is contained in:
Henrik Lissner 2017-04-18 05:00:54 -04:00
parent df65c93572
commit 9e084c18ba
6 changed files with 17 additions and 13 deletions

View file

@ -49,7 +49,7 @@
(add-hook! isearch-mode-end (setq echo-keystrokes 0.02)) (add-hook! isearch-mode-end (setq echo-keystrokes 0.02))
;; A minor mode for toggling the mode-line ;; A minor mode for toggling the mode-line
(defvar doom--hidden-modeline-format nil (defvar doom--modeline-format nil
"The modeline format to use when `doom-hide-modeline-mode' is active. Don't "The modeline format to use when `doom-hide-modeline-mode' is active. Don't
set this directly. Bind it in `let' instead.") set this directly. Bind it in `let' instead.")
(defvar-local doom--old-modeline-format nil (defvar-local doom--old-modeline-format nil
@ -61,14 +61,25 @@ disabled.")
:global nil :global nil
(if doom-hide-modeline-mode (if doom-hide-modeline-mode
(setq doom--old-modeline-format mode-line-format (setq doom--old-modeline-format mode-line-format
mode-line-format doom--hidden-modeline-format) mode-line-format doom--modeline-format)
(setq mode-line-format doom--old-modeline-format (setq mode-line-format doom--old-modeline-format
doom--mode-line nil)) doom--old-modeline-format nil))
(force-mode-line-update)) (force-mode-line-update))
;; Ensure major-mode or theme changes don't overwrite these variables ;; Ensure major-mode or theme changes don't overwrite these variables
(put 'doom--old-modeline-format 'permanent-local t) (put 'doom--old-modeline-format 'permanent-local t)
(put 'doom-hide-modeline-mode 'permanent-local t) (put 'doom-hide-modeline-mode 'permanent-local t)
(defun doom|hide-modeline-mode-reset ()
"Sometimes, a major-mode is activated after `doom-hide-modeline-mode' is
activated, thus disabling it (because changing major modes invokes
`kill-all-local-variables' and specifically seems to kill `mode-line-format's
local value, whether or not it's permanent-local. Therefore, we cycle
`doom-hide-modeline-mode' to fix this."
(when doom-hide-modeline-mode
(doom-hide-modeline-mode -1)
(doom-hide-modeline-mode +1)))
(add-hook 'after-change-major-mode-hook 'doom|hide-modeline-mode-reset)
;; undo/redo changes to Emacs' window layout ;; undo/redo changes to Emacs' window layout
(defvar winner-dont-bind-my-keys t) ; I'll bind keys myself (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself
(require 'winner) (require 'winner)

View file

@ -16,9 +16,8 @@
twittering-initial-timeline-spec-string twittering-initial-timeline-spec-string
'(":home" ":mentions" ":direct_messages")) '(":home" ":mentions" ":direct_messages"))
(set! :popup "*twittering-edit*" :size 12 :select t :modeline nil) (set! :popup "*twittering-edit*" :size 12 :select t)
(add-hook 'twittering-edit-mode-hook #'doom-hide-modeline-mode)
(after! doom-themes (after! doom-themes
(add-hook 'twittering-mode-hook #'doom-buffer-mode)) (add-hook 'twittering-mode-hook #'doom-buffer-mode))

View file

@ -90,7 +90,7 @@ invokes the repl. Takes the same arguements as `rtog/add-repl'."
(add-hook 'quickrun/mode-hook #'linum-mode) (add-hook 'quickrun/mode-hook #'linum-mode)
:config :config
(set! :popup "*quickrun*" :size 10) (set! :popup "*quickrun*" :size 10 :noesc t :autokill t :autoclose t)
;; don't auto-focus quickrun windows. Shackle handles that for us. ;; don't auto-focus quickrun windows. Shackle handles that for us.
(setq quickrun-focus-p nil) (setq quickrun-focus-p nil)

View file

@ -3,8 +3,6 @@
(def-package! processing-mode (def-package! processing-mode
:commands (processing-mode processing-find-sketch) :commands (processing-mode processing-find-sketch)
:mode "\\.pde$" :mode "\\.pde$"
:init
(add-hook 'processing-compilation-mode-hook #'doom-hide-modeline-mode)
:config :config
(set! :build 'build-sketch 'processing-mode #'processing-sketch-build) (set! :build 'build-sketch 'processing-mode #'processing-sketch-build)
(set! :popup "*processing-compilation*" :size 10 :noselect t) (set! :popup "*processing-compilation*" :size 10 :noselect t)

View file

@ -65,8 +65,6 @@ redefines its keys every time `eshell-mode' is enabled."
(add-to-list '+eshell-buffers (current-buffer))) (add-to-list '+eshell-buffers (current-buffer)))
(add-hook 'eshell-mode-hook #'+eshell|init) (add-hook 'eshell-mode-hook #'+eshell|init)
(add-hook 'eshell-mode-hook #'doom-hide-modeline-mode)
(add-hook! eshell-mode (add-hook! eshell-mode
(add-hook 'evil-insert-state-exit-hook #'hl-line-mode nil t) (add-hook 'evil-insert-state-exit-hook #'hl-line-mode nil t)
(add-hook 'evil-insert-state-entry-hook (lambda () (hl-line-mode -1)) nil t)) (add-hook 'evil-insert-state-entry-hook (lambda () (hl-line-mode -1)) nil t))

View file

@ -4,6 +4,4 @@
:commands (multi-term multi-term-next multi-term-prev) :commands (multi-term multi-term-next multi-term-prev)
:config :config
(setq multi-term-program (getenv "SHELL") (setq multi-term-program (getenv "SHELL")
multi-term-switch-after-close nil) multi-term-switch-after-close nil))
(add-hook 'term-mode-hook #'doom-hide-modeline-mode))