emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* simple way to call `C-c a v' or a way to bind it to a key?
@ 2014-02-15 13:35 Yasushi SHOJI
  2014-02-15 14:38 ` Thorsten Jolitz
  2014-02-16 21:20 ` Marc Ihm
  0 siblings, 2 replies; 8+ messages in thread
From: Yasushi SHOJI @ 2014-02-15 13:35 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-15 13:35 simple way to call `C-c a v' or a way to bind it to a key? Yasushi SHOJI
@ 2014-02-15 14:38 ` Thorsten Jolitz
  2014-02-15 16:31   ` Yasushi SHOJI
  2014-02-16 21:20 ` Marc Ihm
  1 sibling, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-02-15 14:38 UTC (permalink / raw)
  To: emacs-orgmode

Yasushi SHOJI <yashi@atmark-techno.com> 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 "<f12>") 'org-agenda)
   `-------------------------------------------

-- 
cheers,
Thorsten

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-15 14:38 ` Thorsten Jolitz
@ 2014-02-15 16:31   ` Yasushi SHOJI
  2014-02-15 17:34     ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Yasushi SHOJI @ 2014-02-15 16:31 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

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

Hi,

On Feb 15, 2014 11:38 PM, "Thorsten Jolitz" <tjolitz@gmail.com> wrote:
>
>    ,-------------------------------------------
>    | (global-set-key (kbd "<f12>") 'org-agenda)
>    `-------------------------------------------

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

Regards,
-- 
                    yashi

[-- Attachment #2: Type: text/html, Size: 541 bytes --]

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-15 16:31   ` Yasushi SHOJI
@ 2014-02-15 17:34     ` Thorsten Jolitz
  2014-02-16  8:07       ` Yasushi SHOJI
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-02-15 17:34 UTC (permalink / raw)
  To: emacs-orgmode

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> Hi,
>
> On Feb 15, 2014 11:38 PM, "Thorsten Jolitz" <tjolitz@gmail.com> wrote:
>>
>> ,-------------------------------------------
>> | (global-set-key (kbd "<f12>") '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 "<f12>") 'org-agenda-list)
`------------------------------------------------

-- 
cheers,
Thorsten

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-15 17:34     ` Thorsten Jolitz
@ 2014-02-16  8:07       ` Yasushi SHOJI
  0 siblings, 0 replies; 8+ messages in thread
From: Yasushi SHOJI @ 2014-02-16  8:07 UTC (permalink / raw)
  To: emacs-orgmode

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 "<f12>") '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 "<f1>") 'yashi/org-agenda)

Thanks,
-- 
             yashi

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-15 13:35 simple way to call `C-c a v' or a way to bind it to a key? Yasushi SHOJI
  2014-02-15 14:38 ` Thorsten Jolitz
@ 2014-02-16 21:20 ` Marc Ihm
  2014-02-17  9:43   ` Nicolas Richard
  1 sibling, 1 reply; 8+ messages in thread
From: Marc Ihm @ 2014-02-16 21:20 UTC (permalink / raw)
  To: emacs-orgmode

Hi Yaushi,

how about

(global-set-key (kbd "<f12>") (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,
>

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-16 21:20 ` Marc Ihm
@ 2014-02-17  9:43   ` Nicolas Richard
  2014-02-18  3:45     ` Yasushi SHOJI
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Richard @ 2014-02-17  9:43 UTC (permalink / raw)
  To: Marc Ihm; +Cc: emacs-orgmode

Marc Ihm <marc@ihm.name> writes:
> (global-set-key (kbd "<f12>") (lambda () (interactive) (execute-kbd-macro (kbd "C-c a v"))))

(global-set-key (kbd "<f12>") (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.

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

* Re: simple way to call `C-c a v' or a way to bind it to a key?
  2014-02-17  9:43   ` Nicolas Richard
@ 2014-02-18  3:45     ` Yasushi SHOJI
  0 siblings, 0 replies; 8+ messages in thread
From: Yasushi SHOJI @ 2014-02-18  3:45 UTC (permalink / raw)
  To: theonewiththeevillook; +Cc: emacs-orgmode

At Mon, 17 Feb 2014 10:43:48 +0100,
Nicolas Richard wrote:
> 
> Marc Ihm <marc@ihm.name> writes:
> > (global-set-key (kbd "<f12>") (lambda () (interactive) (execute-kbd-macro (kbd "C-c a v"))))
> 
> (global-set-key (kbd "<f12>") (kbd "C-c a v"))

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

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

end of thread, other threads:[~2014-02-18  3:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 13:35 simple way to call `C-c a v' or a way to bind it to a key? Yasushi SHOJI
2014-02-15 14:38 ` Thorsten Jolitz
2014-02-15 16:31   ` Yasushi SHOJI
2014-02-15 17:34     ` Thorsten Jolitz
2014-02-16  8:07       ` Yasushi SHOJI
2014-02-16 21:20 ` Marc Ihm
2014-02-17  9:43   ` Nicolas Richard
2014-02-18  3:45     ` Yasushi SHOJI

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