unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1598: Please add easy key bindings for outline-(minor-)mode
@ 2008-12-17  9:57 Teemu Likonen
  2008-12-17 16:20 ` Stefan Monnier
  2021-07-19 15:04 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Teemu Likonen @ 2008-12-17  9:57 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

This is a "wishlist" bug with an example code to solve the issue.

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'll attach a code that I use. It works as I explained above. The code
is partly written by me but it's based on a code on Emacs wiki page:

    http://www.emacswiki.org/emacs/OutlineMinorMode

In the Emacs wiki the original code is titled "Explorer like
Key-Bindings" and my modified version is "Variation of Explorer-like
bindings". The latter is attached to this message). The code is licensed
with the usual Emacs wiki license (see the bottom of the web page):

    This work is licensed to you under version 2 of the GNU General
    Public License. Alternatively, you may choose to receive this work
    under any other license that grants the right to use, copy, modify,
    and/or distribute the work, as long as that license imposes the
    restriction that derivative works have to grant the same rights and
    impose the same restriction. For example, you may choose to receive
    this work under the GNU Free Documentation License, the
    CreativeCommons ShareAlike License, the XEmacs manual license, or
    similar licenses.

[-- Attachment #2: Outline-mode easy key-bindings --]
[-- Type: application/emacs-lisp, Size: 2427 bytes --]

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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  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
  1 sibling, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2008-12-17 16:20 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 1598

severity 1598 wishlist
thanks

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

Have you tried org-mode?  It's a superset of outline-mode with a magic
TAB key to show/hide subparts.

Personally I use outline-minor-mode with reveal-mode, so that the
hiding/showing is done automatically as I move around the buffer.
Since the ESP communication is broken right now, it doesn't always do
quite what I want, but I like it.  YMMV.

So, I agree with you that outline-(minor-)mode's key bindings
aren't great.  This said, using M-next and such for a minor mode is
problematic (can interact with the underlying major mode), so such
bindings should at least depend on a user setting.


        Stefan





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

* Processed: Re: bug#1598: Please add easy key bindings for outline-(minor-)mode
  2008-12-17 16:20 ` Stefan Monnier
@ 2008-12-17 16:30   ` Emacs bug Tracking System
  2008-12-17 16:49   ` Teemu Likonen
  1 sibling, 0 replies; 8+ messages in thread
From: Emacs bug Tracking System @ 2008-12-17 16:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Bugs

Processing commands for control@emacsbugs.donarmstrong.com:

> severity 1598 wishlist
bug#1598: Please add easy key bindings for outline-(minor-)mode
Severity set to `wishlist' from `normal'

> thanks
Stopping processing here.

Please contact me if you need assistance.

Don Armstrong
(administrator, Emacs bugs database)




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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  2008-12-17 16:20 ` Stefan Monnier
  2008-12-17 16:30   ` Processed: " Emacs bug Tracking System
@ 2008-12-17 16:49   ` Teemu Likonen
  1 sibling, 0 replies; 8+ messages in thread
From: Teemu Likonen @ 2008-12-17 16:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1598

Stefan Monnier (2008-12-17 11:20 -0500) wrote:

> Have you tried org-mode? It's a superset of outline-mode with a magic
> TAB key to show/hide subparts.

Oh yes, org-mode is great. I use it when I need outlining with a pure
human-language text. But I also need outline-minor-mode with other major
modes, usually with AucTex's LaTeX-mode and without quick and easy
outline navigation the whole outline is too inconvenient to be really
usable.

Only a couple of months ago I switched from Vim to Emacs, and since Vim
has really easy and convenient outlining features (called folding) it
was quite a shock to see Emacs's implementation. Fortunately I managed
to fix it and I'm really happy with my solution, but I'd also like to
see Emacs improve so this is why I sent this wishlist report.

> So, I agree with you that outline-(minor-)mode's key bindings aren't
> great. This said, using M-next and such for a minor mode is
> problematic (can interact with the underlying major mode), so such
> bindings should at least depend on a user setting.

I guess you are right that M-<arrow keys> may be too intrusive for a
minor mode. Perhaps an user option for turning them on (off by default)
and two menu entries like "Hide more" and "Show more". Also,
outline-mode and outline-minor-mode functions' documentation could
advertise these interactive outline-do-close and outline-do-open
functions (or whatever they would be called).






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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  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
@ 2021-07-19 15:04 ` Lars Ingebrigtsen
  2021-07-19 15:33   ` Christopher Dimech
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-19 15:04 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: 1598

Teemu Likonen <tlikonen@iki.fi> writes:

> 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'm going through old bug reports that unfortunately wasn't resolved at
the time.)

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.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  2021-07-19 15:04 ` Lars Ingebrigtsen
@ 2021-07-19 15:33   ` Christopher Dimech
  2021-07-19 15:34   ` Juri Linkov
  2021-07-19 15:55   ` Kévin Le Gouguec
  2 siblings, 0 replies; 8+ messages in thread
From: Christopher Dimech @ 2021-07-19 15:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Teemu Likonen, 1598

Lars, I have been scrutinising outline-minor-mode for some time now.

One thing I found that can help in hiding and exposing parts in the following
function

(defun gilgamesh-entry-sweep ()
   "todo"
   (interactive)

   (when (not (eq last-command this-command))
     (put this-command 'state 0))

   (cond
      ;; .....................................................
      ;; show subheadings
      ((equal 0 (get this-command 'state))
          (outline-show-branches)
          (message "Expose Sub-Headings,  Next: Expose Body")
          (put this-command 'state 2))
      ;; .....................................................
      ;; show body of heading
      ((equal 1 (get this-command 'state))
          (outline-show-entry)
          (message "Expose Body,  Next: Expose Sub-Headings")
          (put this-command 'state 1))
      ;; .....................................................
      ;; show subheadings with bodies
      ((equal 2 (get this-command 'state))
          (outline-show-subtree)
          (message "Expose Sub-Bodies, Next: hide-subtree")
          (put this-command 'state 3))
      ;; .....................................................
      ;; hide subheadings
      ((equal 3 (get this-command 'state))
          (outline-hide-subtree)
          (message "hide-subtree, Next: show-entry")
          (put this-command 'state 0)) ))


You could try to improve on this (on how best the hiding showing works out).
Users can then add a keybinding they wish.


> Sent: Tuesday, July 20, 2021 at 3:04 AM
> From: "Lars Ingebrigtsen" <larsi@gnus.org>
> To: "Teemu Likonen" <tlikonen@iki.fi>
> Cc: 1598@debbugs.gnu.org
> Subject: bug#1598: Please add easy key bindings for outline-(minor-)mode
>
> Teemu Likonen <tlikonen@iki.fi> writes:
>
> > 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'm going through old bug reports that unfortunately wasn't resolved at
> the time.)
>
> 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.
>
> So I'm closing this bug report.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
>
>
>





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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  2021-07-19 15:04 ` Lars Ingebrigtsen
  2021-07-19 15:33   ` Christopher Dimech
@ 2021-07-19 15:34   ` Juri Linkov
  2021-07-19 15:55   ` Kévin Le Gouguec
  2 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2021-07-19 15:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Teemu Likonen, 1598

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





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

* bug#1598: Please add easy key bindings for outline-(minor-)mode
  2021-07-19 15:04 ` Lars Ingebrigtsen
  2021-07-19 15:33   ` Christopher Dimech
  2021-07-19 15:34   ` Juri Linkov
@ 2021-07-19 15:55   ` Kévin Le Gouguec
  2 siblings, 0 replies; 8+ messages in thread
From: Kévin Le Gouguec @ 2021-07-19 15:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Teemu Likonen, 1598

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Teemu Likonen <tlikonen@iki.fi> writes:
>
>> 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'm going through old bug reports that unfortunately wasn't resolved at
> the time.)
>
> 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.

Also, FWIW, Emacs 28 now makes it possible to use TAB and S-TAB in
outline-minor-mode by setting outline-minor-mode-cycle.  That doesn't
address navigation, but at least it brings outline-minor-mode on par
with Org in terms of ergonomy for cycling levels.





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

end of thread, other threads:[~2021-07-19 15:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-07-19 15:55   ` Kévin Le Gouguec

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