emacs-devel
[Top][All Lists]
Advanced

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

Re: Making `interactive' conditional


From: Clément Pit--Claudel
Subject: Re: Making `interactive' conditional
Date: Mon, 11 Jan 2016 21:14:44 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 01/10/2016 04:02 AM, Lars Magne Ingebrigtsen wrote:
> John Wiegley <address@hidden> writes:
> 
>> Right now, functions are interactive if declared with `interactive', and not
>> otherwise. The suggestion at hand is to allow `interactive' forms to become
>> conditional -- possibly in multiple ways. I like this concept, and think the
>> right place for it is indeed in core.
>>
>> The question is how to declare such conditionality. We can do this rather
>> easily by accepting new keyword arguments to `interactive':
>>
>>     (interactive "sDirectory: " [:mode foo-mode] [:when <function>])
> 
> That does sound kinda exciting.  To take a random example, `M-x
> delete-matching-lines' could have a :when of `buffer-writable-p' and not
> auto-complete when in a read-only buffer.  Etc.

It seems interactive already has support for a limited version of this:

  > If ‘*’ appears at the beginning of the string, then an error is signaled if 
the buffer is read-only. 

So the annotation is already there, at least for some function that use a 
string-based interactive spec. But maybe everyone already had this in mind? 
(450 of the approx 4500 string-based interactive specs in core Emacs use that)

Clément.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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