emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 236703ca05: * lisp/outline.el (outline-minor-mode): Ensure margin


From: Juri Linkov
Subject: master 236703ca05: * lisp/outline.el (outline-minor-mode): Ensure margins are either 0 or 1.
Date: Mon, 7 Nov 2022 03:15:16 -0500 (EST)

branch: master
commit 236703ca05382c9cdf4ce6a2dd2b3244c20d564d
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/outline.el (outline-minor-mode): Ensure margins are either 0 or 1.
    
    This check is necessary to make it idempotent to multiple calls.
---
 lisp/outline.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/outline.el b/lisp/outline.el
index ef5249a146..a646f71db8 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]