emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Thorsten Jolitz <tjolitz@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Call speed-commands with prefix-arg?
Date: Tue, 23 Sep 2014 13:58:52 -0400	[thread overview]
Message-ID: <87sijinrqb.fsf@gmail.com> (raw)
In-Reply-To: <87y4thtece.fsf@gmail.com>

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

Hi Thorsten,

2014ko irailak 18an, Thorsten Jolitz-ek idatzi zuen:
> 
> Hi List, 
> 
> is there a way to call Org speed-commands [fn:1] with a prefix-arg?
> Does not work for me ...

The attached patch should allow this.  You can use C-u N X or C-N X (where
N is some digits and X a speed command key).  I’ll commit it to master in a
few days (along with an entry in ORG-NEWS), unless there is any
feedback.

It might be cool to also allow digits 0-9 and hyphen (for minus) to work
as prefix args when in speed command position.  But that’s more
complicated.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-allow-speed-commands-to-have-prefix-args.patch --]
[-- Type: text/x-diff, Size: 1079 bytes --]

From f4abc5c57764fc36d7405be6b6c2f5cd63396d8d Mon Sep 17 00:00:00 2001
From: Aaron Ecay <aaronecay@gmail.com>
Date: Tue, 23 Sep 2014 13:54:47 -0400
Subject: [PATCH] allow speed commands to have prefix args

* lisp/org.el (org-self-insert-command): Allow speed commands to be
invoked with prefix args.
---
 lisp/org.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b09e72d..9815eb4 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19693,9 +19693,11 @@ overwritten, and the table is not marked as requiring realignment."
   (org-check-before-invisible-edit 'insert)
   (cond
    ((and org-use-speed-commands
-	 (setq org-speed-command
-	       (run-hook-with-args-until-success
-		'org-speed-command-hook (this-command-keys))))
+	 (let ((kv (this-command-keys-vector)))
+	   (setq org-speed-command
+		 (run-hook-with-args-until-success
+		  'org-speed-command-hook
+		  (make-string 1 (aref kv (1- (length kv))))))))
     (cond
      ((commandp org-speed-command)
       (setq this-command org-speed-command)
-- 
2.1.0


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

-- 
Aaron Ecay

  reply	other threads:[~2014-09-23 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 10:25 Call speed-commands with prefix-arg? Thorsten Jolitz
2014-09-23 17:58 ` Aaron Ecay [this message]
2014-09-23 19:29   ` Thorsten Jolitz
2014-09-23 20:58     ` Aaron Ecay
2014-09-23 22:11       ` Thorsten Jolitz
2014-09-23 22:36         ` Aaron Ecay
2014-09-28  3:41           ` Aaron Ecay
2014-09-28  9:00             ` Thorsten Jolitz

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87sijinrqb.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tjolitz@gmail.com \
    /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/org-mode.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).