[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 8558589 111/134: Rewrite olivetti-set-environm
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti 8558589 111/134: Rewrite olivetti-set-environment |
Date: |
Thu, 25 Apr 2019 09:57:39 -0400 (EDT) |
branch: externals/olivetti
commit 8558589d453b992714f26ac3325e066354396684
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Rewrite olivetti-set-environment
- separate left/right margin values compensating for differing fringe values
---
olivetti.el | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 09bc0e4..19ab010 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -185,25 +185,22 @@ find the `olivetti-safe-width' to which to set
relative to each window. Finally set the window margins, taking
care that the maximum size is 0."
(dolist (window (get-buffer-window-list nil nil t))
- (let* ((n (olivetti-safe-width (if (integerp olivetti-body-width)
- (olivetti-scale-width
olivetti-body-width)
- olivetti-body-width)
- window))
- (fringes (window-fringes window))
- (window-width (- (window-total-width window)
- (+ (/ (car fringes)
- (float (frame-char-width)))
- (/ (cadr fringes)
- (float (frame-char-width))))))
- (width (cond ((integerp n) n)
- ((floatp n) (* window-width
- n))))
- (margin (max (round (/ (- window-width
- width)
- 2))
- 0)))
+ (olivetti-reset-window window)
+ (let ((width (olivetti-safe-width olivetti-body-width window))
+ (window-width (window-total-width window))
+ (fringes (window-fringes window))
+ left-fringe right-fringe margin-total left-margin right-margin)
+ (cond ((integerp width)
+ (setq width (olivetti-scale-width width)))
+ ((floatp width)
+ (setq width (* window-width width))))
+ (setq left-fringe (/ (car fringes) (float (frame-char-width frame)))
+ right-fringe (/ (cadr fringes) (float (frame-char-width frame))))
+ (setq margin-total (max (/ (- window-width width) 2) 0)
+ left-margin (max (round (- margin-total left-fringe)) 0)
+ right-margin (max (round (- margin-total right-fringe)) 0))
(set-window-parameter window 'split-window 'olivetti-split-window)
- (set-window-margins window margin margin))
+ (set-window-margins window left-margin right-margin))
(if olivetti-hide-mode-line (olivetti-set-mode-line))))
(defun olivetti-reset-all-windows ()
- [elpa] externals/olivetti 52b5b4e 038/134: Cleaning up, (continued)
- [elpa] externals/olivetti 52b5b4e 038/134: Cleaning up, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti bee3291 015/134: Fixes #1, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti bb7b2ce 007/134: Doc cleanup, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 751b90f 028/134: Fixes #3, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti c2b1100 025/134: Updated README and Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 1553934 079/134: Move hide-mode-line into set-environment, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 39271d0 082/134: Only reset split-window param if olivetti-split-window, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 4c8b62f 094/134: Updating README/Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 35d275d 104/134: deleted: TODO.md, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 38b2eb4 110/134: Limit window-width to 2* largest fringe, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 8558589 111/134: Rewrite olivetti-set-environment,
Stefan Monnier <=
- [elpa] externals/olivetti ef3d85e 051/134: Updated copyright, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 4f9210b 074/134: Don't use min-margins - there is a better way, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 3f237b0 075/134: Use split-window window-parameter, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti e515385 083/134: Docstring update, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti de2716c 081/134: Only reset all windows on exit, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti fd5d85b 097/134: Enhance short description, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 85ecdfc 099/134: Revert "Enhance short description", Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 7bf367c 105/134: Updated README/Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 7eadbe7 108/134: Rewrite olivetti-safe-width for fringes, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti fc3b045 116/134: Readded window-configuration-change-hook, Stefan Monnier, 2019/04/25