[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Duplicated outline-cycle binding, and problems with the new one
From: |
Juri Linkov |
Subject: |
Re: Duplicated outline-cycle binding, and problems with the new one |
Date: |
Sun, 02 Jan 2022 21:18:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>>> 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)
--
- Re: Duplicated outline-cycle binding, and problems with the new one, Juri Linkov, 2022/01/02
- Re: Duplicated outline-cycle binding, and problems with the new one, Stefan Monnier, 2022/01/02
- Re: Duplicated outline-cycle binding, and problems with the new one,
Juri Linkov <=
- Re: Duplicated outline-cycle binding, and problems with the new one, Juri Linkov, 2022/01/05
- Re: Duplicated outline-cycle binding, and problems with the new one, Stefan Monnier, 2022/01/05
- Re: Duplicated outline-cycle binding, and problems with the new one, Juri Linkov, 2022/01/06
- Re: Duplicated outline-cycle binding, and problems with the new one, Yuan Fu, 2022/01/09
- Re: Duplicated outline-cycle binding, and problems with the new one, Juri Linkov, 2022/01/10
- Re: Duplicated outline-cycle binding, and problems with the new one, Juri Linkov, 2022/01/10