emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [OT] Passing universal argument to a function (was: Bind C-u C


From: Memnon Anon
Subject: [Orgmode] [OT] Passing universal argument to a function (was: Bind C-u C-c C-x C-i to a key)
Date: Fri, 13 Aug 2010 05:12:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Andreas Burtzlaff <address@hidden> writes:

> The C-u says that the function that is bound to the rest of the key
> combination is called with the first argument being `t'.
>
> To get information about the function bound to a key combination use:
> C-h k 
> and then press the key combination (without the C-u prefix).
> In this case it is org-clock-in.
>
> This should bind org-clock-in with argument `t' to F12:
>
> (defun ab-org-clock-in-select ()
>   (interactive)
>   (org-clock-in t))
>
> (global-set-key (kbd "<f12>") 'ab-org-clock-in-select)

Mhhh, this does not work for me.

,----[ (info "(eintr)Note for Novices") ]
|    In addition to typing a lone keychord, you can prefix what you type
| with `C-u', which is called the `universal argument'.  The `C-u'
| keychord passes an argument to the subsequent command. [...]  
| (If you do not specify a number, Emacs either passes the number 4 to
| the command or otherwise runs the command differently than it would
| otherwise.)
`----

So, afaics C-u = Value of 4.

Some googling seems to suggest that an argument of '(4) works,
and it does for me:

--8<---------------cut here---------------start------------->8---
(defun ab-org-clock-in-select ()
  (interactive)
  (org-clock-in '(4)))
--8<---------------cut here---------------end--------------->8---

or even shorter with a lambda

--8<---------------cut here---------------start------------->8---
(global-set-key (kbd "C-c C-g") (lambda () (interactive) (org-clock-in '(4))))
--8<---------------cut here---------------end--------------->8---

works here!

However, this faq [ (info "(efaq)Replying to the sender of a message") ]
seems to suggest that your version is the way to go.

...

I am confused.

However, this is org OT, so I'll finish my musings here :)
Go with whatever works for you.

Memnon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]