From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Yuan Fu <casouri@gmail.com>, Emacs developers <emacs-devel@gnu.org>
Subject: Re: Duplicated outline-cycle binding, and problems with the new one
Date: Sun, 02 Jan 2022 21:18:20 +0200 [thread overview]
Message-ID: <86mtke3q0z.fsf@mail.linkov.net> (raw)
In-Reply-To: jwvlezyufdz.fsf-monnier+emacs@gnu.org
>>> Overall, from my limited knowledge, I think the old approach is more
>>> reliable: I wouldn’t have this problem with the old approach. And the
>>> new functionality added by the new approach and
>>> outline-minor-mode-cycle-filter can be easily implemented in the old
>>> approach. We don’t need to fiddle with font-lock-keywords with the
>>> old approach, either. How about we go back to the old approach?
>>
>> Some time ago we discussed this possibility, but it will require writing
>> too many wrappers for different modes, for example, for diff-mode:
>>
>> (defvar-keymap diff-mode-shared-map
>> "TAB" (lambda () (interactive)
>> (if (and outline-minor-mode (outline-on-heading-p))
>> (outline-cycle)
>> (diff-hunk-next)))
>> ...
>
> Why? The old approach used a conditional binding, so it should "just
> work" without the major modes knowing about it.
Then maybe something like this (not tested):
diff --git a/lisp/outline.el b/lisp/outline.el
index 0304d2334c..52b9883950 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -195,8 +195,10 @@ outline-minor-mode-cycle--bind
:filter
,(or filter
(lambda (cmd)
- (when (or (not (functionp outline-minor-mode-cycle-filter))
- (funcall outline-minor-mode-cycle-filter))
+ (when (and outline-minor-mode-cycle
+ (outline-on-heading-p)
+ (or (not (functionp outline-minor-mode-cycle-filter))
+ (funcall outline-minor-mode-cycle-filter)))
cmd))))))
(defvar outline-minor-mode-cycle-map
@@ -225,10 +227,8 @@ outline-font-lock-keywords
0 '(if outline-minor-mode
(if outline-minor-mode-cycle
(if outline-minor-mode-highlight
- (list 'face (outline-font-lock-face)
- 'keymap outline-minor-mode-cycle-map)
- (list 'face nil
- 'keymap outline-minor-mode-cycle-map))
+ (list 'face (outline-font-lock-face))
+ (list 'face nil))
(if outline-minor-mode-highlight
(list 'face (outline-font-lock-face))))
(outline-font-lock-face))
@@ -421,8 +422,10 @@ outline-minor-mode
See the command `outline-mode' for more information on this mode."
:lighter " Outl"
- :keymap (list (cons [menu-bar] outline-minor-mode-menu-bar-map)
- (cons outline-minor-mode-prefix outline-mode-prefix-map))
+ :keymap (append
+ (list (cons [menu-bar] outline-minor-mode-menu-bar-map)
+ (cons outline-minor-mode-prefix outline-mode-prefix-map))
+ (cdr outline-minor-mode-cycle-map))
(if outline-minor-mode
(progn
(when (or outline-minor-mode-cycle outline-minor-mode-highlight)
--
next prev parent reply other threads:[~2022-01-02 19:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-31 23:32 Duplicated outline-cycle binding, and problems with the new one Yuan Fu
2022-01-02 18:25 ` Juri Linkov
2022-01-02 19:07 ` Stefan Monnier
2022-01-02 19:18 ` Juri Linkov [this message]
2022-01-04 1:40 ` Yuan Fu
2022-01-05 18:35 ` Juri Linkov
2022-01-05 19:21 ` Stefan Monnier
2022-01-06 18:56 ` Juri Linkov
2022-01-09 22:55 ` Yuan Fu
2022-01-10 8:21 ` Juri Linkov
2022-01-10 18:30 ` Juri Linkov
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=86mtke3q0z.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).