help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suppress user-prompting when calling commands in programs


From: Thorsten Jolitz
Subject: Re: Suppress user-prompting when calling commands in programs
Date: Fri, 13 Jun 2014 17:09:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> (defun foo (&optional arg)
>>>   (interactive "P")
>>>   (let ((bar (org-icompleting-read ...)))))
>> Yuck!
>
> Indeed, the prompting should normally take place in the `interactive'
> spec, but the above is sadly pretty common.
>
>>> Assuming `foo' can't be changed - is there another way to bind `bar'
>>> before calling `foo' in a program rather than advising `foo' (with the
>>> aim to suppress any user-prompting at all during the execution of
>>> `foo')?
>
> Not really, no.  And advising `foo' only won't help: you also need to
> advise org-icompleting-read.
>
>> cl-flet org-icompleting-read to 'ignore?
>
> Nope.  That worked with `flet', but `cl-flet' is actually providing
> Common-Lisp's `flet' which defines a lexically-scoped function.
> Better use an advice here.

Thanks (Eli and) Stefan, so an advice is ok here.

-- 
cheers,
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]