unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Juri Linkov <juri@linkov.net>
Cc: 47878@debbugs.gnu.org
Subject: bug#47878: Mark outline commands as repeatable
Date: Wed, 21 Apr 2021 20:50:59 +0000	[thread overview]
Message-ID: <87k0ovuzt8.fsf@posteo.net> (raw)
In-Reply-To: <87r1j3h37d.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  21 Apr 2021 22:20:27 +0300")

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

Juri Linkov <juri@linkov.net> writes:

>> I am not sure if these two maps are necessarily detached. When I want to
>> move a few subtrees, it might be natural for me to assume that I can
>> also move between them without having to invoke C-x @ ... again.
>
> Ok, let's put navigation and editing keys into one repeatable keymap
> (maybe without outline-insert-heading and outline-mark-subtree).
>
>> That makes sense, I just found out about outline-minor-mode-cycle and it
>> probably does make these keys superfluous for most uses. Removing these
>> keys seems to also open up a lot of key bindings that would otherwise
>> maybe annoy users if they are bound in transient maps (especially C-a,
>> C-e, C-k, C-s, C-c).
>
> Indeed, these are among the most frequently used keys.

I've implemented your suggestions. Letting the editing map inherit from
the navigation map doesn't seem like a good idea, as long as repeat-mode
overwrites the repeat-map, because that makes commands disappear all of
a sudden. The extra keys without control are convenient, but it does
write a lot into the mini-buffer.

-- 
	Philip K.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-outline-commands-repeatable.patch --]
[-- Type: text/x-diff, Size: 2472 bytes --]

From df388bbf31f7970fe38190503b20eb60e944e131 Mon Sep 17 00:00:00 2001
From: Philip K <philipk@posteo.net>
Date: Wed, 21 Apr 2021 22:17:27 +0200
Subject: [PATCH] Make outline commands repeatable

* outline.el (outline-navigation-repeat-map): Add new map
(outline-editing-repeat-map): Add new map
---
 lisp/outline.el | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/lisp/outline.el b/lisp/outline.el
index bce9c6b9e4..fa7c1a27d9 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1274,6 +1274,45 @@ outline-cycle-buffer
       (setq outline--cycle-buffer-state 'show-all)
       (message "Show all")))))
 
+(defvar outline-navigation-repeat-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-b") #'outline-backward-same-level)
+    (define-key map (kbd "b") #'outline-backward-same-level)
+    (define-key map (kbd "C-f") #'outline-forward-same-level)
+    (define-key map (kbd "f") #'outline-forward-same-level)
+    (define-key map (kbd "C-n") #'outline-next-visible-heading)
+    (define-key map (kbd "n") #'outline-next-visible-heading)
+    (define-key map (kbd "C-p") #'outline-previous-visible-heading)
+    (define-key map (kbd "p") #'outline-previous-visible-heading)
+    (define-key map (kbd "C-u") #'outline-up-heading)
+    (define-key map (kbd "u") #'outline-up-heading)
+    map))
+
+(dolist (command '(outline-backward-same-level
+                   outline-forward-same-level
+                   outline-next-visible-heading
+                   outline-previous-visible-heading
+                   outline-up-heading))
+  (put command 'repeat-map 'outline-navigation-repeat-map))
+
+(defvar outline-editing-repeat-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-v") #'outline-move-subtree-down)
+    (define-key map (kbd "v") #'outline-move-subtree-down)
+    (define-key map (kbd "C-^") #'outline-move-subtree-up)
+    (define-key map (kbd "^") #'outline-move-subtree-up)
+    (define-key map (kbd "C->") #'outline-demote)
+    (define-key map (kbd ">") #'outline-demote)
+    (define-key map (kbd "C-<") #'outline-promote)
+    (define-key map (kbd "<") #'outline-promote)
+    map))
+
+(dolist (command '(outline-move-subtree-down
+                   outline-move-subtree-up
+                   outline-demote
+                   outline-promote))
+  (put command 'repeat-map 'outline-editing-repeat-map))
+
 (provide 'outline)
 (provide 'noutline)
 
-- 
2.30.2


  reply	other threads:[~2021-04-21 20:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 19:00 bug#47878: Mark outline commands as repeatable Philip Kaludercic
2021-04-19 20:45 ` Juri Linkov
2021-04-21 13:53   ` Philip Kaludercic
2021-04-21 19:20     ` Juri Linkov
2021-04-21 20:50       ` Philip Kaludercic [this message]
2021-04-21 21:15         ` Juri Linkov
2021-05-03 10:30           ` Lars Ingebrigtsen
2021-05-03 16:44             ` Juri Linkov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87k0ovuzt8.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=47878@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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 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).