From: Memnon Anon <gegendosenfleisch@googlemail.com>
To: Andreas Burtzlaff <andy13@gmx.net>
Cc: Markus Heller <hellerm2@gmail.com>, emacs-orgmode@gnu.org
Subject: [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 [thread overview]
Message-ID: <87bp978cz8.fsf@mean.albasani.net> (raw)
In-Reply-To: <87ocd71jz6.fsf@gmx.net> (Andreas Burtzlaff's message of "Fri, 13 Aug 2010 01:37:01 +0200")
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:
--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
next prev parent reply other threads:[~2010-08-13 3:13 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 ` Memnon Anon [this message]
2010-08-13 16:49 ` [OT] Passing universal argument to a function (was: Bind C-u C-c C-x C-i to a key) Markus Heller
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=87bp978cz8.fsf@mean.albasani.net \
--to=gegendosenfleisch@googlemail.com \
--cc=andy13@gmx.net \
--cc=emacs-orgmode@gnu.org \
--cc=hellerm2@gmail.com \
/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.