bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#50679: 28.0.50; outline-minor-mode-cycle should be able to only cycl


From: Juri Linkov
Subject: 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 18:25:09 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> 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'.





reply via email to

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