[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti de2716c 081/134: Only reset all windows on exi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti de2716c 081/134: Only reset all windows on exit |
Date: |
Thu, 25 Apr 2019 09:57:33 -0400 (EDT) |
branch: externals/olivetti
commit de2716cfb1f4dc82a08093cdd00200e9bb1f07ef
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Only reset all windows on exit
---
olivetti.el | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 99c3f4b..cb980e5 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -152,7 +152,7 @@ exiting. The reverse is not true."
(defun olivetti-set-environment ()
"Set text body width to `olivetti-body-width' with relative margins.
-Cycle through all windows displaying current buffer and, first,
+Cycle through all windows displaying current buffer and first
find 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
@@ -173,29 +173,28 @@ care that the maximum size is 0."
(set-window-margins window margin margin))
(if olivetti-hide-mode-line (olivetti-set-mode-line))))
-(defun olivetti-reset-environment ()
- "Remove Olivetti's parameters and margins.
+(defun olivetti-reset-all-windows ()
+ "Remove Olivetti's parameters and margins from all windows.
-Cycle through all windows displaying current buffer and reset
-window parameter `split-window' to nil. Then reset the window
-margins to nil."
+Cycle through all windows displaying current buffer and call
+`olivetti-reset-window'."
(dolist (window (get-buffer-window-list nil nil t))
- (set-window-parameter window 'split-window nil)
- (set-window-margins window nil)))
+ (olivetti-reset-window window)))
-(defun olivetti-split-window (&optional window size side pixelwise)
- "Safely split the window by first resetting the environment.
-
-First call `olivetti-reset-environment' then try
-`split-window'.
+(defun olivetti-reset-window (window)
+ "Remove Olivetti's parameters and margins from WINDOW."
+ (set-window-parameter window 'split-window nil)
+ (set-window-margins window nil))
+(defun olivetti-split-window (&optional window size side pixelwise)
+ "Call `split-window' after resetting WINDOW.
If `olivetti-mode' is non-nil, call `olivetti-set-environment'."
- (olivetti-reset-environment)
+ (olivetti-reset-window window)
(split-window window size side pixelwise))
(defun olivetti-split-window-sensibly (&optional window)
"Like `olivetti-split-window' but calls `split-window-sensibly'."
- (olivetti-reset-environment)
+ (olivetti-reset-window window)
(split-window-sensibly window))
@@ -342,7 +341,7 @@ hidden."
text-scale-mode-hook))
(add-hook hook 'olivetti-set-environment t t))
(add-hook 'change-major-mode-hook
- 'olivetti-reset-environment nil t)
+ 'olivetti-reset-all-windows nil t)
(setq-local split-window-preferred-function
'olivetti-split-window-sensibly)
(setq olivetti--visual-line-mode visual-line-mode)
@@ -352,8 +351,8 @@ hidden."
after-setting-font-hook
text-scale-mode-hook))
(remove-hook hook 'olivetti-set-environment t))
+ (olivetti-reset-all-windows)
(olivetti-set-mode-line 'exit)
- (olivetti-reset-environment)
(if (and olivetti-recall-visual-line-mode-entry-state
(not olivetti--visual-line-mode))
(visual-line-mode 0))
- [elpa] externals/olivetti 1553934 079/134: Move hide-mode-line into set-environment, (continued)
- [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, 2019/04/25
- [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 <=
- [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
- [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