all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Optional arg via lambda
Date: Wed, 13 Nov 2013 12:33:56 +0100	[thread overview]
Message-ID: <87bo1olemz.fsf@gmail.com> (raw)
In-Reply-To: 868uws1rco.fsf@somewhere.org

"Sebastien Vauban" <sva-news@mygooglest.com>
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




  reply	other threads:[~2013-11-13 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 11:19 Optional arg via lambda Sebastien Vauban
2013-11-13 11:33 ` Thorsten Jolitz [this message]
     [not found] ` <mailman.5951.1384342463.10748.help-gnu-emacs@gnu.org>
2013-11-13 13:38   ` Sebastien Vauban

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=87bo1olemz.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.