[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 78ef7ae 046/134: Reset margins in all buffer w
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti 78ef7ae 046/134: Reset margins in all buffer windows |
Date: |
Thu, 25 Apr 2019 09:57:25 -0400 (EDT) |
branch: externals/olivetti
commit 78ef7ae13cf931a8be42fff7926d71248c0493d8
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Reset margins in all buffer windows
---
olivetti.el | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index eeafaee..877733a 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -197,7 +197,7 @@ fraction of the window width."
(olivetti-set-environment)
(message "Text body width set to %s" olivetti-body-width))
-(defun olivetti-set-environment ()
+(defun olivetti-set-environment (&optional arg)
"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
@@ -205,16 +205,18 @@ finding 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 (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))))
+ (if (equal arg 'exit)
+ (set-window-margins window nil nil)
+ (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.
@@ -263,8 +265,6 @@ hidden."
:lighter " Olv"
(if olivetti-mode
(progn
- (if olivetti-hide-mode-line
- (olivetti-set-mode-line))
(add-hook 'window-configuration-change-hook
'olivetti-set-environment nil t)
(add-hook 'after-setting-font-hook
@@ -274,21 +274,21 @@ hidden."
(setq olivetti--visual-line-mode visual-line-mode)
(unless olivetti--visual-line-mode
(visual-line-mode 1))
+ (if olivetti-hide-mode-line
+ (olivetti-set-mode-line))
(olivetti-set-environment))
- (olivetti-set-mode-line 'exit)
- (set-window-margins nil nil)
- (unless olivetti--visual-line-mode
- (visual-line-mode 0))
- (kill-local-variable 'olivetti--visual-line-mode)
(remove-hook 'window-configuration-change-hook
'olivetti-set-environment t)
(remove-hook 'after-setting-font-hook
'olivetti-set-environment t)
(remove-hook 'text-scale-mode-hook
- 'olivetti-set-environment t)))
+ 'olivetti-set-environment t)
+ (olivetti-set-mode-line 'exit)
+ (olivetti-set-environment 'exit)
(if (and olivetti-recall-visual-line-mode-entry-state
(null olivetti--visual-line-mode))
(visual-line-mode 0))
+ (kill-local-variable 'olivetti--visual-line-mode)))
(provide 'olivetti)
;;; olivetti.el ends here
- [elpa] externals/olivetti fc3b045 116/134: Readded window-configuration-change-hook, (continued)
- [elpa] externals/olivetti fc3b045 116/134: Readded window-configuration-change-hook, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti ff2b0a0 123/134: Change default body width to 70 (matches fill-column standard-value), Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti cb22f8a 127/134: Merge pull request #25 from Nielius/fix-scale-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 3859a4d 030/134: Added known bugs section to README/Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 16d0885 035/134: Fix "modeline" => "mode-line", Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 26e9da6 041/134: Use defvar-local, it's cleaner, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti d852e31 040/134: Merge pull request #8 from syohex/update-url, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti f629184 042/134: Merge branch 'master' of https://github.com/rnkn/olivetti, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 48874ef 045/134: Hiding mode-line seems to work without frame redrawing, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 6818914 047/134: Neatening docs, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 78ef7ae 046/134: Reset margins in all buffer windows,
Stefan Monnier <=
- [elpa] externals/olivetti 6933bf9 049/134: More neatening up, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 35654fe 054/134: Added note about temporary-overlay-map, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti d4fdf91 059/134: Fix for Emacs lexical binding standard-value bug, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti cdc9fc3 058/134: Merge pull request #11 from rnkn/lexical-binding, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti e095ee34 060/134: Function quoting, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti b4094d3 066/134: Added badges, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 3d057a5 073/134: Removed useless (let ...), Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 8556abb 078/134: Rearranging code for clarity, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti ff058b9 084/134: new file: screenshots/01.png, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 9bd4108 091/134: Compatibility fixes for Emacs 26, Stefan Monnier, 2019/04/25