emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Call speed-commands with prefix-arg?
@ 2014-09-18 10:25 Thorsten Jolitz
  2014-09-23 17:58 ` Aaron Ecay
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-18 10:25 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

is there a way to call Org speed-commands [fn:1] with a prefix-arg?
Does not work for me ...

* Footnotes

[fn:1] see M-x org-speed-command-help

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-18 10:25 Call speed-commands with prefix-arg? Thorsten Jolitz
@ 2014-09-23 17:58 ` Aaron Ecay
  2014-09-23 19:29   ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron Ecay @ 2014-09-23 17:58 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

[-- 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-23 17:58 ` Aaron Ecay
@ 2014-09-23 19:29   ` Thorsten Jolitz
  2014-09-23 20:58     ` Aaron Ecay
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-23 19:29 UTC (permalink / raw)
  To: emacs-orgmode

Aaron Ecay <aaronecay@gmail.com> writes:

Hi Aaron,

> 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.

well, here is some positive feedback - thanks for tackling this!
I tried to port this to outshine.el right away, but can't make it to
work. But this might well be due to the fact that I'm on the console, no
X11. 

When I do C-u 4 t (with t for todo in the outshine speed cmds) I simply
get:

,----
| tttt;; ** DONE err
`----

Since outshine-self-insert-command is a one-to-one copy of
org-self-insert-command, I guess if the patch works for you, it must be
a console problem that I have. Does your patch work for you on the
console too?

> 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.
>
> 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

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-23 19:29   ` Thorsten Jolitz
@ 2014-09-23 20:58     ` Aaron Ecay
  2014-09-23 22:11       ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron Ecay @ 2014-09-23 20:58 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

Hi Thorsten,

2014ko irailak 23an, Thorsten Jolitz-ek idatzi zuen:
> 
> well, here is some positive feedback - thanks for tackling this!
> I tried to port this to outshine.el right away, but can't make it to
> work. But this might well be due to the fact that I'm on the console, no
> X11. 
> 
> When I do C-u 4 t (with t for todo in the outshine speed cmds) I simply
> get:
> 
> ,----
> | tttt;; ** DONE err
> `----
> 
> Since outshine-self-insert-command is a one-to-one copy of
> org-self-insert-command, I guess if the patch works for you, it must be
> a console problem that I have. Does your patch work for you on the
> console too?

It seems to, yes.  Can you test org mode (not outshine) in the console,
and verify that the original patch works for you there?  If it doesn’t,
that needs to be resolved before the patch can be merged.

Thanks,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-23 20:58     ` Aaron Ecay
@ 2014-09-23 22:11       ` Thorsten Jolitz
  2014-09-23 22:36         ` Aaron Ecay
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-23 22:11 UTC (permalink / raw)
  To: emacs-orgmode

Aaron Ecay <aaronecay@gmail.com> writes:

> Hi Thorsten,
>
> 2014ko irailak 23an, Thorsten Jolitz-ek idatzi zuen:
>> 
>> well, here is some positive feedback - thanks for tackling this!
>> I tried to port this to outshine.el right away, but can't make it to
>> work. But this might well be due to the fact that I'm on the console, no
>> X11. 
>> 
>> When I do C-u 4 t (with t for todo in the outshine speed cmds) I simply
>> get:
>> 
>> ,----
>> | tttt;; ** DONE err
>> `----
>> 
>> Since outshine-self-insert-command is a one-to-one copy of
>> org-self-insert-command, I guess if the patch works for you, it must be
>> a console problem that I have. Does your patch work for you on the
>> console too?
>
> It seems to, yes.  Can you test org mode (not outshine) in the console,
> and verify that the original patch works for you there?  If it doesn’t,
> that needs to be resolved before the patch can be merged.


I get 3 different results trying speed-command ':' with prefix:

 1. in Org, when edebugging 'org-set-tags-command', C-u : and C-u 4 :
 both result in speed-command " "

,----
| Result: [32]
| 
| Result: 1 (#o1, #x1, ?\C-a)
| 
| Result: 0 (#o0, #x0, ?\C-@)
| 
| Result: 32 (#o40, #x20, ? )
| 
| Result: " "
| 
| Result: org-display-outline-path
`----

 2. when not edebugging, C-u 4 : seems to work in both Org and Outshine

-> "All tags realigned to column 0"

 3. when doing C-u 4 t in outshine, with

,----[ C-h f outshine-todo RET ]
| outshine-todo is an interactive Lisp function in `outshine.el'.
| 
| It is bound to M-# M-t.
| 
| (outshine-todo &optional ARG)
| 
| Call outorg to trigger `org-todo'.
`----

,----
| User-defined Speed commands
| ===========================
| t   outshine-todo
`----

I get:

,----
| tttt;; * ELISP SCRATCH
`----

strange ...

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-23 22:11       ` Thorsten Jolitz
@ 2014-09-23 22:36         ` Aaron Ecay
  2014-09-28  3:41           ` Aaron Ecay
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron Ecay @ 2014-09-23 22:36 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

Hi Thorsten,

2014ko irailak 23an, Thorsten Jolitz-ek idatzi zuen:
> 
> I get 3 different results trying speed-command ':' with prefix:
> 
>  1. in Org, when edebugging 'org-set-tags-command', C-u : and C-u 4 :
>  both result in speed-command " "

That’s because of the use of last-command-keys-vector, which will get
overwritten in edebug (the “ ” is the space that you used to step
through the function...)

> 
> ,----
> | Result: [32]
> | 
> | Result: 1 (#o1, #x1, ?\C-a)
> | 
> | Result: 0 (#o0, #x0, ?\C-@)
> | 
> | Result: 32 (#o40, #x20, ? )
> | 
> | Result: " "
> | 
> | Result: org-display-outline-path
> `----
> 
>  2. when not edebugging, C-u 4 : seems to work in both Org and Outshine
> 
> -> "All tags realigned to column 0"

Good.  :)

> 
>  3. when doing C-u 4 t in outshine, with
> 
> ,----[ C-h f outshine-todo RET ]
> | outshine-todo is an interactive Lisp function in `outshine.el'.
> | 
> | It is bound to M-# M-t.
> | 
> | (outshine-todo &optional ARG)
> | 
> | Call outorg to trigger `org-todo'.
> `----
> 
> ,----
> | User-defined Speed commands
> | ===========================
> | t   outshine-todo
> `----
> 
> I get:
> 
> ,----
> | tttt;; * ELISP SCRATCH
> `----
> 
> strange ...

Sounds like maybe the patch is not too well integrated into outshine.  I
get expected behavior under these conditions in org.

-- 
Aaron Ecay
PhD candidate, Linguistics
University of Pennsylvania

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-23 22:36         ` Aaron Ecay
@ 2014-09-28  3:41           ` Aaron Ecay
  2014-09-28  9:00             ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron Ecay @ 2014-09-28  3:41 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

Hi Thorsten,

2014ko irailak 23an, Aaron Ecay-ek idatzi zuen:
>> 2. when not edebugging, C-u 4 : seems to work in both Org and Outshine
>> 
>> -> "All tags realigned to column 0"
> 
> Good.  :)

I pushed this patch to the master branch.  Thanks for testing it out.

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Call speed-commands with prefix-arg?
  2014-09-28  3:41           ` Aaron Ecay
@ 2014-09-28  9:00             ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-09-28  9:00 UTC (permalink / raw)
  To: emacs-orgmode

Aaron Ecay <aaronecay@gmail.com> writes:

Hi Aaron,

> 2014ko irailak 23an, Aaron Ecay-ek idatzi zuen:
>>> 2. when not edebugging, C-u 4 : seems to work in both Org and Outshine
>>> 
>>> -> "All tags realigned to column 0"
>> 
>> Good.  :)
>
> I pushed this patch to the master branch.  Thanks for testing it out.

Thank you for the patch, its nice that this works now. 

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-28  9:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 10:25 Call speed-commands with prefix-arg? Thorsten Jolitz
2014-09-23 17:58 ` Aaron Ecay
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

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).