GNU bug report logs - #50679
28.0.50; outline-minor-mode-cycle should be able to only cycle at the begining of a line

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Sun, 19 Sep 2021 16:25:02 UTC

Severity: wishlist

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 50679 <at> debbugs.gnu.org (full text, mbox):

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 50679 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#50679: 28.0.50; outline-minor-mode-cycle should be able to
 only cycle at the begining of a line
Date: Mon, 20 Sep 2021 20:36:54 +0200
On Mon, 20 Sep 2021 at 15:35, Philip Kaludercic <philipk <at> posteo.net> wrote:

> Juri Linkov <juri <at> linkov.net> writes:
>
>>>> I didn't necessarily propose anything, it might only be able to solve
>>>> this using a option like
>>>>
>>>>      (defcustom outline-minor-mode-cycle-predicate ...)
>>>>
>>>> as to allow for users to configure cycling as they see fit. Of course if
>>>> some consistent behaviour could be found that respects other options and
>>>> modes, then something automatic could also be used.
>>>
>>> Probably offloading the decision to the users with a customizable option
>>> is all what we can do here, indeed.
>>
>> Maybe something like:
>>
>>  (defvar outline-mode-cycle-map
>>    (let ((map (make-sparse-keymap)))
>>      (let ((tab-binding `(menu-item
>>                           "" outline-cycle
>>                           ;; Only takes effect if point is on a heading.
>>                           :filter ,(lambda (cmd)
>> -                                    (when (outline-on-heading-p) cmd)))))
>> +                                    (when (and (outline-on-heading-p)
>> +                                               (or (not (functionp outline-mode-cycle-filter))
>> +                                                   (funcall outline-mode-cycle-filter)))
>> +                                      cmd)))))
>>        (define-key map (kbd "TAB") tab-binding)
>>        (define-key map (kbd "<backtab>") #'outline-cycle-buffer))
>>      map)
>>
>> Then you can customize it to 'bolp'.
>
> I just tried it out, and it looks good. The only thing I wonder is if
> this should apply to both outline-minor-mode and outline-mode?

FWIW, I think it would be nice to provide a simple way to define other
“speed keys” in `outline-minor-mode [1], or even provide some
pre-configured ones [2].

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.

[1]: Cf. https://orgmode.org/manual/Speed-Keys.html

[2]: I personally use these speed keys in outline-minor-mode, which are
probably very similar to those from Org mode:

        "<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




This bug report was last modified 3 years and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.