all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Add repeat-map for navigation commands
Date: Mon, 09 Sep 2024 19:51:38 +0530	[thread overview]
Message-ID: <877cbkoqkt.fsf@gmail.com> (raw)

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

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-repeat-mode-keymap-for-navigation-commands.patch --]
[-- Type: text/x-diff, Size: 1993 bytes --]

From 8b980efcd9497e395f4d82a1304267ae4426b00d Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@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


[-- Attachment #3: Type: text/plain, Size: 228 bytes --]


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	other threads:[~2024-09-09 14:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 14:21 Visuwesh [this message]
2024-09-09 16:53 ` [PATCH] Add repeat-map for navigation commands Ihor Radchenko
2024-09-10  1:36   ` Karthik Chikmagalur
2024-09-15 12:54     ` Ihor Radchenko
2024-09-10  5:11   ` Visuwesh
2024-09-15 13:08     ` Ihor Radchenko
2024-09-16 12:29       ` Visuwesh
2024-09-22 11:48         ` Ihor Radchenko
2024-09-22 12:58           ` Visuwesh
2024-09-22 15:43             ` Ihor Radchenko
2024-10-06 11:42           ` Visuwesh
2024-10-12 17:56             ` Ihor Radchenko
2024-10-12 18:16               ` Visuwesh

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=877cbkoqkt.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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.