update packages
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
|
||||
;; Author: Paul W. Rankin <rnkn@rnkn.xyz>
|
||||
;; Keywords: wp, text
|
||||
;; Package-Version: 20241030.542
|
||||
;; Package-Revision: 845eb7a95a3c
|
||||
;; Package-Version: 20260524.213
|
||||
;; Package-Revision: d2ccae56b442
|
||||
;; Package-Requires: ((emacs "24.4"))
|
||||
;; URL: https://github.com/rnkn/olivetti
|
||||
|
||||
@@ -176,7 +176,7 @@ If an integer, set text body width to that integer in columns; if
|
||||
a floating point between 0.0 and 1.0, set text body width to that
|
||||
fraction of the total window width. If nil (the default), use the
|
||||
value of `fill-column' + 2. The extra 2 columns are to prevent
|
||||
text files at `fill-colum ' from wrapping in the body widith.
|
||||
text files at `fill-column' from wrapping in the body width.
|
||||
|
||||
An integer is best if you want text body width to remain
|
||||
constant, while a floating point is best if you want text body
|
||||
@@ -264,18 +264,23 @@ if it is an integer, and otherwise return WIDTH."
|
||||
(setq height (/ height 100.0)))
|
||||
(round (* width (or height 1)))))
|
||||
|
||||
(defun olivetti-window-width (window)
|
||||
"Return the pixel width of WINDOW, including default margins."
|
||||
(+ (window-body-width window t)
|
||||
(* (frame-char-width (window-frame window))
|
||||
(+ left-margin-width right-margin-width))))
|
||||
|
||||
(defun olivetti-normalize-width (width window)
|
||||
"Parse WIDTH to a safe pixel value for `olivetti-body-width' for WINDOW."
|
||||
(let ((char-width (frame-char-width (window-frame window)))
|
||||
(window-width-pix (window-body-width window t))
|
||||
min-width-pix)
|
||||
(setq min-width-pix (* char-width
|
||||
(let* ((char-width (frame-char-width (window-frame window)))
|
||||
(window-width-pix (olivetti-window-width window))
|
||||
(min-width-pix (* char-width
|
||||
(+ olivetti-minimum-body-width
|
||||
(% olivetti-minimum-body-width 2))))
|
||||
(if (floatp width)
|
||||
(floor (max min-width-pix (* window-width-pix (min width 1.0))))
|
||||
(olivetti-scale-width
|
||||
(max min-width-pix (min (* width char-width) window-width-pix))))))
|
||||
(% olivetti-minimum-body-width 2)))))
|
||||
(if (floatp width)
|
||||
(floor (max min-width-pix (* window-width-pix (min width 1.0))))
|
||||
(olivetti-scale-width
|
||||
(max min-width-pix (min (* width char-width) window-width-pix))))))
|
||||
|
||||
(defun olivetti-reset-window (window)
|
||||
"Remove Olivetti's parameters and margins from WINDOW."
|
||||
@@ -284,7 +289,7 @@ if it is an integer, and otherwise return WIDTH."
|
||||
(if (consp fringe-mode)
|
||||
(set-window-fringes window (car fringe-mode) (cdr fringe-mode))
|
||||
(set-window-fringes window fringe-mode fringe-mode))
|
||||
(set-window-margins window nil))
|
||||
(set-window-margins window left-margin-width right-margin-width))
|
||||
|
||||
(defun olivetti-reset-all-windows ()
|
||||
"Call `olivetti-reset-window' on all windows."
|
||||
@@ -325,10 +330,10 @@ window."
|
||||
;; `fill-column'
|
||||
(when (null olivetti-body-width)
|
||||
(setq olivetti-body-width (+ fill-column 2)))
|
||||
(let ((char-width-pix (frame-char-width (window-frame window-or-frame)))
|
||||
(window-width-pix (window-body-width window-or-frame t))
|
||||
(safe-width-pix (olivetti-normalize-width
|
||||
olivetti-body-width window-or-frame)))
|
||||
(let* ((char-width-pix (frame-char-width (window-frame window-or-frame)))
|
||||
(window-width-pix (olivetti-window-width window-or-frame))
|
||||
(safe-width-pix (olivetti-normalize-width
|
||||
olivetti-body-width window-or-frame)))
|
||||
;; Handle possible display of fringes
|
||||
(when (and window-system olivetti-style)
|
||||
(let ((fringe-total (- (window-pixel-width window-or-frame)
|
||||
@@ -351,11 +356,11 @@ window."
|
||||
(setq left-margin (max (round (/ (- margin-total-pix
|
||||
(car fringes))
|
||||
char-width-pix))
|
||||
0)
|
||||
left-margin-width)
|
||||
right-margin (max (round (/ (- margin-total-pix
|
||||
(cadr fringes))
|
||||
char-width-pix))
|
||||
0))
|
||||
right-margin-width))
|
||||
;; Finally set the margins
|
||||
(set-window-margins window-or-frame left-margin right-margin)))
|
||||
;; Set remaining window parameters
|
||||
|
||||
Reference in New Issue
Block a user