From 2d82f558357cb1fede740bac265d2300c761f103 Mon Sep 17 00:00:00 2001 From: larstvei Date: Sun, 15 Sep 2024 02:05:21 +0200 Subject: [PATCH] Cache the original header- and mode-line-format unconditionally --- center-content.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/center-content.el b/center-content.el index 521a666..bd71c53 100644 --- a/center-content.el +++ b/center-content.el @@ -69,20 +69,20 @@ "Add overlay for vertical centering relative to CONTENT-HEIGHT." (let* ((top-margin (center-content--calculate-top-margin content-height))) ;; 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 (face-remap-add-relative 'header-line 'default)) (setq header-line-format (propertize " " 'display `(height ,top-margin))))) (defun center-content--enable () "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))) (when center-content-horizontal (center-content--horizontal (car content-size))) (when center-content-vertical (center-content--vertical (cdr content-size))) (when center-content-hide-mode-line - (setq center-content--original-mode-line-format mode-line-format) (setq mode-line-format nil)))) (defun center-content--disable ()