diff --git a/center-content.el b/center-content.el index 6b2828d..63f3a1a 100644 --- a/center-content.el +++ b/center-content.el @@ -43,17 +43,16 @@ (left-margin (center-content--calculate-left-margin (car content-size))) (top-margin (center-content--calculate-top-margin (cdr content-size)))) ;; Apply horizontal centering using overlay - (let ((overlay (make-overlay (point-min) (point-max)))) - (overlay-put overlay 'line-prefix - (propertize " " 'display `(space :width ,left-margin))) + (let ((overlay (make-overlay (point-min) (point-max))) + (space (propertize " " 'display `(space :width ,left-margin)))) + (overlay-put overlay 'line-prefix space) (setq center-content--horizontal-overlay overlay)) ;; Apply vertical centering using header-line-format ;; 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))) + (setq header-line-format (propertize " " 'display `(height ,top-margin))) ;; Save and hide the mode line (setq center-content--original-mode-line-format mode-line-format) (setq mode-line-format nil)