[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 0653b07 043/134: Make olivetti-set-environment
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti 0653b07 043/134: Make olivetti-set-environment act on the list of all buffer windows |
Date: |
Thu, 25 Apr 2019 09:57:25 -0400 (EDT) |
branch: externals/olivetti
commit 0653b0731250e5145f797d1b1e0398cff57a8e11
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Make olivetti-set-environment act on the list of all buffer windows
---
olivetti.el | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 91e94ce..3fa4856 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -188,16 +188,23 @@ fraction of the window width."
(message "Text body width set to %s" olivetti-body-width))
(defun olivetti-set-environment ()
- "Set text body width to `olivetti-body-width' with relative margins."
- (let* ((n (olivetti-safe-width (if (integerp olivetti-body-width)
- (olivetti-scale-width olivetti-body-width)
- olivetti-body-width)))
- (width (cond ((integerp n) n)
- ((floatp n) (* (window-total-width) n))))
- (margin (max (round (/ (- (window-total-width) width)
- 2))
- 0)))
- (set-window-margins (selected-window) margin margin)))
+ "Set text body width to `olivetti-body-width' with relative margins.
+Cycle through all windows displaying the current buffer, first
+finding the `olivetti-safe-width' to which to set
+`olivetti-body-width', then find the appropriate margin size
+relative to each window. Finally set the window margins, taking
+care that the maximum size is 0."
+ (dolist (window (get-buffer-window-list (current-buffer) nil t))
+ (let* ((n (olivetti-safe-width (if (integerp olivetti-body-width)
+ (olivetti-scale-width
olivetti-body-width)
+ olivetti-body-width)))
+ (width (cond ((integerp n) n)
+ ((floatp n) (* (window-total-width window)
+ n))))
+ (margin (max (round (/ (- (window-total-width window) width)
+ 2))
+ 0)))
+ (set-window-margins window margin margin))))
(defun olivetti-toggle-hide-mode-line ()
"Toggle the visibility of the mode-line.
- [elpa] externals/olivetti f213afd 017/134: Added safe-width fun, (continued)
- [elpa] externals/olivetti f213afd 017/134: Added safe-width fun, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 906974e 031/134: Fixes #5, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 30b82ff 018/134: Made body-width buffer-local, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti e0dabc0 024/134: Obsessive cleanliness, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 4252fe4 026/134: Deleted unneeded .gitignore, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti b42eb3e 029/134: Allow set-width to accept any number, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 34b8a54 032/134: Added doc string, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 7b215a7 037/134: Fixes #7, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 41c6642 039/134: Update MELPA URL, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 947b1c0 044/134: Custom option to recall visual-line-mode entry state, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 0653b07 043/134: Make olivetti-set-environment act on the list of all buffer windows,
Stefan Monnier <=
- [elpa] externals/olivetti 42d5822 048/134: Add keymap, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 6a8f400 021/134: Added set-width interactive fun, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 3c60908 023/134: Made set-environment use safe-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 4bec5f2 022/134: Added expand/shrink interactive funs, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti bd24fae 027/134: Removed erroneous mode-hook, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 99a8b3d 034/134: Changed email, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti bd672e5 052/134: Make it easier to adjust olivetti-body-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti be11f32 055/134: Fixing typo, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti bb2e0cf 056/134: set-temporary-overlay-map -> set-transient-map, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 4a6197f 064/134: Merge branch 'master' of https://github.com/rnkn/olivetti, Stefan Monnier, 2019/04/25