mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-05-10 22:09:43 -07:00
refactor!: backport mode-line-invisible-mode & drop hide-mode-line
BREAKING CHANGE: If you are using the `hide-mode-line` package, use `mode-line-invisible-mode` instead. This mode was introduced in Emacs 31, but has been backported since it is so widely used in Doom (and so we can drop another core dependency). There is no replacement for `global-hide-mode-line`, however. You'll have to install `hide-mode-line` if you were using it.
This commit is contained in:
parent
712db1e7a7
commit
bead7a7748
19 changed files with 53 additions and 38 deletions
|
|
@ -243,5 +243,30 @@ the value of the last one, or nil if there are none."
|
|||
(macroexp-warn-and-return (format-message "`static-unless' with empty body")
|
||||
(list 'progn nil nil) '(empty-body static-unless) t))))
|
||||
|
||||
|
||||
;;; From Emacs 31+
|
||||
(unless (fboundp 'mode-line-invisible-mode)
|
||||
(defvar-local mode-line-invisible--buf-state nil)
|
||||
(define-minor-mode mode-line-invisible-mode
|
||||
"Toggle the mode-line visibility of the current buffer.
|
||||
Hide the mode line if it is shown, and show it if it's hidden."
|
||||
:global nil
|
||||
:group 'mode-line
|
||||
(if mode-line-invisible-mode
|
||||
(progn
|
||||
(add-hook 'after-change-major-mode-hook #'mode-line-invisible-mode nil t)
|
||||
(setq mode-line-invisible--buf-state
|
||||
(buffer-local-set-state mode-line-format nil)))
|
||||
(remove-hook 'after-change-major-mode-hook #'mode-line-invisible-mode t)
|
||||
(when mode-line-invisible--buf-state
|
||||
(setq mode-line-invisible--buf-state
|
||||
(buffer-local-restore-state mode-line-invisible--buf-state)))
|
||||
(unless mode-line-format
|
||||
(setq-local mode-line-format (default-value 'mode-line-format)))
|
||||
(when (called-interactively-p 'any)
|
||||
(force-mode-line-update))))
|
||||
(put 'mode-line-invisible--buf-state 'permanent-local t)
|
||||
(put 'mode-line-invisible-mode 'permanent-local-hook t))
|
||||
|
||||
(provide 'doom-compat)
|
||||
;;; doom-compat.el ends here
|
||||
|
|
|
|||
|
|
@ -557,6 +557,12 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
show-paren-when-point-in-periphery t))
|
||||
|
||||
|
||||
;; Hide the mode line in completion popups and MAN pages because they serve
|
||||
;; little purpose there, and is better hidden.
|
||||
(add-hook 'completion-list-mode-hook #'mode-line-invisible-mode)
|
||||
(add-hook 'Man-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
|
||||
;;
|
||||
;;; Third party packages
|
||||
|
||||
|
|
@ -572,12 +578,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
nerd-icons-pomicon
|
||||
nerd-icons-powerline))
|
||||
|
||||
;; Hide the mode line in completion popups and MAN pages because they serve
|
||||
;; little purpose there, and is better hidden.
|
||||
;;;###package hide-mode-line-mode
|
||||
(add-hook! '(completion-list-mode-hook Man-mode-hook)
|
||||
#'hide-mode-line-mode)
|
||||
|
||||
;;;###package image
|
||||
(setq image-animate-loop t)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
;; doom-ui.el
|
||||
(package! nerd-icons :pin "ae1b85c487c2b0bb1efb8bc0edc23af74282eec2")
|
||||
(package! hide-mode-line :pin "ddd154f1e04d666cd004bf8212ead8684429350d")
|
||||
|
||||
;; doom-editor.el
|
||||
(package! better-jumper :pin "b1bf7a3c8cb820d942a0305e0e6412ef369f819c")
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
:m "C-j" #'calfw-details-navi-next-item-command)))
|
||||
|
||||
(add-hook 'calfw-calendar-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'calfw-calendar-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'calfw-calendar-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
(advice-add #'calfw-render-button :override #'+calendar-calfw-render-button-a))
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
(display-buffer-mark-dedicated 'soft)
|
||||
(win (split-window (get-buffer-window undo-tree-visualizer-parent-buffer))))
|
||||
(with-current-buffer buff
|
||||
(hide-mode-line-mode +1))
|
||||
(mode-line-invisible-mode +1))
|
||||
(set-window-buffer win buff)
|
||||
(shrink-window-if-larger-than-buffer win)))
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ to update the notmuch-saved-searches variable accordingly."
|
|||
(add-hook! '(notmuch-show-mode-hook
|
||||
notmuch-tree-mode-hook
|
||||
notmuch-search-mode-hook)
|
||||
#'hide-mode-line-mode)
|
||||
#'mode-line-invisible-mode)
|
||||
|
||||
(map! :localleader
|
||||
:map (notmuch-hello-mode-map notmuch-search-mode-map notmuch-tree-mode-map notmuch-show-mode-map)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
(setq-local cwm-left-fringe-ratio -10)
|
||||
(setq-local cwm-centered-window-width 300)
|
||||
(centered-window-mode arg))
|
||||
(hide-mode-line-mode arg)
|
||||
(mode-line-invisible-mode arg)
|
||||
(+org-pretty-mode arg)
|
||||
(cond (org-tree-slide-mode
|
||||
(set-window-fringes nil 0 0)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ You should use `set-eshell-alias!' to change this.")
|
|||
(visual-line-mode +1)
|
||||
(set-display-table-slot standard-display-table 0 ?\ )))
|
||||
|
||||
(add-hook 'eshell-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'eshell-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
;; Remove hscroll-margin in shells, otherwise you get jumpiness when the
|
||||
;; cursor comes close to the left/right edges of the window.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
;;; term/shell/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###package shell
|
||||
(add-hook 'shell-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'shell-mode-hook #'mode-line-invisible-mode)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
;;; term/term/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###package term
|
||||
(add-hook 'term-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'term-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
|
||||
;;;###package multi-term
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
(use-package! vterm
|
||||
:when (bound-and-true-p module-file-suffix) ; requires dynamic-modules support
|
||||
:commands vterm-mode
|
||||
:hook (vterm-mode . hide-mode-line-mode) ; modeline serves no purpose in vterm
|
||||
:hook (vterm-mode . mode-line-invisible-mode) ; modeline serves no purpose in vterm
|
||||
:preface
|
||||
;; HACK: Because vterm clusmily forces vterm-module.so's compilation on us
|
||||
;; when the package is loaded, this is necessary to prevent it when
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
(dape--default-cwd)))
|
||||
|
||||
;; Mode-line serves no purpose in REPL window.
|
||||
(add-hook 'dape-repl-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'dape-repl-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
;; Persist breakpoints after closing DAPE.
|
||||
(dape-breakpoint-global-mode +1)
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ FUNCTION
|
|||
|
||||
;; The mode-line isn't useful in these popups and take up valuable screen
|
||||
;; estate, so free it up.
|
||||
(add-hook 'magit-popup-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'magit-popup-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
;; Add additional switches that seem common enough
|
||||
(transient-append-suffix 'magit-fetch "-p"
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
("\\(?:^\\*Contents\\|'s annots\\*$\\)" :ignore t)))
|
||||
|
||||
;; The mode-line does serve any useful purpose is annotation windows
|
||||
(add-hook 'pdf-annot-list-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'pdf-annot-list-mode-hook #'mode-line-invisible-mode)
|
||||
|
||||
;; HACK: Fix #1107: flickering pdfs when evil-mode is enabled
|
||||
(setq-hook! 'pdf-view-mode-hook evil-normal-state-cursor (list nil))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
;;; ui/minimap/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package! demap
|
||||
:hook (demap-minimap-window-set-hook . hide-mode-line-mode))
|
||||
:hook (demap-minimap-window-set-hook . mode-line-invisible-mode))
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ lines are selected, or the NxM dimensions of a block selection.")
|
|||
(defun +modeline-init-project-or-hide-h ()
|
||||
(if (eq major-mode 'magit-status-mode)
|
||||
(set-modeline! 'project)
|
||||
(hide-mode-line-mode +1))))
|
||||
(mode-line-invisible-mode +1))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -40,13 +40,8 @@ powered by the [[doom-package:doom-modeline]] package (where you can find screen
|
|||
#+end_quote
|
||||
|
||||
** Hiding the modeline
|
||||
- You can use ~M-x hide-mode-line-mode RET~ to hide modeline for the current
|
||||
- You can use ~M-x mode-line-invisible-mode RET~ to hide modeline for the current
|
||||
buffer.
|
||||
- Also, there is ~global-hide-mode-line-mode~ for globally hiding modeline. You
|
||||
can just add =(global-hide-mode-line-mode)= into =~/.doom.d/config.el~.
|
||||
- ~hide-mode-line-excluded-modes~ can be set for preventing
|
||||
~global-hide-mode-line-mode~ hiding modeline for buffers with the
|
||||
corresponding major modes.
|
||||
|
||||
** TODO Switching the modeline and header line
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
"Show minimal modeline in magit-status buffer, no modeline elsewhere."
|
||||
(if (eq major-mode 'magit-status-mode)
|
||||
(doom-modeline-set-modeline 'magit)
|
||||
(hide-mode-line-mode))))
|
||||
(mode-line-invisible-mode))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -270,7 +270,6 @@ restoring it if `+popup-buffer-mode' is disabled."
|
|||
(let ((m (if (bound-and-true-p +popup-buffer-mode) +popup-margin-width)))
|
||||
(set-window-margins nil m m)))))
|
||||
|
||||
(defvar hide-mode-line-format)
|
||||
;;;###autoload
|
||||
(defun +popup-set-modeline-on-enable-h ()
|
||||
"Don't show modeline in popup windows without a `modeline' window-parameter.
|
||||
|
|
@ -286,22 +285,19 @@ Any non-nil value besides the above will be used as the raw value for
|
|||
(let ((modeline (+popup-parameter 'modeline)))
|
||||
(cond ((eq modeline 't))
|
||||
((null modeline)
|
||||
;; TODO use `mode-line-format' window parameter instead (emacs 26+)
|
||||
(hide-mode-line-mode +1))
|
||||
((let ((hide-mode-line-format
|
||||
(if (functionp modeline)
|
||||
(funcall modeline)
|
||||
modeline)))
|
||||
(hide-mode-line-mode +1)))))))
|
||||
(mode-line-invisible-mode +1))
|
||||
((setq-local mode-line-format
|
||||
(if (functionp modeline)
|
||||
(funcall modeline)
|
||||
modeline)))))))
|
||||
(put '+popup-set-modeline-on-enable-h 'permanent-local-hook t)
|
||||
|
||||
;;;###autoload
|
||||
(defun +popup-unset-modeline-on-disable-h ()
|
||||
"Restore the modeline when `+popup-buffer-mode' is deactivated."
|
||||
(when (and (not (bound-and-true-p +popup-buffer-mode))
|
||||
(bound-and-true-p hide-mode-line-mode)
|
||||
(not (bound-and-true-p global-hide-mode-line-mode)))
|
||||
(hide-mode-line-mode -1)))
|
||||
(bound-and-true-p mode-line-invisible-mode))
|
||||
(mode-line-invisible-mode -1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +popup-close-on-escape-h ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue