From c2524b420eb32a2b0085db431ef7de95fdc3c453 Mon Sep 17 00:00:00 2001 From: larstvei Date: Sat, 14 Sep 2024 23:25:33 +0200 Subject: [PATCH] Thank you flycheck --- center-content.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/center-content.el b/center-content.el index c6edbce..6b2828d 100644 --- a/center-content.el +++ b/center-content.el @@ -7,6 +7,8 @@ ;;; Code: +(require 'face-remap) + (defvar-local center-content--horizontal-overlay nil "Overlay used to add left margin for horizontal centering.") @@ -20,16 +22,17 @@ "Cookie for the face remapping of `header-line`.") (defun center-content--content-pixel-size () + "Return the size of the content of the visible text in pixels." (window-text-pixel-size (selected-window) (window-start) (window-end))) (defun center-content--calculate-left-margin (content-width) - "Calculate the left margin needed to center the content horizontally." + "Calculate the left margin relative to CONTENT-WIDTH." (let ((window-width (window-pixel-width)) (column-width (string-pixel-width " "))) (/ (max 0 (- window-width content-width)) (* 2 column-width)))) (defun center-content--calculate-top-margin (content-height) - "Calculate the top margin needed to center the content vertically." + "Calculate the top margin relative to CONTENT-HEIGHT." (let ((window-height (window-pixel-height)) (line-height (default-line-height))) (/ (max 0 (- window-height content-height)) (* 2 line-height))))