[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: |
Sun, 10 Jan 2016 05:09:32 -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.
I think this is converging to what Stefan pointed earlier (which I found very
convincing/exciting): in its most basic form, this proposal could supersede a
lot of ad-hoc checking that many many commands do (by calling
`barf-if-buffer-read-only', for example).
Similarly, there are many commands that are marked interactive because they are
bound to keys in certain contexts, but make no sense (and will just immediately
error out if called from M-x) otherwise. I find it reasonable to think that if
a command is just going to exit in error as soon as I call it I probably don't
want it to feature prominently among M-x completions.
Cheers,
CLément.
signature.asc
Description: OpenPGP digital signature
- Re: Leaving out non-applicable commands on Mx, (continued)
- Re: Leaving out non-applicable commands on Mx, Stefan Monnier, 2016/01/08
- RE: Leaving out non-applicable commands on Mx, Drew Adams, 2016/01/08
- RE: Leaving out non-applicable commands on Mx, Drew Adams, 2016/01/08
- Re: Leaving out non-applicable commands on Mx, Óscar Fuentes, 2016/01/08
- Re: Leaving out non-applicable commands on Mx, Yuri Khan, 2016/01/09
- RE: Leaving out non-applicable commands on Mx, Drew Adams, 2016/01/09
- Making `interactive' conditional (was: Leaving out non-applicable commands on Mx), John Wiegley, 2016/01/09
- RE: Making `interactive' conditional (was: Leaving out non-applicable commands on Mx), Drew Adams, 2016/01/09
- RE: Making `interactive' conditional (was: Leaving out non-applicable commands on Mx), Drew Adams, 2016/01/11
- Re: Making `interactive' conditional, Lars Magne Ingebrigtsen, 2016/01/10
- Re: Making `interactive' conditional,
Clément Pit--Claudel <=
- RE: Making `interactive' conditional, Drew Adams, 2016/01/10
- Message not available
- Re: Making `interactive' conditional, Artur Malabarba, 2016/01/10
- Re: Making `interactive' conditional, Richard Stallman, 2016/01/10
- Re: Making `interactive' conditional, Lars Magne Ingebrigtsen, 2016/01/11
- Re: Making `interactive' conditional, Stefan Monnier, 2016/01/11
- Re: Making `interactive' conditional, Óscar Fuentes, 2016/01/11
- RE: Making `interactive' conditional, Herring, Davis, 2016/01/11
- Re: Making `interactive' conditional, Óscar Fuentes, 2016/01/11
- RE: Making `interactive' conditional, Herring, Davis, 2016/01/11
- Re: Making `interactive' conditional, Óscar Fuentes, 2016/01/11