unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: Philip Kaludercic <philipk@posteo.net>, 50679@debbugs.gnu.org
Subject: bug#50679: 28.0.50; outline-minor-mode-cycle should be able to only cycle at the begining of a line
Date: Wed, 22 Sep 2021 19:09:12 +0300	[thread overview]
Message-ID: <87czp0x2ej.fsf@mail.linkov.net> (raw)
In-Reply-To: <87lf3p3gqn.fsf@gmail.com> (Augusto Stoffel's message of "Tue, 21 Sep 2021 20:50:40 +0200")

>>>         "<tab>" 'outline-cycle
>>>         "<backtab>" 'outline-cycle-buffer
>>>         "f" 'outline-forward-same-level
>>>         "b" 'outline-backward-same-level
>>>         "n" 'outline-next-visible-heading
>>>         "p" 'outline-previous-visible-heading
>>>         "u" 'outline-up-heading
>>>         "F" 'outline-move-subtree-down
>>>         "B" 'outline-move-subtree-up
>>>         "@" 'outline-mark-subtree
>>
>> But this means you can't type all these keys on heading lines?
>> This is why I confugured it not to use self-inserting keys:
>
> In my setup those keys only apply at BOL in a heading line.  I never
> type anything there.
>
> TAB for reindenting might be a bit trickier.  Apparently I never try to
> reindent a heading line when point is at BOL, because I never thought
> about a possible conflict, but I guess I would type SPC TAB in that
> case.

This is exactly what I do every time, i.e. first I type TAB to indent,
but it hides the body, then I type again TAB to unhide the body
to revert the mistake, then type SPC TAB to workaround this annoyance.

>>   (let ((map outline-mode-cycle-map)
>>         (cmds '(("M-<down>"  outline-next-visible-heading)
>>                 ("M-<up>"    outline-previous-visible-heading)
>>                 ("M-<left>"  outline-hide-subtree)
>>                 ("M-<right>" outline-show-subtree))))
>>     (dolist (command cmds)
>>       (define-key map (kbd (nth 0 command))
>>         `(menu-item
>>           "" ,(nth 1 command)
>>           :filter ,(lambda (cmd)
>>                      (when (outline-on-heading-p))
>>                        cmd))))))
>
> I can't find this block in outline.el, is this a suggestion for a
> possible default?

This is from my init file.  I don't suggest to add it to outline.el,
it only shows how it's possible to customize navigation keys.

>>> Looking at the code, it seems that adding bindings to
>>> `outline-mode-cycle-map` would achieve precisely that, but the name
>>> of the keymap doesn't reflect that.
>>
>> Do you suggest different keymaps?  And indeed, these two are
>> quite different beasts each with own problems.  So we need both
>> outline-mode-cycle-map and outline-minor-mode-cycle-map.
>
> Okay, those keymaps are active in the entire heading line, right?
>
> I would prefer to only have a special behavior at the first character of
> a heading line,

Philip already proposed a predicate that can be set to 'bolp'
to make the map active only on the first character.

> in exchange of allowing _any_ shortcut key with minimal
> interference.  Org mode already does that with a simple customization,
> (setq org-use-speed-commands t), so I don't think it would be too
> surprising for most users.

Adding more keys to this keymap has more problems.  For example,
in diff-mode TAB navigates to the next hunk, but with outline-minor-mode
TAB on the first character in a diff-mode buffer cycles the outline,
so another available key 'n' should be typed to navigate to the next hunk.
We can't sacrifice this key for outline-next-visible-heading,
because no more keys will remain for diff-hunk-next.





  reply	other threads:[~2021-09-22 16:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 16:24 bug#50679: 28.0.50; outline-minor-mode-cycle should be able to only cycle at the begining of a line Philip Kaludercic
2021-09-19 16:53 ` Juri Linkov
2021-09-19 20:40   ` Philip Kaludercic
2021-09-20  7:02     ` Juri Linkov
2021-09-20 15:25       ` Juri Linkov
2021-09-20 15:35         ` Philip Kaludercic
2021-09-20 18:36           ` Augusto Stoffel
2021-09-21 11:27             ` Philip Kaludercic
2021-09-21 11:44               ` Augusto Stoffel
2021-09-21 11:58                 ` Philip Kaludercic
2021-09-21 19:02                   ` Augusto Stoffel
2021-09-21 17:58             ` Juri Linkov
2021-09-21 18:50               ` Augusto Stoffel
2021-09-22 16:09                 ` Juri Linkov [this message]
2021-09-22 16:30                   ` Augusto Stoffel
2021-09-23 16:15             ` Juri Linkov
2021-09-21 17:53           ` Juri Linkov
2021-09-23 16:17           ` Juri Linkov
2021-09-26 13:59             ` Philip Kaludercic
2021-09-27 15:35               ` Juri Linkov
2021-09-27 16:16                 ` Augusto Stoffel

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=87czp0x2ej.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=50679@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=philipk@posteo.net \
    /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).