From mboxrd@z Thu Jan 1 00:00:00 1970 From: Memnon Anon 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 Message-ID: <87bp978cz8.fsf@mean.albasani.net> References: <0vhbizzap7.fsf@gmail.com> <87ocd71jz6.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=43207 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ojki7-0004Rj-E9 for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 23:13:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ojki6-0002g2-DD for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 23:13:35 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:46334) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ojki6-0002ft-7Y for emacs-orgmode@gnu.org; Thu, 12 Aug 2010 23:13:34 -0400 Received: by ewy28 with SMTP id 28so1113866ewy.0 for ; Thu, 12 Aug 2010 20:13:32 -0700 (PDT) In-Reply-To: <87ocd71jz6.fsf@gmx.net> (Andreas Burtzlaff's message of "Fri, 13 Aug 2010 01:37:01 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Burtzlaff Cc: Markus Heller , emacs-orgmode@gnu.org Andreas Burtzlaff 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 "") '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