all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Optional arg via lambda
@ 2013-11-13 11:19 Sebastien Vauban
  2013-11-13 11:33 ` Thorsten Jolitz
       [not found] ` <mailman.5951.1384342463.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastien Vauban @ 2013-11-13 11:19 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-13 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 11:19 Optional arg via lambda Sebastien Vauban
2013-11-13 11:33 ` Thorsten Jolitz
     [not found] ` <mailman.5951.1384342463.10748.help-gnu-emacs@gnu.org>
2013-11-13 13:38   ` Sebastien Vauban

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.