unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master 6458e16: New mode outline-cycle-minor-mode with Orgmode-like TAB cycling on headings
Date: Thu, 04 Mar 2021 20:12:42 +0200	[thread overview]
Message-ID: <87o8fy7os5.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwv7dmnm5e9.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 04 Mar 2021 08:20:08 -0500")

> [ As for how to resolve it (in terms of behavior rather than in terms
>   of code), I think the cycling should only kick after trying
>   indentation and the indentation function did not change the buffer.
>   This is the kind of refinement in behavior which can't be obtained
>   just by key bindings but is (barely) obtainable via `add-function`.  ]

This fallback-on-no-op logic works for indentation, but not for e.g.
diff-hunk-next (works only at the last hunk where TAB is no-op).

Another idea is to put the cycling keymap only at the beginning of the
outline heading line.  Then at the beginning of the line TAB will cycle,
while on the rest of the line TAB will fall back to the default binding
to indent/navigate etc.

>>>> 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.
>
> So at least it currently doesn't get in the way ;-)
> More seriously: it's because you've put `append` in the LAXMATCH part
> rather than the OVERRIDE part of the font-lock-keywords rule.

Ah, this explains everything.  Now I tried to put it in the OVERRIDE part,
and the result is angry fruit salad.

>>> 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.
>
> And I'm saying we should reduce this to a single command (`tab-dwim`)
> and then instead of binding TAB modes should `add-function` to
> `tab-dwim-function`.

Adding font-lock faces on heading lines was necessary anyway, so currently
it was easier to add a local cycling keymap to the same lines as well.

But binding TAB globally to a general tab-dwim command, and allowing
modes to set a buffer-local tab-dwim-function could work as well.



  reply	other threads:[~2021-03-04 18:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210303191236.24697.93201@vcs0.savannah.gnu.org>
     [not found] ` <20210303191237.2B2D720E1B@vcs0.savannah.gnu.org>
2021-03-03 20:13   ` master 6458e16: New mode outline-cycle-minor-mode with Orgmode-like TAB cycling on headings Stefan Monnier
2021-03-03 20:38     ` Juri Linkov
2021-03-03 21:44       ` Stefan Monnier
2021-03-04  8:58         ` Juri Linkov
2021-03-04 13:20           ` Stefan Monnier
2021-03-04 18:12             ` Juri Linkov [this message]
2021-03-04 19:07               ` Stefan Monnier
2021-03-04 17:03         ` Daniele Nicolodi
2021-03-04 18:06           ` Stefan Monnier
2021-03-04 20:38             ` Juri Linkov
2021-03-04 18:17           ` Juri Linkov
2021-03-04 19:37             ` Daniele Nicolodi
2021-03-04 20:35               ` Juri Linkov
2021-03-04 20:44                 ` Daniele Nicolodi
2021-03-04 20:53                   ` Juri Linkov
2021-03-04 22:57                 ` Stefan Monnier
2021-03-04  0:31       ` Gabriel do Nascimento Ribeiro
2021-03-04  9:05         ` Juri Linkov
2021-03-07 18:54           ` Juri Linkov
2021-03-07 18:53     ` 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=87o8fy7os5.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --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).