From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Memnon Anon Newsgroups: gmane.emacs.help Subject: Re: Prefix-Arg (non-interactive!) in Info Date: Fri, 13 Aug 2010 19:04:30 +0200 Message-ID: <87fwyitrgv.fsf@mean.albasani.net> References: <878w4avcir.fsf@mean.albasani.net> <838w4av8xg.fsf@gnu.org> <87r5i2ttle.fsf@mean.albasani.net> <837hjuv6jn.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1281719117 19852 80.91.229.12 (13 Aug 2010 17:05:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Aug 2010 17:05:17 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 13 19:05:16 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 1Ojxgv-0003hj-Ub for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Aug 2010 19:05:14 +0200 Original-Received: from localhost ([127.0.0.1]:42662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ojxgu-000244-TB for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Aug 2010 13:05:12 -0400 Original-Received: from [140.186.70.92] (port=36685 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjxgT-00023q-NF for help-gnu-emacs@gnu.org; Fri, 13 Aug 2010 13:04:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjxgP-0001Jl-Fg for help-gnu-emacs@gnu.org; Fri, 13 Aug 2010 13:04:45 -0400 Original-Received: from mail-ew0-f41.google.com ([209.85.215.41]:60532) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjxgL-0001Ig-5A; Fri, 13 Aug 2010 13:04:37 -0400 Original-Received: by ewy28 with SMTP id 28so1526708ewy.0 for ; Fri, 13 Aug 2010 10:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:message-id:references:user-agent:date:mime-version :content-type; bh=kNrMhiYcQH+kxYbn3HD9bX5yr0hvFJMY9Ehxo0Ex26k=; b=S296Elt4wWbmc4lKBqTXLL5xhdBWemrEZ/t5aoveaN2sENH3d+jZUdT/7P/RkOWDwr ZxH0MpiPRe7AwGXi/bdG50chT3qHRHPOJ4MJMlZCgo61aJUqlGd2r3kO+9KHun5BdD+e DX+ov6HjJojJBPv61DvxkJlfjTBL1z+cJ+2aE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:in-reply-to:message-id:references:user-agent :date:mime-version:content-type; b=wNlSi7+Rnt3OmqME+WdIgClD9jIGbFkBymmBKoye5gHKNneNKTNINR5O1EasD2bsND vnswme60toaw99OGwfIZa/z9OL3v6fZUX5q0gSzfvwx3w8tlvpQAPBFtexb7UbZH+f+4 c1nC+UUGazFVRErWIrNbRXJxU+zvUbTqEOYr0= Original-Received: by 10.213.19.67 with SMTP id z3mr1951527eba.50.1281719075844; Fri, 13 Aug 2010 10:04:35 -0700 (PDT) Original-Received: from localhost (e178211048.adsl.alicedsl.de [85.178.211.48]) by mx.google.com with ESMTPS id u9sm4516096eeh.17.2010.08.13.10.04.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 13 Aug 2010 10:04:35 -0700 (PDT) In-Reply-To: <837hjuv6jn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Aug 2010 19:09:00 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:74620 Archived-At: 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