[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making `interactive' conditional
From: |
Lars Magne Ingebrigtsen |
Subject: |
Re: Making `interactive' conditional |
Date: |
Sun, 10 Jan 2016 10:02:55 +0100 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) |
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.
> This way, all new modes can take advantage of this support as it becomes
> available. I've already tested on 24.5, and keyword arguments are silently
> ignored by present-day GNU Emacs. This gives us transparent compatibility in
> both directions.
Does this also work when transforming (interactive) without parameters,
or do we need to put a nil in there?
> We could also do it with (declare); I'm open to that too, and it also
> gives us such compatibility.
I think the interactive with keywords sounds nice, but both are fine by
me...
> At first, I imagine nothing delivered with Emacs will be conditional, because
> it requires annotating packages retroactively. We could alleviate some of that
> by writing code to automatically consider every interactive function *without
> an autoload token* as being conditional on any modes defined in the same
> package (likely determined by prefix matching). The use of such automation
> would be configurable and off by default, at least until we believe it's ready
> for prime-time.
Hm... I think that sounds a bit too magical to be workable in general.
I may be wrong, but I think that would probably lead to undesirable side
effects (i.e., commands that should be available globally not being
available).
Magic is nice if you can get it to work, but explicit marking is
flexible.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Leaving out non-applicable commands on Mx, (continued)
- Re: Leaving out non-applicable commands on Mx, Óscar Fuentes, 2016/01/08
- 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 <=
- Re: Making `interactive' conditional, Clément Pit--Claudel, 2016/01/10
- 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