unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Duplicated outline-cycle binding, and problems with the new one
@ 2021-12-31 23:32 Yuan Fu
  2022-01-02 18:25 ` Juri Linkov
  0 siblings, 1 reply; 11+ messages in thread
From: Yuan Fu @ 2021-12-31 23:32 UTC (permalink / raw)
  To: Emacs developers

When outline-cycle was originally added, I think we only added this

(defvar outline-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map "\C-c" outline-mode-prefix-map)
    (define-key map [menu-bar] outline-mode-menu-bar-map)
    ;; Only takes effect if point is on a heading.
    (define-key map (kbd "TAB")
      `(menu-item "" outline-cycle
                  :filter ,(lambda (cmd)
                             (when (outline-on-heading-p) cmd))))
    (define-key map (kbd "<backtab>") #'outline-cycle-buffer)
    map))

So ‘outline-cycle’ takes effect when point is on a heading. Now in addition to this, I also see

(defvar outline-minor-mode-cycle-map
  (let ((map (make-sparse-keymap)))
    (outline-minor-mode-cycle--bind map (kbd "TAB") #'outline-cycle)
    (outline-minor-mode-cycle--bind map (kbd "<backtab>") #'outline-cycle-buffer)
    map)
  "Keymap used by `outline-minor-mode-cycle'.”)

Which presumably are applied as keymap text properties to headings in a buffer. I’m having problems with this: some text that are not headings in my buffer are incorrectly propertied with this keymap, and when I try to indent with TAB, outline-cycle is invoked.

Overall, from my limited knowledge, I think the old approach is more reliable: I wouldn’t have this problem with the old approach. And the new functionality added by the new approach and outline-minor-mode-cycle-filter can be easily implemented in the old approach. We don’t need to fiddle with font-lock-keywords with the old approach, either. How about we go back to the old approach? Juri, WDYT?

Yuan




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-10 18:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 23:32 Duplicated outline-cycle binding, and problems with the new one Yuan Fu
2022-01-02 18:25 ` Juri Linkov
2022-01-02 19:07   ` Stefan Monnier
2022-01-02 19:18     ` Juri Linkov
2022-01-04  1:40       ` Yuan Fu
2022-01-05 18:35     ` Juri Linkov
2022-01-05 19:21       ` Stefan Monnier
2022-01-06 18:56         ` Juri Linkov
2022-01-09 22:55           ` Yuan Fu
2022-01-10  8:21             ` Juri Linkov
2022-01-10 18:30               ` Juri Linkov

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