Thank you flycheck

This commit is contained in:
larstvei 2024-09-14 23:25:33 +02:00
parent 4925bca107
commit c2524b420e

View File

@ -7,6 +7,8 @@
;;; Code: ;;; Code:
(require 'face-remap)
(defvar-local center-content--horizontal-overlay nil (defvar-local center-content--horizontal-overlay nil
"Overlay used to add left margin for horizontal centering.") "Overlay used to add left margin for horizontal centering.")
@ -20,16 +22,17 @@
"Cookie for the face remapping of `header-line`.") "Cookie for the face remapping of `header-line`.")
(defun center-content--content-pixel-size () (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))) (window-text-pixel-size (selected-window) (window-start) (window-end)))
(defun center-content--calculate-left-margin (content-width) (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)) (let ((window-width (window-pixel-width))
(column-width (string-pixel-width " "))) (column-width (string-pixel-width " ")))
(/ (max 0 (- window-width content-width)) (* 2 column-width)))) (/ (max 0 (- window-width content-width)) (* 2 column-width))))
(defun center-content--calculate-top-margin (content-height) (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)) (let ((window-height (window-pixel-height))
(line-height (default-line-height))) (line-height (default-line-height)))
(/ (max 0 (- window-height content-height)) (* 2 line-height)))) (/ (max 0 (- window-height content-height)) (* 2 line-height))))