Cache the original header- and mode-line-format unconditionally
This commit is contained in:
parent
f1a1c4a172
commit
2d82f55835
@ -69,20 +69,20 @@
|
|||||||
"Add overlay for vertical centering relative to CONTENT-HEIGHT."
|
"Add overlay for vertical centering relative to CONTENT-HEIGHT."
|
||||||
(let* ((top-margin (center-content--calculate-top-margin content-height)))
|
(let* ((top-margin (center-content--calculate-top-margin content-height)))
|
||||||
;; Save and remap the header-line face to match the default face
|
;; Save and remap the header-line face to match the default face
|
||||||
(setq center-content--original-header-line-format header-line-format)
|
|
||||||
(setq center-content--header-line-face-remap-cookie
|
(setq center-content--header-line-face-remap-cookie
|
||||||
(face-remap-add-relative 'header-line 'default))
|
(face-remap-add-relative 'header-line 'default))
|
||||||
(setq header-line-format (propertize " " 'display `(height ,top-margin)))))
|
(setq header-line-format (propertize " " 'display `(height ,top-margin)))))
|
||||||
|
|
||||||
(defun center-content--enable ()
|
(defun center-content--enable ()
|
||||||
"Enable horizontal and vertical centering of content."
|
"Enable horizontal and vertical centering of content."
|
||||||
|
(setq center-content--original-header-line-format header-line-format)
|
||||||
|
(setq center-content--original-mode-line-format mode-line-format)
|
||||||
(let* ((content-size (center-content--content-pixel-size)))
|
(let* ((content-size (center-content--content-pixel-size)))
|
||||||
(when center-content-horizontal
|
(when center-content-horizontal
|
||||||
(center-content--horizontal (car content-size)))
|
(center-content--horizontal (car content-size)))
|
||||||
(when center-content-vertical
|
(when center-content-vertical
|
||||||
(center-content--vertical (cdr content-size)))
|
(center-content--vertical (cdr content-size)))
|
||||||
(when center-content-hide-mode-line
|
(when center-content-hide-mode-line
|
||||||
(setq center-content--original-mode-line-format mode-line-format)
|
|
||||||
(setq mode-line-format nil))))
|
(setq mode-line-format nil))))
|
||||||
|
|
||||||
(defun center-content--disable ()
|
(defun center-content--disable ()
|
||||||
|
Loading…
Reference in New Issue
Block a user