* 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
* Re: Optional arg via lambda
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>
1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-11-13 11:33 UTC (permalink / raw)
To: help-gnu-emacs
"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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Optional arg via lambda
[not found] ` <mailman.5951.1384342463.10748.help-gnu-emacs@gnu.org>
@ 2013-11-13 13:38 ` Sebastien Vauban
0 siblings, 0 replies; 3+ messages in thread
From: Sebastien Vauban @ 2013-11-13 13:38 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
Hi Thorsten,
Thorsten Jolitz wrote:
>> 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?
Of course, it does!
Thanks for spotting this 3-char bug...
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).