[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 6458e16: New mode outline-cycle-minor-mode with Orgmode-like

From: Juri Linkov
Subject: Re: master 6458e16: New mode outline-cycle-minor-mode with Orgmode-like TAB cycling on headings
Date: Thu, 04 Mar 2021 10:58:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>   ;;; outline-minor-mode-cycle: t
>>   ;;; outline-minor-mode-highlight: t
>>   ;;; eval: (outline-minor-mode 1)
>> But then thought that maybe with a mode would be more concise and convenient.
>> I'm fine with removing these modes after analyzing more use cases.
> BTW, I'm writing under the assumption that we'd want to eventually have
> both of those vars default to t.

I don't know, I could try to use outline-minor-mode-highlight unconditionally
everywhere to check its effect.  It seems that it doesn't put outline faces
on parts already highlighted by major mode font-lock keywords.

>> Here's is a list of use cases where I tried to use outline-minor-mode
>> with cycling, and somewhere also with highlighting.
> Any mode where you've found bad interactions?

Only in two modes so far:

1. in emacs-lisp-mode sometimes the inner part of a large expression
gets to the beginning of the line, then trying to indent it with TAB
hides the remaining part.  A workaround is to type SPC before indenting
with TAB.

2. in diff-mode TAB on a diff header line used to navigate to the next hunk
with 'diff-hunk-next', now it hides the next hunk.  A workaround is to
move point to the next line before typing TAB to go to the next hunk.

Are these a possible reasons that would prevent enabling cycling
in outline-minor-mode by default?  Or if someone enables
outline-minor-mode then it should be easy for them also to customize
cycling when it's enabled the default?

>> 3. (add-hook 'emacs-lisp-mode-hook 'outline-cycle-minor-mode)
>>    without outline highlighting to not overwrite major mode faces
> In which way did the highlighting get in the way?

Actually, I discovered only now that outline faces with
outline-minor-mode-highlight don't override major mode faces.

> FWIW, I think the only really good way to solve this problem is to
> replace `indent-for-tab-command` with a new command (call it
> `tab-dwim`?)  which can be more finely configured by major and minor
> modes.  E.g.  by making it call `tab-dwim-function` on which modes can
> `add-function` at will (and at various depths so they can control
> whether it should take precedence or not over the "TAB causes
> indentation" or "TAB causes completion", ...).

The problem is that too many commands bound to TAB need to adapt
this special handling: indent-for-tab-command, diff-hunk-next,
compilation-next-error, forward-button, etc. etc.

> The mechanism of priorities of keymaps coupled with "fallthrough"
> (either via the "menu-item + filter" trick or via some explicitly
> looking up the keymaps and calling the next command) isn't fine-grained
> enough to deal with the amount of overloading that people want to use on
> that poor TAB key.

It seems only some very high-level map like overriding-terminal-local-map
could handle this generally.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]