Add repeat-mode keymap for navigation commands
* lisp/org-keys.el (org-up-heading): Add new alias for `outline-up-heading'. (org-mode-map): Remap `outline-up-heading' to the new alias. (org-navigation-repeat-map, org-link-navigation-repeat-map) (org-block-navigation-repeat-map): Add new repeat-maps to make navigation easier. * doc/org-manual.org (Repeating commands): Document the new feature in the manual. * etc/ORG-NEWS (Some navigation commands can now be repeated): Announce it.
This commit is contained in:
parent
11cf3b6daf
commit
b6a72e134d
|
@ -21658,6 +21658,49 @@ of ~org-yank-dnd-method~. Image files pasted this way also respect
|
|||
the value of ~org-yank-image-save-method~ when the action to perform
|
||||
is =attach=.
|
||||
|
||||
** Repeating commands
|
||||
:PROPERTIES:
|
||||
:DESCRIPTION: Repeating navigation commands
|
||||
:END:
|
||||
|
||||
#+cindex: repeat-mode, org-mode
|
||||
#+cindex: repeating navigation commands
|
||||
When ~repeat-mode~ is turned on, headline motion commands, link and
|
||||
block navigation commands by only pressing a single key. For example,
|
||||
instead of typing {{{kbd(C-c C-n)}}} repeatedly, you can just type
|
||||
{{{kbd(C-c C-n n n n p u ...)}}} to move to different headlines. When
|
||||
a key not in the map is pressed, it exits ~repeat-mode~ and the
|
||||
command corresponding to the key is executed (see the
|
||||
[[info:emacs#Repeating][Emacs user manual]] for more details).
|
||||
|
||||
By default, the following commands are made repeatable in separate
|
||||
keymaps.
|
||||
|
||||
~org-navigation-repeat-map~:
|
||||
|
||||
| Command | Key binding | Repeat key |
|
||||
|-----------------------------------+--------------------+--------------|
|
||||
| ~org-next-visible-heading~ | {{{kbd(C-c C-n)}}} | {{{kbd(n)}}} |
|
||||
| ~org-previous-visible-heading~ | {{{kbd(C-c C-p)}}} | {{{kbd(p)}}} |
|
||||
| ~org-forward-heading-same-level~ | {{{kbd(C-c C-f)}}} | {{{kbd(f)}}} |
|
||||
| ~org-backward-heading-same-level~ | {{{kbd(C-c C-b)}}} | {{{kbd(b)}}} |
|
||||
| ~org-up-heading~ | {{{kbd(C-c C-u)}}} | {{{kbd(u)}}} |
|
||||
|
||||
|
||||
~org-block-navigation-repeat-map~:
|
||||
|
||||
| Command | Key binding | Repeat key |
|
||||
|----------------------+--------------------+--------------|
|
||||
| ~org-next-block~ | {{{kbd(C-c M-f)}}} | {{{kbd(f)}}} |
|
||||
| ~org-previous-block~ | {{{kbd(C-c M-b)}}} | {{{kbd(b)}}} |
|
||||
|
||||
~org-link-navigation-repeat-map~:
|
||||
|
||||
| Command | Key binding | Repeat key |
|
||||
|---------------------+------------------------+--------------|
|
||||
| ~org-next-link~ | {{{kbd(C-c C-x C-n)}}} | {{{kbd(n)}}} |
|
||||
| ~org-previous-link~ | {{{kbd(C-c C-x C-p)}}} | {{{kbd(p)}}} |
|
||||
|
||||
* Hacking
|
||||
:PROPERTIES:
|
||||
:DESCRIPTION: How to hack your way around.
|
||||
|
|
23
etc/ORG-NEWS
23
etc/ORG-NEWS
|
@ -91,6 +91,29 @@ You can now create links to =shortdoc= documentation groups for Emacs
|
|||
Lisp functions (see =M-x shortdoc-display-group=). Requires Emacs 28
|
||||
or newer.
|
||||
|
||||
*** Some navigation commands can now be repeated
|
||||
|
||||
When ~repeat-mode~ is turned on, the following navigation commands can
|
||||
be repeated:
|
||||
|
||||
| Command | Key binding | Repeat key |
|
||||
|-----------------------------------+------------------------+--------------|
|
||||
| ~org-next-visible-heading~ | {{{kbd(C-c C-n)}}} | {{{kbd(n)}}} |
|
||||
| ~org-previous-visible-heading~ | {{{kbd(C-c C-p)}}} | {{{kbd(p)}}} |
|
||||
| ~org-forward-heading-same-level~ | {{{kbd(C-c C-f)}}} | {{{kbd(f)}}} |
|
||||
| ~org-backward-heading-same-level~ | {{{kbd(C-c C-b)}}} | {{{kbd(b)}}} |
|
||||
| ~org-up-heading~ | {{{kbd(C-c C-u)}}} | {{{kbd(u)}}} |
|
||||
| ~org-next-block~ | {{{kbd(C-c M-f)}}} | {{{kbd(f)}}} |
|
||||
| ~org-previous-block~ | {{{kbd(C-c M-b)}}} | {{{kbd(b)}}} |
|
||||
| ~org-next-link~ | {{{kbd(C-c C-x C-n)}}} | {{{kbd(n)}}} |
|
||||
| ~org-previous-link~ | {{{kbd(C-c C-x C-p)}}} | {{{kbd(p)}}} |
|
||||
|
||||
The keybindings in the repeat-maps can be changed by customizing
|
||||
~org-navigation-repeat-map~, ~org-link-navigation-repeat-map~, and
|
||||
~org-block-navigation-repeat-map~.
|
||||
|
||||
See the new [[info:org#Repeating commands]["Repeating commands"]] section in Org mode manual.
|
||||
|
||||
** New and changed options
|
||||
|
||||
# Chanes deadling with changing default values of customizations,
|
||||
|
|
|
@ -232,6 +232,7 @@
|
|||
(declare-function org-update-statistics-cookies "org" (all))
|
||||
(declare-function org-yank "org" (&optional arg))
|
||||
(declare-function orgtbl-ascii-plot "org-table" (&optional ask))
|
||||
(declare-function outline-up-heading "outline" (arg &optional invisible-ok))
|
||||
|
||||
|
||||
|
||||
|
@ -409,6 +410,8 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
|
|||
(define-key org-mode-map [remap outline-previous-visible-heading]
|
||||
#'org-previous-visible-heading)
|
||||
(define-key org-mode-map [remap outline-show-children] #'org-fold-show-children)
|
||||
(defalias 'org-up-heading #'outline-up-heading)
|
||||
(define-key org-mode-map [remap outline-up-heading] #'org-up-heading)
|
||||
|
||||
;;;; Make `C-c C-x' a prefix key
|
||||
(org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
|
||||
|
@ -462,6 +465,37 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
|
|||
(org-defkey org-mode-map (kbd "C-S-<up>") #'org-shiftcontrolup)
|
||||
(org-defkey org-mode-map (kbd "C-S-<down>") #'org-shiftcontroldown)
|
||||
|
||||
;;; Repeat-mode map.
|
||||
(defvar org-navigation-repeat-map (make-sparse-keymap)
|
||||
"Repeat keymap for navigation commands.")
|
||||
(org-defkey org-navigation-repeat-map (kbd "b") #'org-backward-heading-same-level)
|
||||
(org-defkey org-navigation-repeat-map (kbd "f") #'org-forward-heading-same-level)
|
||||
(org-defkey org-navigation-repeat-map (kbd "n") #'org-next-visible-heading)
|
||||
(org-defkey org-navigation-repeat-map (kbd "p") #'org-previous-visible-heading)
|
||||
(org-defkey org-navigation-repeat-map (kbd "u") #'org-up-heading)
|
||||
(map-keymap
|
||||
(lambda (_key cmd)
|
||||
(put cmd 'repeat-map 'org-navigation-repeat-map))
|
||||
org-navigation-repeat-map)
|
||||
|
||||
(defvar org-link-navigation-repeat-map (make-sparse-keymap)
|
||||
"Repeat keymap for link navigation commands.")
|
||||
(org-defkey org-link-navigation-repeat-map (kbd "n") #'org-next-link)
|
||||
(org-defkey org-link-navigation-repeat-map (kbd "p") #'org-previous-link)
|
||||
(map-keymap
|
||||
(lambda (_ cmd)
|
||||
(put cmd 'repeat-map 'org-link-navigation-repeat-map))
|
||||
org-link-navigation-repeat-map)
|
||||
|
||||
(defvar org-block-navigation-repeat-map (make-sparse-keymap)
|
||||
"Repeat keymap for block navigation commands.")
|
||||
(org-defkey org-block-navigation-repeat-map (kbd "f") #'org-next-block)
|
||||
(org-defkey org-block-navigation-repeat-map (kbd "b") #'org-previous-block)
|
||||
(map-keymap
|
||||
(lambda (_ cmd)
|
||||
(put cmd 'repeat-map 'org-block-navigation-repeat-map))
|
||||
org-block-navigation-repeat-map)
|
||||
|
||||
;;;; Extra keys for TTY access.
|
||||
|
||||
;; We only set them when really needed because otherwise the
|
||||
|
|
Loading…
Reference in New Issue