all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Cc: Juri Linkov <juri@linkov.net>
Subject: Re: emacs-29 4a8891a462: * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map'.
Date: Mon, 16 Jan 2023 14:57:03 +0100	[thread overview]
Message-ID: <87fscaeg5s.fsf@gmail.com> (raw)
In-Reply-To: <20230111193754.33EF3C00A7F@vcs2.savannah.gnu.org> (Juri Linkov's message of "Wed, 11 Jan 2023 14:37:54 -0500 (EST)")

>>>>> On Wed, 11 Jan 2023 14:37:54 -0500 (EST), Juri Linkov <juri@jurta.org> said:

    Juri> branch: emacs-29
    Juri> commit 4a8891a462e41e81a5232810b67d9d85f79bc515
    Juri> Author: Juri Linkov <juri@linkov.net>
    Juri> Commit: Juri Linkov <juri@linkov.net>

    Juri>     * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map'.
    
    Juri>     * lisp/outline.el (outline-minor-mode-cycle--bind):
    Juri>     Add docstring (bug#60426).
    Juri>     (outline-minor-mode-cycle--bind): Default 'map' to
    Juri>     'outline-minor-mode-cycle-map'.
    Juri>     (outline-minor-mode-cycle-map): Improve docstring.
    Juri>     (outline-minor-mode): Move margin-cycling keys to
    Juri>     'outline-minor-mode-cycle-map'.
    Juri> ---

Juri/Eli, any objection to putting something like the following in
emacs-29? That would make it easier to add heading-specific bindings
in NEWS mode, which Iʼd do in master. It also avoids creating a
separate keymap for each heading.

Robert
-- 

diff --git c/lisp/outline.el i/lisp/outline.el
index 91f6040687b..65d0d4db261 100644
--- c/lisp/outline.el
+++ i/lisp/outline.el
@@ -1766,6 +1766,13 @@ outline-cycle-buffer
 \f
 ;;; Button/margin indicators
 
+(defvar-keymap outline-button-icon-map
+  "<mouse-2>" #'outline-cycle
+  ;; Need to override the global binding
+  ;; `mouse-appearance-menu' with <down->:
+  "S-<down-mouse-1>" #'ignore
+  "S-<mouse-1>" #'outline-cycle-buffer)
+
 (defun outline--create-button-icons ()
   (pcase outline-minor-mode-use-buttons
     ('in-margins
@@ -1798,15 +1805,21 @@ outline--create-button-icons
         (propertize (icon-string icon-name)
                     'mouse-face 'default
                     'follow-link 'mouse-face
-                    'keymap (define-keymap
-                              "<mouse-2>" #'outline-cycle
-                              ;; Need to override the global binding
-                              ;; `mouse-appearance-menu' with <down->:
-                              "S-<down-mouse-1>" #'ignore
-                              "S-<mouse-1>" #'outline-cycle-buffer)))
+                    'keymap outline-button-icon-map))
       (list 'outline-open
             (if outline--use-rtl 'outline-close-rtl 'outline-close))))))
 
+(defvar-keymap outline-inserted-button-map
+  "RET" #'outline-cycle
+  "<mouse-2>" #'outline-cycle
+  ;; Need to override the global binding
+  ;; `mouse-appearance-menu' with <down->:
+  "S-<down-mouse-1>" #'ignore
+  "S-<mouse-1>" #'outline-cycle-buffer)
+
+(defvar-keymap outline-overlay-button-map
+  "RET" #'outline-cycle)
+
 (defun outline--insert-button (type)
   (with-silent-modifications
     (save-excursion
@@ -1829,19 +1842,13 @@ outline--insert-button
            (overlay-put o 'face (plist-get icon 'face))
            (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
-                                    ;; Need to override the global binding
-                                    ;; `mouse-appearance-menu' with <down->:
-                                    "S-<down-mouse-1>" #'ignore
-                                    "S-<mouse-1>" #'outline-cycle-buffer)))
+           (overlay-put o 'keymap outline-inserted-button-map))
           ('in-margins
            (overlay-put o 'before-string icon)
-           (overlay-put o 'keymap (define-keymap "RET" #'outline-cycle)))
+           (overlay-put o 'keymap outline-overlay-button-map))
           (_
            (overlay-put o 'before-string icon)
-           (overlay-put o 'keymap (define-keymap "RET" #'outline-cycle))))))))
+           (overlay-put o 'keymap outline-overlay-button-map)))))))
 
 (defun outline--fix-up-all-buttons (&optional from to)
   (when outline-minor-mode-use-buttons



       reply	other threads:[~2023-01-16 13:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167346587385.21119.11842722402918987249@vcs2.savannah.gnu.org>
     [not found] ` <20230111193754.33EF3C00A7F@vcs2.savannah.gnu.org>
2023-01-16 13:57   ` Robert Pluim [this message]
2023-01-16 14:33     ` emacs-29 4a8891a462: * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map' Eli Zaretskii
2023-01-16 15:02       ` Robert Pluim
2023-01-16 16:58         ` Eli Zaretskii
2023-01-16 17:18           ` Robert Pluim
2023-01-16 17:43             ` Juri Linkov
2023-01-16 18:26               ` Eli Zaretskii
2023-01-16 19:02                 ` Robert Pluim
2023-01-16 19:37                   ` Eli Zaretskii
2023-01-30 14:39                     ` News-mode improvements Robert Pluim
2023-01-30 14:58                       ` Eli Zaretskii
2023-01-30 15:14                         ` Robert Pluim
2023-01-17  7:29                   ` emacs-29 4a8891a462: * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map' Juri Linkov
2023-01-17  8:52                     ` Robert Pluim
2023-01-17 17:25                       ` Juri Linkov
2023-01-18  8:30                         ` Robert Pluim
2023-01-24 18:38                           ` Juri Linkov
2023-01-24 22:03                             ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fscaeg5s.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.