From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Prefix-Arg (non-interactive!) in Info Date: Fri, 13 Aug 2010 19:40:25 +0200 Message-ID: <4C658389.4000901@easy-emacs.de> References: <878w4avcir.fsf@mean.albasani.net> <838w4av8xg.fsf@gnu.org> <87r5i2ttle.fsf@mean.albasani.net> <837hjuv6jn.fsf@gnu.org> <87fwyitrgv.fsf@mean.albasani.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1281721342 3172 80.91.229.12 (13 Aug 2010 17:42:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Aug 2010 17:42:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 13 19:42:21 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OjyGq-0005KB-Nx for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Aug 2010 19:42:21 +0200 Original-Received: from localhost ([127.0.0.1]:51173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjyGq-0005Cm-4N for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Aug 2010 13:42:20 -0400 Original-Received: from [140.186.70.92] (port=57804 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjyG3-0005A4-9N for help-gnu-emacs@gnu.org; Fri, 13 Aug 2010 13:41:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjyG1-0006Vo-RM for help-gnu-emacs@gnu.org; Fri, 13 Aug 2010 13:41:31 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.9]:54268) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjyG1-0006VV-AV for help-gnu-emacs@gnu.org; Fri, 13 Aug 2010 13:41:29 -0400 Original-Received: from [192.168.178.27] (brln-4dbc479c.pool.mediaWays.net [77.188.71.156]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0Lnlkd-1POpei0823-00hFbE; Fri, 13 Aug 2010 19:41:27 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 In-Reply-To: <87fwyitrgv.fsf@mean.albasani.net> X-Provags-ID: V02:K0:ZLFbYIMFGW8u+Q83SjYPebwDiUIJLB4EB1ylnGfw2+d uFtTW1vodllg2GwDau2POnqN7UQCuXEvpovKnxVlnU5qjg+sr+ BqTPbeSeZWvyKA1KWfuVUKC5IONc2zcnrpWVVKAngrNO2uNXoK j1B2X8lG9Zkj71aCv3WZPXWatuqho93bjXBm9EXZkEFtxv7bWK Y0Gn2XgGJCAJQ4S1Q6RioVECgodUUeFYHOLGQDoZFk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74621 Archived-At: Am 13.08.2010 19:04, schrieb Memnon Anon: > Eli Zaretskii writes: > >> Let's try a different approach: which function would you like to call >> non-interactively, passing it some value of the prefix arg? (Please >> don't say "it's not important which function": my point is _precisely_ >> that it _is_ important, because the answer to your question is >> specific to the function you want to invoke.) > > The function asked for was org-clock-in. > > ,----[ org-clock-in ] > | org-clock-in is an interactive compiled Lisp function. > | > | (org-clock-in&optional SELECT START-TIME) > | > | Start the clock on the current item. > | If necessary, clock-out of the currently active clock. > | With a prefix argument SELECT (C-u), offer a list of recently clocked tasks to > | clock into. When SELECT is C-u C-u, clock into the current task and mark > | is as the default task, a special task that will always be offered in > | the clocking selection, associated with the letter `d'. > `---- > > I knew `C-u' = 4 (and not "t" as someone suggested), so I tried > (global-set-key (kbd "") (lambda () (interactive) (org-clock-in 4))) > ^^^^^^^^^^^^^^^ > This did not work, but I was hardly surprised. > It never does on the first approach :) > > === > (Well, I had this example in mind: (info "(eintr)Interactive multiply-by-seven") > > (defun multiply-by-seven (number) ; Interactive version. > "Multiply NUMBER by seven." > (interactive "p") > (message "The result is %d" (* 7 number))) > > (multiply-by-seven 2) --> 14 > M-8 M-x multiply-by-seven --> 56 > C-u M-x multiply-by-seven --> 28 > Works for this function... > === > > So I tried to figure out in what form org-clock-in wanted its argument > of 4 passed in. > > And I found nothing, until I turned to google. > > ... > > Now I am really confused: > I expected this to work, but it does not: > (multiply-by-seven '(4)). > > Oh well, I still don't get it. > > But > (global-set-key (kbd "") (lambda () (interactive) (org-clock-in > '(4)))) > works, the questioner has an answer; problem solved. And I will > dedicate some time to learn elisp some, soon (at least the basics); > and I will start with a thorough reading of the elisp intro. > > Up to now, I could fix my and others problems by looking at working code > and fiddling until mine worked finally, too ... somehow; but I am > getting the impression this takes way more time on the long run than > learning the beast properly. > > Memnon > > Hi, remember having that kind of diffcults too when starting with Emacs. Somehow that issue may fit into another thread at emacs-devel "Emacs learning curve." Difficulty was the notion of "Universal argument". From now: it's a kind of interface from the Emacs Lisp side providing an input facility bound to a predefined key. Basically it's a tool to toggle, a switch taking args with it. You must only think of it, when writing something taking user input. There are more provisions for user input. Universal argument is just one. Andreas