emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/olivetti 3c60908 023/134: Made set-environment use safe


From: Stefan Monnier
Subject: [elpa] externals/olivetti 3c60908 023/134: Made set-environment use safe-width
Date: Thu, 25 Apr 2019 09:57:20 -0400 (EDT)

branch: externals/olivetti
commit 3c6090814a88c14ecd302f4b3399c889801f083f
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>

    Made set-environment use safe-width
---
 olivetti.el | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/olivetti.el b/olivetti.el
index f80f0bc..6521ea0 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -162,18 +162,11 @@ mode line. Finally redraw the frame."
 
 (defun olivetti-set-environment ()
   "Set text body width to `olivetti-body-width' with relative margins."
-  (let* ((n olivetti-body-width)
-         (width
-          (cond ((integerp n) n)
-                ((and (floatp n)
-                      (< n 1)
-                      (> n 0))
-                 (* (window-total-width) n)))))
-    (if width
-        (let ((margin
-               (round (/ (- (window-total-width) width) 2))))
-          (set-window-margins (selected-window) margin margin))
-      (message "`olivetti-body-width' must be an integer or a float between 0 
and 1"))))
+  (let* ((n (olivetti-safe-width olivetti-body-width))
+         (width (cond ((integerp n) n)
+                      ((floatp n) (* (window-total-width) n))))
+         (margin (round (/ (- (window-total-width) width) 2))))
+    (set-window-margins (selected-window) margin margin)))
 
 (defun olivetti-toggle-hide-modeline ()
   "Toggle the visibility of the modeline.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]