]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/outline.el (outline-minor-mode): Ensure margins are either 0 or 1.
authorJuri Linkov <juri@linkov.net>
Mon, 7 Nov 2022 08:14:45 +0000 (10:14 +0200)
committerJuri Linkov <juri@linkov.net>
Mon, 7 Nov 2022 08:14:45 +0000 (10:14 +0200)
This check is necessary to make it idempotent to multiple calls.

lisp/outline.el

index ef5249a146c0f31fd1d88e1fbe0dfbfdd4037cd2..a646f71db8beda30b79ffb89cf0f23551afcf86c 100644 (file)
@@ -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)))