Ihor says:
> - visuwesh asked whether Org mode could have repeat maps for outline
>   navigation in Org mode (C-c C-n n n p n p ..., C-c C-f b f...)
>   - Such functionality has been added to outline-mode upstream
>   - Patches for Org mode equivalent are indeed welcome
>     - They do not even have to be the past weekend after the meetup
>       Any time will do ;)
>   - For now, we at least have speed keys as an alternative
>     https://orgmode.org/manual/Speed-Keys.html

Sorry for the month long delay.  I was busy with uni stuff so could not
find the time to invest into this properly.  I've attached a patch which
adds a repeat-map to org-keys.el but this pointed out that org-mode
lacks a org-up-heading command so I've resorted to using
outline-up-heading.

>From 8b980efcd9497e395f4d82a1304267ae4426b00d Mon Sep 17 00:00:00 2001
From: Visuwesh <visuwe...@gmail.com>
Date: Mon, 9 Sep 2024 19:46:47 +0530
Subject: [PATCH] Add repeat-mode keymap for navigation commands

* org-keys.el (org-navigation-repeat-map): Add repeat-map to make
navigation easier when repeat-mode is turned on.
---
 lisp/org-keys.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index 1daedaae8..ec32d212d 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -462,6 +462,25 @@ (org-defkey org-mode-map (kbd "C-S-<left>") #'org-shiftcontrolleft)
 (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 "C-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 "C-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 "C-n") #'org-next-visible-heading)
+(org-defkey org-navigation-repeat-map (kbd "p") #'org-previous-visible-heading)
+(org-defkey org-navigation-repeat-map (kbd "C-p") #'org-previous-visible-heading)
+(declare-function outline-up-heading "outline" (arg &optional invisible-ok))
+(org-defkey org-navigation-repeat-map (kbd "u") #'outline-up-heading)
+(org-defkey org-navigation-repeat-map (kbd "C-u") #'outline-up-heading)
+(map-keymap
+ (lambda (_key cmd)
+   (put cmd 'repeat-map 'org-navigation-repeat-map))
+ org-navigation-repeat-map)
+
 ;;;; Extra keys for TTY access.
 
 ;;  We only set them when really needed because otherwise the
-- 
2.45.2

Emacs  : GNU Emacs 31.0.50 (build 5, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.18.0, Xaw scroll bars)
 of 2024-08-15
Package: Org mode version 9.8-pre (release_9.7.8-713-g62cbac @ 
/home/viz/lib/emacs/straight/build/org/)

Reply via email to