From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Optional arg via lambda
Date: Wed, 13 Nov 2013 12:19:35 +0100 [thread overview]
Message-ID: <868uws1rco.fsf@somewhere.org> (raw)
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').
--8<---------------cut here---------------start------------->8---
(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!"))))
--8<---------------cut here---------------end--------------->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:
--8<---------------cut here---------------start------------->8---
(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!"))))
--8<---------------cut here---------------end--------------->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?
Best regards,
Seb
--
Sebastien Vauban
next reply other threads:[~2013-11-13 11:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 11:19 Sebastien Vauban [this message]
2013-11-13 11:33 ` Optional arg via lambda Thorsten Jolitz
[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=868uws1rco.fsf@somewhere.org \
--to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
--cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.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.