]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/outline.el: Use one character wide strings for margins (bug#57813)
authorJuri Linkov <juri@linkov.net>
Tue, 18 Oct 2022 18:05:15 +0000 (21:05 +0300)
committerJuri Linkov <juri@linkov.net>
Tue, 18 Oct 2022 18:05:15 +0000 (21:05 +0300)
(outline-open-in-margins, outline-close-in-margins)
(outline-close-rtl-in-margins): Add 1-char emoji, symbol, text
for margins that are 1-column wide.
(outline-minor-mode): Force display of margins only for the selected buffer.

lisp/outline.el

index b87d3ac5e7f9e8d251f908036f93030c44487165..0d0974b5a95b881fcdfc6e0bfa2c4933781ace74 100644 (file)
@@ -339,17 +339,26 @@ Note that this feature is meant to be used in editing buffers."
   :version "29.1")
 
 (define-icon outline-open-in-margins outline-open
-  '((image "outline-open.svg" "outline-open.pbm" :height 10))
+  '((image "outline-open.svg" "outline-open.pbm" :height 10)
+    (emoji "🔽")
+    (symbol "▼")
+    (text "v"))
   "Icon used for buttons for opened sections in margins."
   :version "29.1")
 
 (define-icon outline-close-in-margins outline-close
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation -90))
+  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation -90)
+    (emoji "▶️")
+    (symbol "▶")
+    (text ">"))
   "Icon used for buttons for closed sections in margins."
   :version "29.1")
 
 (define-icon outline-close-rtl-in-margins outline-close-rtl
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation 90))
+  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation 90)
+    (emoji "◀️")
+    (symbol "◀")
+    (text "<"))
   "Right-to-left icon used for closed sections in margins."
   :version "29.1")
 
@@ -513,7 +522,8 @@ See the command `outline-mode' for more information on this mode."
             (setq-local left-margin-width (1+ left-margin-width)))
           (setq-local fringes-outside-margins t)
           ;; Force display of margins
-          (set-window-buffer nil (window-buffer)))
+          (when (eq (current-buffer) (window-buffer))
+            (set-window-buffer nil (window-buffer))))
         (when (or outline--use-buttons outline--use-margins)
           (add-hook 'after-change-functions
                     #'outline--fix-buttons-after-change nil t))
@@ -551,7 +561,8 @@ See the command `outline-mode' for more information on this mode."
         (setq-local left-margin-width (1- left-margin-width)))
       (setq-local fringes-outside-margins nil)
       ;; Force removal of margins
-      (set-window-buffer nil (window-buffer)))))
+      (when (eq (current-buffer) (window-buffer))
+        (set-window-buffer nil (window-buffer))))))
 
 (defvar-local outline-heading-alist ()
   "Alist associating a heading for every possible level.