From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id +O4CFhkl6GbW9wAA62LTzQ:P1 (envelope-from ) for ; Mon, 16 Sep 2024 12:31:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id +O4CFhkl6GbW9wAA62LTzQ (envelope-from ) for ; Mon, 16 Sep 2024 14:31:21 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=WYuMLqeV; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726489881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=li7HmotQOtugLCod/msZ1bXOIaAy3lVXn9U+QTOSpGM=; b=FwIit6Hj/NP8yrrgdl8fy/e/f9EwRV0gbIOp+1jGj6jTUAwOuYKhi5YG/TuiwZdASC/90k t83W/xoBsiJgLEpiXdkGvGLsgx/vdpEJDVjdOMgGMsZGrPFaq3DlRa7UnJ0LeZrLifsAXr GGiKQtfmoNmh4Yq39W3E0kKwkVf7JqPMTNO0S+1hyhpaUQnL9mLSG0DyTTzOikqK6qsXSQ sPHrmwF6lCGABhHTN7bOoqEDEtf+fn5fo8EEloeHjgQvRXejIQhsWVZu3DUDxnFycg7C6z zhx9SQ1qGWj/RR3JW9TF4VQEbhW53gfnPKEpsIHy8VChEq1dNSc/OroerLNkFg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726489881; a=rsa-sha256; cv=none; b=LKJucsWX4p+bQb84zFuULEnL7j39vU6f9sBdUSD5QmSSs3CMZWF75M+UZaFZB6DICeVmDi x+Ke4R//H4Rwa1FRt1wbZhEO2MNYLxLNQuP1CropFFFa9yd8yPtgLGov3B69r+kSsFK4L0 mZB3eLHjvyjRFf/BfYu2cVMOWLg5jo50a2qbQeXTWgXPO+nuk4JBAoSL4fdRXuyqpn74jq bW0axUBT47WuBmUSko/w1hcHMPUsdxEc8XJq1P3AYa4u8KIYi8tsi3jFBz1bZ+WujJvz5p n9uMB9mpyyaYRzjeTXoA+E1D51vE92pdFV18UwjQVQ9CtC61EFyPlm0fV9npRA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=WYuMLqeV; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1781717C8C for ; Mon, 16 Sep 2024 14:31:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqAs1-00073r-D3; Mon, 16 Sep 2024 08:30:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqAry-0006vM-UL for emacs-orgmode@gnu.org; Mon, 16 Sep 2024 08:30:19 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqArk-0001n1-9M for emacs-orgmode@gnu.org; Mon, 16 Sep 2024 08:30:18 -0400 Received: by mail-pl1-x643.google.com with SMTP id d9443c01a7336-2068a7c9286so32974345ad.1 for ; Mon, 16 Sep 2024 05:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726489802; x=1727094602; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=WOs/RKHBynfvAWXQseIgwrfERX4WSakfXrytF2GgvmQ=; b=WYuMLqeVC/uI1CD0fBvKJrU4SfeTTEosn2VcX6uAuns6M0bbrwfjuvRR8dpHbGjXTE ed8dAoS/2X7ea4ZFbV19OIGFzqOC+GAdAKYdAYWpBhz0gyom2PTS672pDSibkD9N0oQT 7YUdD5kGQz3PAoWQxtZr5BLS3FAJx2LZpHsPeL/eHqFotZPBkMFCKaGWGhUV5riy3X8d D+7sh2Pe2RIvVqC8TUoVkJbrh/yNc7Qdw6ZKuWKEBxY1s4QvwWKLFOqu74A4FUOkV+k+ w3dMbPBST/TaMDCyyzMrcEzxCWvPqD8C51OF20lkS3+PeoHkbBmoI/eSMlLzGEdrT6c8 toRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726489802; x=1727094602; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WOs/RKHBynfvAWXQseIgwrfERX4WSakfXrytF2GgvmQ=; b=LnJCxteHa9/WennvYgD6TmTEeMT/3XKcIicr7hZxncDTggZXQ6vLz14cKR1WX6B6r9 9aatPk+XDdjyhw9oVJgW+/KfH/0IsGD1fxS0nO9xTS8vUPV6rsnN5dC/TVAUp5zYTA3a 3KBCwoRCG9IZU8iysTwLdH720gVao5icJdWUus94IFybDs6r16RhMgtCcajACLI+V2MX n1Fhv/+UtNTs5LC1ao7/wDo1FhkCyZEwjrVneaabRlJSkcoislP1Txpfso69C1tZ3p0I Nn6pkuVv1I6lxUwqSZjRzRBPzqXQS62Q6DcJvkqeu0Rf3FrB4/93uulczTZjz68U1zUZ ibXA== X-Gm-Message-State: AOJu0YzSrtSK+urQG8ChUmecVBIuT1kZWKY575kLW3MZ02sHTAdA0alw ef2uDjavnYTpbJ+GkbcEq2hyIsY9h+DsOrBv911XndofuBYi48GlSRi7MkgT X-Google-Smtp-Source: AGHT+IGZdEdET3CC95wxwhoTQkFN8o5ndEIP3GTxSQcw1CbLkWHYnK21WeS+USW/yj6XSzTjOfpVEA== X-Received: by 2002:a17:902:7041:b0:205:721f:ec6f with SMTP id d9443c01a7336-20782535e1cmr140234675ad.35.1726489802112; Mon, 16 Sep 2024 05:30:02 -0700 (PDT) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2079460574esm35090615ad.109.2024.09.16.05.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 05:30:01 -0700 (PDT) From: Visuwesh To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add repeat-map for navigation commands In-Reply-To: <87cyl53vzx.fsf@localhost> (Ihor Radchenko's message of "Sun, 15 Sep 2024 13:08:18 +0000") References: <877cbkoqkt.fsf@gmail.com> <8734m8rcoh.fsf@localhost> <87wmjk6qk8.fsf@gmail.com> <87cyl53vzx.fsf@localhost> Date: Mon, 16 Sep 2024 17:59:57 +0530 Message-ID: <87r09jwzlm.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x643.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.40 X-Migadu-Queue-Id: 1781717C8C X-Spam-Score: -5.40 X-TUID: 1YZrzppP/7FK --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=9A=E0=AF=86= =E0=AE=AA=E0=AF=8D=E0=AE=9F=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 15= , 2024] Ihor Radchenko wrote: > Visuwesh writes: > >> BTW, should we add C-n and friends to org-navigation-repeat-map or just >> have n, p, etc.? I personally find C-n in the repeat-map disruptive >> since I usually want to move the cursor after jumping to a specific >> heading, in which case C-n not being next-line is annoying. > > +1 for less disruptive :) Please find attached. I tried my best to write the manual entry but it still reads awkward. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-repeat-mode-keymap-for-navigation-commands.patch >From c66ff969e23d0d29746941383e5afa54d0e9e060 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Mon, 9 Sep 2024 19:46:47 +0530 Subject: [PATCH] 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. --- doc/org-manual.org | 14 ++++++++++++++ etc/ORG-NEWS | 6 ++++++ lisp/org-keys.el | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index 9365c66b1..254764c31 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -21657,6 +21657,20 @@ 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, +when navigation to the next headline using {{{kbd(C-c C-n)}}}, a +repeat map is activated that lets you quickly execute headline motion +commands. When a key not in the map is pressed, it exits ~repeat-mode~ +and the command corresponding to the key is executed. + * Hacking :PROPERTIES: :DESCRIPTION: How to hack your way around. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 392788055..8acc2f6b4 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -77,6 +77,12 @@ 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, certain navigation can be repeated. +These include the headline navigation commands, ~org-next-link~ and +~org-previous-link~, and ~org-next-block~ and ~org-previous-block~. + ** New and changed options # Chanes deadling with changing default values of customizations, diff --git a/lisp/org-keys.el b/lisp/org-keys.el index 1daedaae8..f6de753af 100644 --- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -232,6 +232,7 @@ (declare-function org-up-element "org" ()) (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 @@ (define-key org-mode-map [remap outline-next-visible-heading] (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 @@ (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontrolleft) (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontrolup) (org-defkey org-mode-map (kbd "C-S-") #'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 -- 2.45.2 --=-=-=--