* [BABEL] Speed keys
@ 2010-09-04 12:39 Jambunathan K
2010-09-04 13:14 ` Eric Schulte
0 siblings, 1 reply; 16+ messages in thread
From: Jambunathan K @ 2010-09-04 12:39 UTC (permalink / raw)
To: emacs-orgmode
Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
blocks?
Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [BABEL] Speed keys
2010-09-04 12:39 [BABEL] Speed keys Jambunathan K
@ 2010-09-04 13:14 ` Eric Schulte
2010-09-04 20:11 ` Jambunathan K
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Eric Schulte @ 2010-09-04 13:14 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode
Hi Jambunathan,
That sounds like a good idea. I suppose initially the speed keys should
just mirror the babel key map?
-- Eric
Jambunathan K <kjambunathan@gmail.com> writes:
> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
> blocks?
>
> Jambunathan K.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [BABEL] Speed keys
2010-09-04 13:14 ` Eric Schulte
@ 2010-09-04 20:11 ` Jambunathan K
2010-09-04 20:13 ` ggggJambunathan K
2010-09-06 22:57 ` Jambunathan K
2 siblings, 0 replies; 16+ messages in thread
From: Jambunathan K @ 2010-09-04 20:11 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for
>> Babel blocks?
>>
Eric> Hi Jambunathan, That sounds like a good idea. I suppose
Eric> initially the speed keys should just mirror the babel key map?
Exactly.
As long as the cursor is on a #+begin_src (and/or #+end_src), one need
not bother about typing C-c C-v. So a keypress 'n' would do what C-c C-v
n would do.
More importantly emerging new sequences like, C-c C-v C-x TAB could be
composed as
1. Push a mark (C-SPC) [Optional]
2. Move to babel guard line using user preferred method [See my other
post on the list]
3. C-x TAB
One of the problems with C-c C-v prefix is that I tend to forget it if I
revisit Babel say after a week's time. The reason is that I simply
couldn't contrive a convenient menemonic that would make me recollect
C-v. So jumping to the babel guard line and issuing the needed command
is a good fall back option. Not nit picking here :-).
Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [BABEL] Speed keys
2010-09-04 13:14 ` Eric Schulte
2010-09-04 20:11 ` Jambunathan K
@ 2010-09-04 20:13 ` ggggJambunathan K
2010-09-04 21:48 ` Carsten Dominik
2010-09-06 22:57 ` Jambunathan K
2 siblings, 1 reply; 16+ messages in thread
From: ggggJambunathan K @ 2010-09-04 20:13 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for
>> Babel blocks?
>>
Eric> Hi Jambunathan, That sounds like a good idea. I suppose
Eric> initially the speed keys should just mirror the babel key map?
Exactly.
As long as the cursor is on a #+begin_src (and/or #+end_src), one need
not bother about typing C-c C-v. So a keypress 'n' would do what C-c C-v
n would do.
More importantly emerging new sequences like, C-c C-v C-x TAB could be
composed as
1. Push a mark (C-SPC) [Optional]
2. Move to babel guard line using user preferred method [See my other
post on the list]
3. C-x TAB
One of the problems with C-c C-v prefix is that I tend to forget it if I
revisit Babel say after a week's time. (Not nitpicking here!). The
reason is that I simply couldn't contrive a convenient menemonic that
would make me recollect C-v. So jumping to the babel guard line and
issuing the needed command is a good fall back option.
Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: [BABEL] Speed keys
2010-09-04 20:13 ` ggggJambunathan K
@ 2010-09-04 21:48 ` Carsten Dominik
2010-09-05 10:03 ` Jambunathan K
0 siblings, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2010-09-04 21:48 UTC (permalink / raw)
To: ggggJambunathan K; +Cc: emacs-orgmode
On Sat, Sep 4, 2010 at 10:13 PM, ggggJambunathan K
<kjambunathan@gmail.com> wrote:
>
> >> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for
> >> Babel blocks?
> >>
>
> Eric> Hi Jambunathan, That sounds like a good idea. I suppose
> Eric> initially the speed keys should just mirror the babel key map?
>
> Exactly.
>
> As long as the cursor is on a #+begin_src (and/or #+end_src), one need
> not bother about typing C-c C-v. So a keypress 'n' would do what C-c C-v
> n would do.
>
> More importantly emerging new sequences like, C-c C-v C-x TAB could be
> composed as
>
> 1. Push a mark (C-SPC) [Optional]
>
> 2. Move to babel guard line using user preferred method [See my other
> post on the list]
>
> 3. C-x TAB
>
> One of the problems with C-c C-v prefix is that I tend to forget it if I
> revisit Babel say after a week's time. (Not nitpicking here!). The
> reason is that I simply couldn't contrive a convenient menemonic that
> would make me recollect C-v.
visit (do something with the code snippets)
vault (structures (arcs) in the tower of babel)
voodoo (org-babel is dark magic)
vocabulary (the words of the common language in the world of babel)
verb (Org-babel defines code and value objects in a buffer. The
commands are the verbs which get the objects into action)
veins (processing tubes in the babel fish)
vision (make it visible)
vitalize (bring dead code to life)
value (like evaluate source code)
voice (express meaning in any language)
valve (open the valve to get results from source code or that
connects different snippets)
vortex (stir it all up!)
von Neumann (get that computing machine going)
vaseline (lubricate that machine)
vaccinate (get it used to foreign influences)
vector (directed action)
Vegas (let turn the wheels)
veil (pull it down to unveil the beauty of the women of Babel)
velum (the membrane around the cells of Babel)
:)
- Carsten
So jumping to the babel guard line and
> issuing the needed command is a good fall back option.
>
> Jambunathan K.
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [BABEL] Speed keys
2010-09-04 21:48 ` Carsten Dominik
@ 2010-09-05 10:03 ` Jambunathan K
0 siblings, 0 replies; 16+ messages in thread
From: Jambunathan K @ 2010-09-05 10:03 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Sat, Sep 4, 2010 at 10:13 PM, ggggJambunathan K
> <kjambunathan@gmail.com> wrote:
>> One of the problems with C-c C-v prefix is that I tend to forget it if I
>> revisit Babel say after a week's time. (Not nitpicking here!). The
>> reason is that I simply couldn't contrive a convenient menemonic that
>> would make me recollect C-v.
>
>
> visit (do something with the code snippets)
I would go with the first suggestion but with a slight modification.
visit (this command makes me visit the Org Manual all the time)
:-)
Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [BABEL] Speed keys
2010-09-04 13:14 ` Eric Schulte
2010-09-04 20:11 ` Jambunathan K
2010-09-04 20:13 ` ggggJambunathan K
@ 2010-09-06 22:57 ` Jambunathan K
2010-09-21 12:36 ` Carsten Dominik
2010-09-23 19:51 ` Eric Schulte
2 siblings, 2 replies; 16+ messages in thread
From: Jambunathan K @ 2010-09-06 22:57 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
>> blocks?
Attached patch extends the speed key functionality.
Usage notes:
After applying the patch, use variant-1 or variant-2 to enable speed
keys within a babel block.
variant-1:
(defun org-babel-speed-command-hook (keys)
(when (org-babel-where-is-src-block-head)
(cdr (assoc keys org-babel-key-bindings))))
variant-2:
(defun org-babel-speed-command-hook (keys)
(when (and (bolp) (looking-at org-babel-src-block-regexp))
(cdr (assoc keys org-babel-key-bindings))))
(add-hook 'org-speed-command-hook 'org-babel-speed-command-hook 'append)
Use this hook with caution.
(defun org-speed-command-catch-all-hook (keys)
'ignore)
(add-hook 'org-speed-command-hook 'org-babel-speed-command-hook 'append)
Jambunathan K.
[-- Attachment #2: Type: text/plain, Size: 3016 bytes --]
From 2fca952e923d44bec554b8b4e7dafc355e068f32 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
Date: Tue, 7 Sep 2010 04:01:16 +0530
Subject: [PATCH 2/2] Support for user-extensible speed commands.
* lisp/org.el (org-speed-command-hook): New. Hook for installing
additional speed commands. Use this for enabling speed commands on
src blocks.
(org-speed-command-default-hook): The default hook for
org-speed-command-hook. Factored out from org-self-insert-command
and mimics existing behaviour.
(org-self-insert-command): Modified to use org-speed-command-hook.
TINYCHANGE.
---
lisp/org.el | 38 +++++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 09281cc..ead91a3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16494,6 +16494,34 @@ If not, return to the original position and throw an error."
(defvar org-table-auto-blank-field) ; defined in org-table.el
(defvar org-speed-command nil)
+
+(defun org-speed-command-default-hook (keys)
+ "Hook for activating single-letter speed commands.
+`org-speed-commands-default' specifies a minimal command set. Use
+`org-speed-commands-user' for further customization."
+ (when (or (and (bolp) (looking-at outline-regexp))
+ (and (functionp org-use-speed-commands)
+ (funcall org-use-speed-commands)))
+ (cdr (assoc keys (append org-speed-commands-user
+ org-speed-commands-default)))))
+
+(defcustom org-speed-command-hook 'org-speed-command-default-hook
+ "Hook for activating speed commands at strategic locations.
+Hook functions are called in sequence until a valid handler is
+found.
+
+Each hook takes a single argument, a user-pressed command key
+which is also a `self-insert-command' from the global map.
+
+Within the hook, examine the cursor position and the command key
+and return nil or a valid handler as appropriate. Handler could
+be one of an interactive command, a function, or a form.
+
+Set `org-use-speed-commands' to non-nil value to enable this
+hook. The default setting is `org-speed-command-default-hook'."
+ :group 'org-structure
+ :type 'hook)
+
(defun org-self-insert-command (N)
"Like `self-insert-command', use overwrite-mode for whitespace in tables.
If the cursor is in a table looking at whitespace, the whitespace is
@@ -16501,13 +16529,9 @@ overwritten, and the table is not marked as requiring realignment."
(interactive "p")
(cond
((and org-use-speed-commands
- (or (and (bolp) (looking-at outline-regexp))
- (and (functionp org-use-speed-commands)
- (funcall org-use-speed-commands)))
- (setq
- org-speed-command
- (or (cdr (assoc (this-command-keys) org-speed-commands-user))
- (cdr (assoc (this-command-keys) org-speed-commands-default)))))
+ (setq org-speed-command
+ (run-hook-with-args-until-success
+ 'org-speed-command-hook (this-command-keys))))
(cond
((commandp org-speed-command)
(setq this-command org-speed-command)
--
1.7.0.4
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: Re: [BABEL] Speed keys
2010-09-06 22:57 ` Jambunathan K
@ 2010-09-21 12:36 ` Carsten Dominik
2010-09-21 13:05 ` Eric Schulte
2010-09-23 19:51 ` Eric Schulte
1 sibling, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2010-09-21 12:36 UTC (permalink / raw)
To: Jambunathan K, Eric Schulte; +Cc: emacs org-mode mailing list
Hi Eric,
could I ask you to take a look at this?
Thanks
- Carsten
On Sep 7, 2010, at 12:57 AM, Jambunathan K wrote:
>
>>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
>>> blocks?
>
> Attached patch extends the speed key functionality.
>
> Usage notes:
>
> After applying the patch, use variant-1 or variant-2 to enable speed
> keys within a babel block.
>
> variant-1:
>
> (defun org-babel-speed-command-hook (keys)
> (when (org-babel-where-is-src-block-head)
> (cdr (assoc keys org-babel-key-bindings))))
>
> variant-2:
>
> (defun org-babel-speed-command-hook (keys)
> (when (and (bolp) (looking-at org-babel-src-block-regexp))
> (cdr (assoc keys org-babel-key-bindings))))
>
> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook
> 'append)
>
>
> Use this hook with caution.
>
> (defun org-speed-command-catch-all-hook (keys)
> 'ignore)
>
> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook
> 'append)
>
> Jambunathan K.
>
>
> From 2fca952e923d44bec554b8b4e7dafc355e068f32 Mon Sep 17 00:00:00 2001
> From: Jambunathan K <kjambunathan@gmail.com>
> Date: Tue, 7 Sep 2010 04:01:16 +0530
> Subject: [PATCH 2/2] Support for user-extensible speed commands.
>
> * lisp/org.el (org-speed-command-hook): New. Hook for installing
> additional speed commands. Use this for enabling speed commands on
> src blocks.
> (org-speed-command-default-hook): The default hook for
> org-speed-command-hook. Factored out from org-self-insert-command
> and mimics existing behaviour.
> (org-self-insert-command): Modified to use org-speed-command-hook.
>
> TINYCHANGE.
> ---
> lisp/org.el | 38 +++++++++++++++++++++++++++++++-------
> 1 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 09281cc..ead91a3 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -16494,6 +16494,34 @@ If not, return to the original position and
> throw an error."
>
> (defvar org-table-auto-blank-field) ; defined in org-table.el
> (defvar org-speed-command nil)
> +
> +(defun org-speed-command-default-hook (keys)
> + "Hook for activating single-letter speed commands.
> +`org-speed-commands-default' specifies a minimal command set. Use
> +`org-speed-commands-user' for further customization."
> + (when (or (and (bolp) (looking-at outline-regexp))
> + (and (functionp org-use-speed-commands)
> + (funcall org-use-speed-commands)))
> + (cdr (assoc keys (append org-speed-commands-user
> + org-speed-commands-default)))))
> +
> +(defcustom org-speed-command-hook 'org-speed-command-default-hook
> + "Hook for activating speed commands at strategic locations.
> +Hook functions are called in sequence until a valid handler is
> +found.
> +
> +Each hook takes a single argument, a user-pressed command key
> +which is also a `self-insert-command' from the global map.
> +
> +Within the hook, examine the cursor position and the command key
> +and return nil or a valid handler as appropriate. Handler could
> +be one of an interactive command, a function, or a form.
> +
> +Set `org-use-speed-commands' to non-nil value to enable this
> +hook. The default setting is `org-speed-command-default-hook'."
> + :group 'org-structure
> + :type 'hook)
> +
> (defun org-self-insert-command (N)
> "Like `self-insert-command', use overwrite-mode for whitespace in
> tables.
> If the cursor is in a table looking at whitespace, the whitespace is
> @@ -16501,13 +16529,9 @@ overwritten, and the table is not marked as
> requiring realignment."
> (interactive "p")
> (cond
> ((and org-use-speed-commands
> - (or (and (bolp) (looking-at outline-regexp))
> - (and (functionp org-use-speed-commands)
> - (funcall org-use-speed-commands)))
> - (setq
> - org-speed-command
> - (or (cdr (assoc (this-command-keys) org-speed-commands-user))
> - (cdr (assoc (this-command-keys) org-speed-commands-
> default)))))
> + (setq org-speed-command
> + (run-hook-with-args-until-success
> + 'org-speed-command-hook (this-command-keys))))
> (cond
> ((commandp org-speed-command)
> (setq this-command org-speed-command)
> --
> 1.7.0.4
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: [BABEL] Speed keys
2010-09-21 12:36 ` Carsten Dominik
@ 2010-09-21 13:05 ` Eric Schulte
0 siblings, 0 replies; 16+ messages in thread
From: Eric Schulte @ 2010-09-21 13:05 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs org-mode mailing list, Jambunathan K
Yes,
I've had this marked for reply for some time now, I'll be sure to look
at it by the end of the week.
Best -- Eric
Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Eric,
>
> could I ask you to take a look at this?
>
> Thanks
>
> - Carsten
>
> On Sep 7, 2010, at 12:57 AM, Jambunathan K wrote:
>
>>
>>>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
>>>> blocks?
>>
>> Attached patch extends the speed key functionality.
>>
>> Usage notes:
>>
>> After applying the patch, use variant-1 or variant-2 to enable speed
>> keys within a babel block.
>>
>> variant-1:
>>
>> (defun org-babel-speed-command-hook (keys)
>> (when (org-babel-where-is-src-block-head)
>> (cdr (assoc keys org-babel-key-bindings))))
>>
>> variant-2:
>>
>> (defun org-babel-speed-command-hook (keys)
>> (when (and (bolp) (looking-at org-babel-src-block-regexp))
>> (cdr (assoc keys org-babel-key-bindings))))
>>
>> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook
>> append)
>>
>>
>> Use this hook with caution.
>>
>> (defun org-speed-command-catch-all-hook (keys)
>> 'ignore)
>>
>> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook
>> append)
>>
>> Jambunathan K.
>>
>>
>> From 2fca952e923d44bec554b8b4e7dafc355e068f32 Mon Sep 17 00:00:00 2001
>> From: Jambunathan K <kjambunathan@gmail.com>
>> Date: Tue, 7 Sep 2010 04:01:16 +0530
>> Subject: [PATCH 2/2] Support for user-extensible speed commands.
>>
>> * lisp/org.el (org-speed-command-hook): New. Hook for installing
>> additional speed commands. Use this for enabling speed commands on
>> src blocks.
>> (org-speed-command-default-hook): The default hook for
>> org-speed-command-hook. Factored out from org-self-insert-command
>> and mimics existing behaviour.
>> (org-self-insert-command): Modified to use org-speed-command-hook.
>>
>> TINYCHANGE.
>> ---
>> lisp/org.el | 38 +++++++++++++++++++++++++++++++-------
>> 1 files changed, 31 insertions(+), 7 deletions(-)
>>
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 09281cc..ead91a3 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -16494,6 +16494,34 @@ If not, return to the original position and
>> throw an error."
>>
>> (defvar org-table-auto-blank-field) ; defined in org-table.el
>> (defvar org-speed-command nil)
>> +
>> +(defun org-speed-command-default-hook (keys)
>> + "Hook for activating single-letter speed commands.
>> +`org-speed-commands-default' specifies a minimal command set. Use
>> +`org-speed-commands-user' for further customization."
>> + (when (or (and (bolp) (looking-at outline-regexp))
>> + (and (functionp org-use-speed-commands)
>> + (funcall org-use-speed-commands)))
>> + (cdr (assoc keys (append org-speed-commands-user
>> + org-speed-commands-default)))))
>> +
>> +(defcustom org-speed-command-hook 'org-speed-command-default-hook
>> + "Hook for activating speed commands at strategic locations.
>> +Hook functions are called in sequence until a valid handler is
>> +found.
>> +
>> +Each hook takes a single argument, a user-pressed command key
>> +which is also a `self-insert-command' from the global map.
>> +
>> +Within the hook, examine the cursor position and the command key
>> +and return nil or a valid handler as appropriate. Handler could
>> +be one of an interactive command, a function, or a form.
>> +
>> +Set `org-use-speed-commands' to non-nil value to enable this
>> +hook. The default setting is `org-speed-command-default-hook'."
>> + :group 'org-structure
>> + :type 'hook)
>> +
>> (defun org-self-insert-command (N)
>> "Like `self-insert-command', use overwrite-mode for whitespace in
>> tables.
>> If the cursor is in a table looking at whitespace, the whitespace is
>> @@ -16501,13 +16529,9 @@ overwritten, and the table is not marked as
>> requiring realignment."
>> (interactive "p")
>> (cond
>> ((and org-use-speed-commands
>> - (or (and (bolp) (looking-at outline-regexp))
>> - (and (functionp org-use-speed-commands)
>> - (funcall org-use-speed-commands)))
>> - (setq
>> - org-speed-command
>> - (or (cdr (assoc (this-command-keys) org-speed-commands-user))
>> - (cdr (assoc (this-command-keys) org-speed-commands-
>> default)))))
>> + (setq org-speed-command
>> + (run-hook-with-args-until-success
>> + 'org-speed-command-hook (this-command-keys))))
>> (cond
>> ((commandp org-speed-command)
>> (setq this-command org-speed-command)
>> --
>> 1.7.0.4
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: [BABEL] Speed keys
2010-09-06 22:57 ` Jambunathan K
2010-09-21 12:36 ` Carsten Dominik
@ 2010-09-23 19:51 ` Eric Schulte
2010-09-26 14:21 ` FSF Copyright Assignment Jambunathan K
1 sibling, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2010-09-23 19:51 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode
Hi Jambunathan,
I've finally had a chance to test out this patch, and it's great! I'd
love to apply this to the core Org repository, however given the size I
have to ask, have you (or are you willing to) signed the FSF papers?
http://orgmode.org/worg/org-contribute.php
Cheers -- Eric
Jambunathan K <kjambunathan@gmail.com> writes:
>>> Is it possible Speed Keys (Refer Org Manual - Sec. 15.3) for Babel
>>> blocks?
>
> Attached patch extends the speed key functionality.
>
> Usage notes:
>
> After applying the patch, use variant-1 or variant-2 to enable speed
> keys within a babel block.
>
> variant-1:
>
> (defun org-babel-speed-command-hook (keys)
> (when (org-babel-where-is-src-block-head)
> (cdr (assoc keys org-babel-key-bindings))))
>
> variant-2:
>
> (defun org-babel-speed-command-hook (keys)
> (when (and (bolp) (looking-at org-babel-src-block-regexp))
> (cdr (assoc keys org-babel-key-bindings))))
>
> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook 'append)
>
>
> Use this hook with caution.
>
> (defun org-speed-command-catch-all-hook (keys)
> 'ignore)
>
> (add-hook 'org-speed-command-hook 'org-babel-speed-command-hook 'append)
>
> Jambunathan K.
>
>
> From 2fca952e923d44bec554b8b4e7dafc355e068f32 Mon Sep 17 00:00:00 2001
> From: Jambunathan K <kjambunathan@gmail.com>
> Date: Tue, 7 Sep 2010 04:01:16 +0530
> Subject: [PATCH 2/2] Support for user-extensible speed commands.
>
> * lisp/org.el (org-speed-command-hook): New. Hook for installing
> additional speed commands. Use this for enabling speed commands on
> src blocks.
> (org-speed-command-default-hook): The default hook for
> org-speed-command-hook. Factored out from org-self-insert-command
> and mimics existing behaviour.
> (org-self-insert-command): Modified to use org-speed-command-hook.
>
> TINYCHANGE.
> ---
> lisp/org.el | 38 +++++++++++++++++++++++++++++++-------
> 1 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 09281cc..ead91a3 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -16494,6 +16494,34 @@ If not, return to the original position and throw an error."
>
> (defvar org-table-auto-blank-field) ; defined in org-table.el
> (defvar org-speed-command nil)
> +
> +(defun org-speed-command-default-hook (keys)
> + "Hook for activating single-letter speed commands.
> +`org-speed-commands-default' specifies a minimal command set. Use
> +`org-speed-commands-user' for further customization."
> + (when (or (and (bolp) (looking-at outline-regexp))
> + (and (functionp org-use-speed-commands)
> + (funcall org-use-speed-commands)))
> + (cdr (assoc keys (append org-speed-commands-user
> + org-speed-commands-default)))))
> +
> +(defcustom org-speed-command-hook 'org-speed-command-default-hook
> + "Hook for activating speed commands at strategic locations.
> +Hook functions are called in sequence until a valid handler is
> +found.
> +
> +Each hook takes a single argument, a user-pressed command key
> +which is also a `self-insert-command' from the global map.
> +
> +Within the hook, examine the cursor position and the command key
> +and return nil or a valid handler as appropriate. Handler could
> +be one of an interactive command, a function, or a form.
> +
> +Set `org-use-speed-commands' to non-nil value to enable this
> +hook. The default setting is `org-speed-command-default-hook'."
> + :group 'org-structure
> + :type 'hook)
> +
> (defun org-self-insert-command (N)
> "Like `self-insert-command', use overwrite-mode for whitespace in tables.
> If the cursor is in a table looking at whitespace, the whitespace is
> @@ -16501,13 +16529,9 @@ overwritten, and the table is not marked as requiring realignment."
> (interactive "p")
> (cond
> ((and org-use-speed-commands
> - (or (and (bolp) (looking-at outline-regexp))
> - (and (functionp org-use-speed-commands)
> - (funcall org-use-speed-commands)))
> - (setq
> - org-speed-command
> - (or (cdr (assoc (this-command-keys) org-speed-commands-user))
> - (cdr (assoc (this-command-keys) org-speed-commands-default)))))
> + (setq org-speed-command
> + (run-hook-with-args-until-success
> + 'org-speed-command-hook (this-command-keys))))
> (cond
> ((commandp org-speed-command)
> (setq this-command org-speed-command)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: FSF Copyright Assignment
2010-09-23 19:51 ` Eric Schulte
@ 2010-09-26 14:21 ` Jambunathan K
2010-09-26 20:02 ` Eric Schulte
0 siblings, 1 reply; 16+ messages in thread
From: Jambunathan K @ 2010-09-26 14:21 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Hello Eric
Eric> Hi Jambunathan,
Eric>
Eric> I've finally had a chance to test out this patch, and it's great!
Eric> I'd love to apply this to the core Org repository, however given
Eric> the size I have to ask, have you (or are you willing to) signed
Eric> the FSF papers?
Eric>
Eric> http://orgmode.org/worg/org-contribute.php
I am willing to sign the FSF papers required to get all my Orgmode
patches into official Emacs.
I have initiated the process from my end by writing to assign@gnu.org.
Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: FSF Copyright Assignment
2010-09-26 14:21 ` FSF Copyright Assignment Jambunathan K
@ 2010-09-26 20:02 ` Eric Schulte
2010-10-01 13:31 ` Sébastien Vauban
2010-10-06 11:44 ` Dan Davison
0 siblings, 2 replies; 16+ messages in thread
From: Eric Schulte @ 2010-09-26 20:02 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode
Jambunathan K <kjambunathan@gmail.com> writes:
> Hello Eric
>
> Eric> Hi Jambunathan,
> Eric>
> Eric> I've finally had a chance to test out this patch, and it's great!
> Eric> I'd love to apply this to the core Org repository, however given
> Eric> the size I have to ask, have you (or are you willing to) signed
> Eric> the FSF papers?
> Eric>
> Eric> http://orgmode.org/worg/org-contribute.php
>
> I am willing to sign the FSF papers required to get all my Orgmode
> patches into official Emacs.
>
> I have initiated the process from my end by writing to assign@gnu.org.
>
Thanks for starting the assignment process. I've just added this
functionality to the repository, so babel commands can now be used as
speed commands when the point is on the beginning of a code block.
Thanks for the contribution!
Best -- Eric
>
> Jambunathan K.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: FSF Copyright Assignment
2010-09-26 20:02 ` Eric Schulte
@ 2010-10-01 13:31 ` Sébastien Vauban
2010-10-01 15:10 ` Eric Schulte
2010-10-06 11:44 ` Dan Davison
1 sibling, 1 reply; 16+ messages in thread
From: Sébastien Vauban @ 2010-10-01 13:31 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> I've just added this functionality to the repository, so babel commands can
> now be used as speed commands when the point is on the beginning of a code
> block.
Is there a way to pass a universal argument?
I'm thinking, for example, at =C-u C-c C-v C-z=, knowing that =C-u z= simply
inserts 4 times a =z=...
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: FSF Copyright Assignment
2010-10-01 13:31 ` Sébastien Vauban
@ 2010-10-01 15:10 ` Eric Schulte
2010-10-01 15:41 ` Sébastien Vauban
0 siblings, 1 reply; 16+ messages in thread
From: Eric Schulte @ 2010-10-01 15:10 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
I'm not sure,
Babel uses the existing speed-commands infrastructure already existing
in Org-mode for headlines, so the behavior should be the same, whatever
that behavior may be...
Best -- Eric
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> I've just added this functionality to the repository, so babel commands can
>> now be used as speed commands when the point is on the beginning of a code
>> block.
>
> Is there a way to pass a universal argument?
>
> I'm thinking, for example, at =C-u C-c C-v C-z=, knowing that =C-u z= simply
> inserts 4 times a =z=...
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: FSF Copyright Assignment
2010-10-01 15:10 ` Eric Schulte
@ 2010-10-01 15:41 ` Sébastien Vauban
0 siblings, 0 replies; 16+ messages in thread
From: Sébastien Vauban @ 2010-10-01 15:41 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> "Eric Schulte" wrote:
>>> I've just added this functionality to the repository, so babel commands can
>>> now be used as speed commands when the point is on the beginning of a code
>>> block.
>>
>> Is there a way to pass a universal argument?
>>
>> I'm thinking, for example, at =C-u C-c C-v C-z=, knowing that =C-u z= simply
>> inserts 4 times a =z=...
>>
> I'm not sure,
>
> Babel uses the existing speed-commands infrastructure already existing
> in Org-mode for headlines, so the behavior should be the same, whatever
> that behavior may be...
I'm not asking for changes -- at least, not yet. Just wanted to know if there
was a way to send the C-u through the speed command. If not, then not. Nothing
more.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: FSF Copyright Assignment
2010-09-26 20:02 ` Eric Schulte
2010-10-01 13:31 ` Sébastien Vauban
@ 2010-10-06 11:44 ` Dan Davison
1 sibling, 0 replies; 16+ messages in thread
From: Dan Davison @ 2010-10-06 11:44 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, Jambunathan K
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Jambunathan K <kjambunathan@gmail.com> writes:
>
>> Hello Eric
>>
>> Eric> Hi Jambunathan,
>> Eric>
>> Eric> I've finally had a chance to test out this patch, and it's great!
>> Eric> I'd love to apply this to the core Org repository, however given
>> Eric> the size I have to ask, have you (or are you willing to) signed
>> Eric> the FSF papers?
>> Eric>
>> Eric> http://orgmode.org/worg/org-contribute.php
>>
>> I am willing to sign the FSF papers required to get all my Orgmode
>> patches into official Emacs.
>>
>> I have initiated the process from my end by writing to assign@gnu.org.
>>
>
> Thanks for starting the assignment process. I've just added this
> functionality to the repository, so babel commands can now be used as
> speed commands when the point is on the beginning of a code block.
>
> Thanks for the contribution!
Hi Jambunathan,
Yes, thanks for this, I'm enjoying using it. n e n e ...
Dan
>
> Best -- Eric
>
>>
>> Jambunathan K.
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-10-06 11:44 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 12:39 [BABEL] Speed keys Jambunathan K
2010-09-04 13:14 ` Eric Schulte
2010-09-04 20:11 ` Jambunathan K
2010-09-04 20:13 ` ggggJambunathan K
2010-09-04 21:48 ` Carsten Dominik
2010-09-05 10:03 ` Jambunathan K
2010-09-06 22:57 ` Jambunathan K
2010-09-21 12:36 ` Carsten Dominik
2010-09-21 13:05 ` Eric Schulte
2010-09-23 19:51 ` Eric Schulte
2010-09-26 14:21 ` FSF Copyright Assignment Jambunathan K
2010-09-26 20:02 ` Eric Schulte
2010-10-01 13:31 ` Sébastien Vauban
2010-10-01 15:10 ` Eric Schulte
2010-10-01 15:41 ` Sébastien Vauban
2010-10-06 11:44 ` Dan Davison
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).