emacs-devel
[Top][All Lists]
Advanced

[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: Sun, 07 Mar 2021 20:54:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> This is a great feature, thank you!  I could replace all my custom elisp
>> code that handles outline cycle/highlight on my init.el with the new
>> minor-modes, and everything has been working fine so far.
>>
>> I think that having only the variables is fine, I can't see any special
>> need for the minor-modes.
>>
>>> 4. (advice-add 'xref--insert-xrefs :after
>>>             (lambda (&rest _args)
>>>               (setq-local outline-regexp "/")
>>>               (outline-cycle-minor-mode +1)))
>>>    using file names as headings where S-TAB could provide
>>>    an overview of all found files
>>
>> The use of outline-minor-mode + cycle on xref buffers is one of my main
>> use cases. However, having to setup the outline-regexp and to add a
>> defadvice seems a dirty hack.  Should Emacs provide better defaults for
>> xref and other modes (like Gnus) for an easier integration with
>> outline-minor-mode ?
>
> Gnus has own outline-like commands like 'T H' that hides all threads.
> But in xref it should be easy to set the outline-regexp by default,
> and to add a hook to call when the xref output buffer is ready.

Now this should be added in bug#46992.

>> As another suggestion, would be nice to add more keybidings, for
>> example, to navigate between headers.
>
> Maybe bind more org-like bindings in outline-mode-cycle-map,
> e.g. ‘C-c C-n’ like ‘org-next-visible-heading’
> and ‘C-c C-p’ like ‘org-previous-visible-heading’.

Actually it's easy to customize such keys, e.g.:

(let ((map outline-mode-cycle-map)
      (cmds '(("C-c C-n"  outline-next-visible-heading)
              ("C-c C-p"  outline-previous-visible-heading))))
  (dolist (command cmds)
    (define-key map (kbd (nth 0 command))
      `(menu-item
        "" ,(nth 1 command)
        ;; Only takes effect if point is on a heading.
        :filter ,(lambda (cmd)
                   (when (outline-on-heading-p) cmd))))))



reply via email to

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