From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Optional arg via lambda Date: Wed, 13 Nov 2013 12:33:56 +0100 Message-ID: <87bo1olemz.fsf@gmail.com> References: <868uws1rco.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1384342473 12302 80.91.229.3 (13 Nov 2013 11:34:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2013 11:34:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 13 12:34:38 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VgYiS-00026P-Ql for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 12:34:36 +0100 Original-Received: from localhost ([::1]:48032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgYiS-0005OQ-Bz for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 06:34:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgYi7-0005Dp-PY for help-gnu-emacs@gnu.org; Wed, 13 Nov 2013 06:34:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgYi1-0002eI-Ii for help-gnu-emacs@gnu.org; Wed, 13 Nov 2013 06:34:15 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:39685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgYi1-0002e0-D6 for help-gnu-emacs@gnu.org; Wed, 13 Nov 2013 06:34:09 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VgYhz-0001X2-2Z for help-gnu-emacs@gnu.org; Wed, 13 Nov 2013 12:34:07 +0100 Original-Received: from e178063059.adsl.alicedsl.de ([85.178.63.59]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Nov 2013 12:34:07 +0100 Original-Received: from tjolitz by e178063059.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Nov 2013 12:34:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178063059.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:svBCwFgN2hg9gmHDuRokZIxdEHA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94476 Archived-At: "Sebastien Vauban" writes: > Hello, > > In my config, I have written this to check whether Org 8 is installed > when trying to call the "export dispatcher" (bound, here, to `C-x > C-e'). > > (define-key org-mode-map > (kbd "C-c C-e") > (lambda () > (interactive) > (if (fboundp 'org-export-dispatch) > (org-export-dispatch) > (message "Upgrade to Org 8!")))) > > However, the above code drops the optional `C-u' which we can use when > calling `org-export-dispatch'. IOW, `C-u C-x C-e' does the same as > `C-x C-e'. > > I've tried adding an optional arg to the `lambda' and to pass it to > the funcall of `org-export-dispatch', as shown here: > > (define-key org-mode-map > (kbd "C-c C-e") > (lambda (&optional arg) > (interactive) > (if (fboundp 'org-export-dispatch) > (progn > (message "arg: %s" arg) > (funcall 'org-export-dispatch arg)) > (message "Upgrade to Org 8!")))) > > But this does not work: `org-export-dispatch' is well called when > pressing both `C-x C-e' and `C-u C-x C-e', but the `C-u' is never > passed along to the original `org-export-dispatch' function. > > What am I missing? does ,------------------------ | (lambda (&optional arg) | (interactive "P") ... `------------------------ make a difference? -- cheers, Thorsten