[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41198: 28.0.50; heading cycling command for outline
From: |
Howard Melman |
Subject: |
bug#41198: 28.0.50; heading cycling command for outline |
Date: |
Thu, 10 Dec 2020 14:08:17 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) |
"Paul W. Rankin" via "Bug reports for GNU Emacs, the Swiss
army knife of text editors" <bug-gnu-emacs@gnu.org> writes:
> On 2020-11-27 18:29, Juri Linkov wrote:
>> I wonder why heading cycling implemented in this bug
>> report supports only `outline-mode', but not
>> `outline-minor-mode'? It would make sense in
>> `outline-minor-mode' if TAB typed on a heading then cycle
>> outline heading. If TAB is typed outside of a heading,
>> then use the default TAB binding, e.g. in case of the
>> Help buffer navigate to the next link.
>
> This is because it's not possible to know how the underlying major
> mode implements TAB.
>
> For just one example, I maintain a major mode where TAB performs
> outline cycling when at a heading, but calls completion-at-point when
> at a heading but at eolp. The assumption of outline-on-heading-p is
> insufficient to allow outline-minor-mode to hijack TAB.
>
> The correct way to implement what you're suggesting is for the major
> mode to require outline as a library, then alias the cycling commands
> prefixed as MODE-outline-cycle[-buffer] mapped them to TAB/S-TAB in
> their own keymaps.
I don't follow master so I'm not quite sure what's
implemented, but my original suggestion for this was:
(define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
(define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)
It's definitely very useful in outline-minor-mode. I use
this for code folding in prog-modes amongst other things and
that's one of the reasons I used C-TAB for outline-cycle
(since TAB often has other uses in prog-modes).
AFAIR people commented that C-TAB wasn't always available in
some terminals and said it should just be on TAB. Fine.
Either way S-TAB should work.
I'd argue that if you're enabling outline-minor-mode in a
major mode that has a binding for TAB, you want it to be
overridden. If not, don't enable the minor mode or change
one keymap to not conflict. Maybe outline-minor-mode should
support a variable option a major mode could set to change
the TAB keybinding or at least not override it with a
minor-mode binding?
--
Howard
- bug#41198: 28.0.50; heading cycling command for outline,
Howard Melman <=