emacs-diffs
[Top][All Lists]
Advanced

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

master 8bde7d40a4: * lisp/outline.el: Use 'outline-cycle' on buttons for


From: Juri Linkov
Subject: master 8bde7d40a4: * lisp/outline.el: Use 'outline-cycle' on buttons for 'RET' like 'TAB' uses.
Date: Sat, 22 Oct 2022 14:58:06 -0400 (EDT)

branch: master
commit 8bde7d40a400780a23eb8b3ba97a41c9539d17b6
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/outline.el: Use 'outline-cycle' on buttons for 'RET' like 'TAB' uses.
    
    (outline--make-button-overlay, outline--make-margin-overlay):
    Use overlay keymap where RET and mouse-2 are bound to outline-cycle.
    (outline--insert-open-button, outline--insert-close-button):
    Move overlay keymap to outline--make-button-overlay and replace
    bindings outline-hide-subtree/outline-show-subtree with outline-cycle.
---
 lisp/outline.el | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/outline.el b/lisp/outline.el
index dcc4fbc80a..fd11e496ca 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1647,6 +1647,10 @@ With a prefix argument, show headings up to that LEVEL."
       (overlay-put o 'evaporate t)
       (overlay-put o 'follow-link 'mouse-face)
       (overlay-put o 'mouse-face 'highlight)
+      (overlay-put o 'keymap
+                   (define-keymap
+                     "RET" #'outline-cycle
+                     "<mouse-2>" #'outline-cycle))
       (overlay-put o 'outline-button t))
     (let ((icon (icon-elements (if (eq type 'close)
                                    (if outline--use-rtl
@@ -1679,6 +1683,10 @@ With a prefix argument, show headings up to that LEVEL."
     (unless o
       (setq o (make-overlay (point) (1+ (point))))
       (overlay-put o 'evaporate t)
+      (overlay-put o 'keymap
+                   (define-keymap
+                     "RET" #'outline-cycle
+                     "<mouse-2>" #'outline-cycle))
       (overlay-put o 'outline-margin t))
     (let ((icon (icon-elements (if (eq type 'close)
                                    (if outline--use-rtl
@@ -1705,11 +1713,7 @@ With a prefix argument, show headings up to that LEVEL."
             (insert "  ")
             (beginning-of-line)))
         (let ((o (outline--make-button-overlay 'open)))
-          (overlay-put o 'help-echo "Click to hide")
-          (overlay-put o 'keymap
-                       (define-keymap
-                         "RET" #'outline-hide-subtree
-                         "<mouse-2>" #'outline-hide-subtree)))))))
+          (overlay-put o 'help-echo "Click to hide"))))))
 
 (defun outline--insert-close-button ()
   (with-silent-modifications
@@ -1722,11 +1726,7 @@ With a prefix argument, show headings up to that LEVEL."
             (insert "  ")
             (beginning-of-line)))
         (let ((o (outline--make-button-overlay 'close)))
-          (overlay-put o 'help-echo "Click to show")
-          (overlay-put o 'keymap
-                       (define-keymap
-                         "RET" #'outline-show-subtree
-                         "<mouse-2>" #'outline-show-subtree)))))))
+          (overlay-put o 'help-echo "Click to show"))))))
 
 (defun outline--fix-up-all-buttons (&optional from to)
   (when outline-minor-mode-use-buttons



reply via email to

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