From: Markus Heller <hellerm2@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [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 09:49:04 -0700 [thread overview]
Message-ID: <0v62zezce7.fsf@gmail.com> (raw)
In-Reply-To: 87bp978cz8.fsf@mean.albasani.net
Memnon Anon <gegendosenfleisch@googlemail.com> writes:
> Andreas Burtzlaff <andy13@gmx.net> 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:
>
> (defun ab-org-clock-in-select ()
> (interactive)
> (org-clock-in '(4)))
>
> or even shorter with a lambda
>
> (global-set-key (kbd "C-c C-g") (lambda () (interactive) (org-clock-in '(4))))
>
> works here!
Works here too! Thanks a lot!
> However, this faq [ (info "(efaq)Replying to the sender of a message") ]
> seems to suggest that your version is the way to go.
I'm not quite sure I understand this ...
But again, thanks anyway!
Markus
> ...
>
> I am confused.
>
> However, this is org OT, so I'll finish my musings here :)
> Go with whatever works for you.
>
> Memnon
>
> _______________________________________________
> 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
next prev parent reply other threads:[~2010-08-13 16:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 23:13 Bind C-u C-c C-x C-i to a key Markus Heller
2010-08-12 23:37 ` Andreas Burtzlaff
2010-08-13 3:12 ` [OT] Passing universal argument to a function (was: Bind C-u C-c C-x C-i to a key) Memnon Anon
2010-08-13 16:49 ` Markus Heller [this message]
2010-08-14 23:41 ` Docstrings: Use of `C-u' (was: [OT] Passing universal argument to a function) Memnon Anon
2010-08-16 18:54 ` Docstrings: Use of `C-u' Bastien
2010-08-16 19:01 ` Bastien
2010-08-13 7:09 ` Re: Bind C-u C-c C-x C-i to a key Bastien
2010-08-13 7:12 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0v62zezce7.fsf@gmail.com \
--to=hellerm2@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.