From: Juri Linkov Date: Sat, 22 Oct 2022 18:57:40 +0000 (+0300) Subject: * lisp/outline.el: Use 'outline-cycle' on buttons for 'RET' like 'TAB' uses. X-Git-Tag: emacs-29.0.90~1616^2~499 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8bde7d40a400780a23eb8b3ba97a41c9539d17b6;p=emacs.git * 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. --- diff --git a/lisp/outline.el b/lisp/outline.el index dcc4fbc80a9..fd11e496ca6 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 + "" #'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 + "" #'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 - "" #'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 - "" #'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