summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-11-07 10:14:45 +0200
committerJuri Linkov <juri@linkov.net>2022-11-07 10:14:45 +0200
commit236703ca05382c9cdf4ce6a2dd2b3244c20d564d (patch)
tree36757f7b251a2e51798d24928879bbf7824042ce
parent35221a7bd55e18244604376497097f4259c7351b (diff)
downloademacs-236703ca05382c9cdf4ce6a2dd2b3244c20d564d.tar.gz
* lisp/outline.el (outline-minor-mode): Ensure margins are either 0 or 1.
This check is necessary to make it idempotent to multiple calls.
-rw-r--r--lisp/outline.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index ef5249a146c..a646f71db8b 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -507,7 +507,9 @@ See the command `outline-mode' for more information on this mode."
(when (eq (current-bidi-paragraph-direction) 'right-to-left)
(setq-local outline--use-rtl t))
(setq-local outline--button-icons (outline--create-button-icons))
- (when (eq outline-minor-mode-use-buttons 'in-margins)
+ (when (and (eq outline-minor-mode-use-buttons 'in-margins)
+ (> 1 (if outline--use-rtl right-margin-width
+ left-margin-width)))
(if outline--use-rtl
(setq-local right-margin-width (1+ right-margin-width))
(setq-local left-margin-width (1+ left-margin-width)))
@@ -542,7 +544,9 @@ See the command `outline-mode' for more information on this mode."
(remove-overlays nil nil 'outline-highlight t))
(when outline-minor-mode-use-buttons
(remove-overlays nil nil 'outline-button t)
- (when (eq outline-minor-mode-use-buttons 'in-margins)
+ (when (and (eq outline-minor-mode-use-buttons 'in-margins)
+ (< 0 (if outline--use-rtl right-margin-width
+ left-margin-width)))
(if outline--use-rtl
(setq-local right-margin-width (1- right-margin-width))
(setq-local left-margin-width (1- left-margin-width)))