Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-17 Thread Yasushi SHOJI
At Mon, 17 Feb 2014 10:43:48 +0100,
Nicolas Richard wrote:
> 
> Marc Ihm  writes:
> > (global-set-key (kbd "") (lambda () (interactive) (execute-kbd-macro 
> > (kbd "C-c a v"
> 
> (global-set-key (kbd "") (kbd "C-c a v"))

Ah, these are nice to know.  Thanks, guys.
-- 
yashi



Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-17 Thread Nicolas Richard
Marc Ihm  writes:
> (global-set-key (kbd "") (lambda () (interactive) (execute-kbd-macro 
> (kbd "C-c a v"

(global-set-key (kbd "") (kbd "C-c a v"))

might be a little easier to read and type. Explanation is :
global-set-key can take any "command" as argument, and the definition of
what a "command" is includes keyboard macros. That is vaguely explained
at (info "(elisp) What Is a Function") -- 2nd paragraph after the term
"command".

> P.s.: In my opinion, the name "execute-kbd-macro" of this builtin function is 
> somewhat misleading;
> "replay-keys" describes this usage closer ...

I think I wouldn't look for replay-keys if I did not know about the
function. My own problem is that I usually look for "call-kbd-macro",
which doesn't exist, instead of "execute-...". I guess everyone can't be
pleased !

-- 
Nico.



Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-16 Thread Marc Ihm

Hi Yaushi,

how about

(global-set-key (kbd "") (lambda () (interactive) (execute-kbd-macro (kbd "C-c 
a v"

?

best regards
Marc

P.s.: In my opinion, the name "execute-kbd-macro" of this builtin function is 
somewhat misleading;
"replay-keys" describes this usage closer ...

Am 15.02.2014 14:35, schrieb Yasushi SHOJI:

Hello,

These days I hit `C-c a v' many many times a day, and now feel that
the three key combination is too much. I'd like to improve the
situation by binding the same functionality to a key, say, F12, if
possible.

Looking at the `org-agenda' dispatch code, there are quite a few lines
before calling `org-agenda-list'.  Simply binding `org-agenda-list' to
a key does not seem to work.

Is there a simple way to do it?  Or do I have to re-implement my own
function?

Thanks in advance,







Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-16 Thread Yasushi SHOJI
Hi Thorsten,

At Sat, 15 Feb 2014 18:34:07 +0100,
Thorsten Jolitz wrote:
> 
> so instead of binding the dispatcher function to a global key you can
> bind one or more of the specific functions, e.g.
> 
> ,
> | (global-set-key (kbd "") 'org-agenda-list)
> `

I thought simply binding `org-agenda-list' to a key does not work in
the case with custome agenda setup.

But, it turns out that it's as simple as the following:

(defun yashi/org-agenda (&optional arg)
  (interactive "P")
  (org-agenda arg "a"))

(global-set-key (kbd "") 'yashi/org-agenda)

Thanks,
-- 
 yashi



Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-15 Thread Thorsten Jolitz
Yasushi SHOJI  writes:

> Hi,
>
> On Feb 15, 2014 11:38 PM, "Thorsten Jolitz"  wrote:
>>
>> ,---
>> | (global-set-key (kbd "") 'org-agenda)
>> `---
>
> Thanks, but that's still two keys away. I want a single key to call
> the function.

`org-agenda' is just a dispatcher function, 'C-h f org-agenda' shows you
the specific functions you select with the second key, e.g.:

,-
| a Call `org-agenda-list' to display the agenda for current day or week.
| t Call `org-todo-list' to display the global todo list.
| T Call `org-todo-list' to display the global todo list, select only
|   entries with a specific TODO keyword (the user gets a prompt).
| m Call `org-tags-view' to display headlines with tags matching
|   a condition  (the user is prompted for the condition).
| 
| More commands can be added by configuring the variable
| `org-agenda-custom-commands'.  In particular, specific tags and TODO keyword
| searches can be pre-defined in this way.
`-

so instead of binding the dispatcher function to a global key you can
bind one or more of the specific functions, e.g.

,
| (global-set-key (kbd "") 'org-agenda-list)
`

-- 
cheers,
Thorsten




Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-15 Thread Yasushi SHOJI
Hi,

On Feb 15, 2014 11:38 PM, "Thorsten Jolitz"  wrote:
>
>,---
>| (global-set-key (kbd "") 'org-agenda)
>`---

Thanks, but that's still two keys away. I want a single key to call the
function.

Regards,
-- 
yashi


Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-15 Thread Thorsten Jolitz
Yasushi SHOJI  writes:

> Hello,
>
> These days I hit `C-c a v' many many times a day, and now feel that
> the three key combination is too much. I'd like to improve the
> situation by binding the same functionality to a key, say, F12, if
> possible.
>
> Looking at the `org-agenda' dispatch code, there are quite a few lines
> before calling `org-agenda-list'.  Simply binding `org-agenda-list' to
> a key does not seem to work.
>
> Is there a simple way to do it?  Or do I have to re-implement my own
> function?
>
> Thanks in advance,

instead of:

   ,-
   | (global-set-key "\C-ca" 'org-agenda)
   `-

use:

   ,---
   | (global-set-key (kbd "") 'org-agenda)
   `---

-- 
cheers,
Thorsten




[O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-15 Thread Yasushi SHOJI
Hello,

These days I hit `C-c a v' many many times a day, and now feel that
the three key combination is too much. I'd like to improve the
situation by binding the same functionality to a key, say, F12, if
possible.

Looking at the `org-agenda' dispatch code, there are quite a few lines
before calling `org-agenda-list'.  Simply binding `org-agenda-list' to
a key does not seem to work.

Is there a simple way to do it?  Or do I have to re-implement my own
function?

Thanks in advance,
-- 
  yashi