unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Juri Linkov <juri@linkov.net>,  emacs-devel@gnu.org
Subject: Re: emacs-29 4a8891a462: * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map'.
Date: Mon, 16 Jan 2023 20:02:34 +0100	[thread overview]
Message-ID: <87zgaicng5.fsf@gmail.com> (raw)
In-Reply-To: <837cxm49q1.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2023 20:26:14 +0200")

>>>>> On Mon, 16 Jan 2023 20:26:14 +0200, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Juri Linkov <juri@linkov.net>
    >> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
    >> Date: Mon, 16 Jan 2023 19:43:10 +0200
    >> 
    >> >     Eli> Ah, okay.  Fine with me if Juri (or someone else) doesn't object.
    >> >
    >> >     >> (and what I really want to do is add 'n' and 'p' into that map, which
    >> >     >> improves the speed at which I can proofread NEWS.)
    >> >
    >> >     Eli> On master or emacs-29?
    >> >
    >> > On master. Iʼm assuming adding bindings would not fall under 'bug
    >> > fixes only'.
    >> 
    >> But maybe Eli will agree to install it on emacs-29?

    Eli> Maybe.  Robert didn't really explain what are his plans in that
    Eli> regard.

Hereʼs the complete patch (minus doc changes). I was thinking putting
the outline.el bits in emacs-29, to make it easier for everybody to
change the bindings, and then changing the bindings in news-mode in
master.

Or we could just stick the whole thing in master.

Robert
-- 

diff --git c/lisp/outline.el i/lisp/outline.el
index 91f6040687b..6fb9281f61e 100644
--- c/lisp/outline.el
+++ i/lisp/outline.el
@@ -1766,6 +1766,20 @@ 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)
+
+(defvar-keymap outline-overlay-button-map
+  "RET" #'outline-cycle)
+
+(defvar-keymap outline-inserted-button-map
+  :parent (make-composed-keymap outline-button-icon-map
+                                outline-overlay-button-map))
+
 (defun outline--create-button-icons ()
   (pcase outline-minor-mode-use-buttons
     ('in-margins
@@ -1798,12 +1812,7 @@ 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))))))
 
@@ -1829,19 +1838,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
diff --git c/lisp/textmodes/emacs-news-mode.el i/lisp/textmodes/emacs-news-mode.el
index b844955e1be..31410176181 100644
--- c/lisp/textmodes/emacs-news-mode.el
+++ i/lisp/textmodes/emacs-news-mode.el
@@ -60,6 +60,11 @@ emacs-news-mode-map
   "C-x C-q" #'emacs-news-view-mode
   "<remap> <open-line>" #'emacs-news-open-line)
 
+(defvar-keymap emacs-news-heading-map
+  :parent outline-overlay-button-map
+  "n" #'outline-next-visible-heading
+  "p" #'outline-previous-visible-heading)
+
 (defvar emacs-news-view-mode-map
   ;; This is defined this way instead of inheriting because we're
   ;; deriving the mode from `special-mode' and want the keys from there.
@@ -75,7 +80,8 @@ emacs-news--mode-common
   (setq-local font-lock-defaults '(emacs-news-mode-font-lock-keywords t))
   (setq-local outline-minor-mode-cycle t
               outline-minor-mode-highlight 'append
-              outline-minor-mode-use-buttons 'in-margins)
+              outline-minor-mode-use-buttons 'in-margins
+              outline-overlay-button-map emacs-news-heading-map)
   (outline-minor-mode)
   (setq-local imenu-generic-expression outline-imenu-generic-expression)
   (emacs-etc--hide-local-variables))



  reply	other threads:[~2023-01-16 19:02 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   ` emacs-29 4a8891a462: * etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map' Robert Pluim
2023-01-16 14:33     ` 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87zgaicng5.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eliz@gnu.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).