all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Teemu Likonen <tlikonen@iki.fi>, 1598@debbugs.gnu.org
Subject: bug#1598: Please add easy key bindings for outline-(minor-)mode
Date: Mon, 19 Jul 2021 18:34:11 +0300	[thread overview]
Message-ID: <874kcql3m4.fsf@mail.linkov.net> (raw)
In-Reply-To: <87sg0amjkm.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 19 Jul 2021 17:04:09 +0200")

>> The default key bindings for outline-mode and outline-minor-mode are
>> difficult to remember and slow to use. I think the main reason is that
>> there are way too many different key-bindings to operate with outlining.
>>
>> I suggest that you make keys like M-<left> and M-<right> to act modally
>> so that they open and close one outline level at the time depending on
>> which levels and bodies are currently visible. In addition to that, and
>> to make outline navigating easy, M-<up> and M-<down> could move the
>> cursor to previous and next visible outline header.
>
> I agree that the outline commands are pretty awkward...  but outline
> minor mode is used in a large number of major modes, and has to be
> consistent throughout all those modes.  So M-<arrows> can't really be
> used for this, I think.

For personal customization of keys in outline-minor-mode
now there is outline-mode-cycle-map.  Currently I'm experimenting
with using M-<arrows>, but still these keys conflict with some modes,
so M-<arrows> can't be bound by default.
Anyway, here is an example of customization:

#+begin_src emacs-lisp
(setq-default
 outline-minor-mode-cycle t
 outline-minor-mode-highlight t)

(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)
        ;; Only takes effect if point is on a heading.
        :filter ,(lambda (cmd)
                   (when (and (outline-on-heading-p)
                              ;; Exclude emacs-lisp-mode:
                              ;; outline-minor-mode-highlight
                              ;; BETTER:
                              ;; (buffer-file-name (current-buffer))
                              buffer-read-only
                              )
                     cmd))))))
#+end_src





  parent reply	other threads:[~2021-07-19 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17  9:57 bug#1598: Please add easy key bindings for outline-(minor-)mode Teemu Likonen
2008-12-17 16:20 ` Stefan Monnier
2008-12-17 16:30   ` Processed: " Emacs bug Tracking System
2008-12-17 16:49   ` Teemu Likonen
2021-07-19 15:04 ` Lars Ingebrigtsen
2021-07-19 15:33   ` Christopher Dimech
2021-07-19 15:34   ` Juri Linkov [this message]
2021-07-19 15:55   ` Kévin Le Gouguec

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kcql3m4.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=1598@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=tlikonen@iki.fi \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.