[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Smarter M-x that filters on major-mode
From: |
Stefan Monnier |
Subject: |
Re: Smarter M-x that filters on major-mode |
Date: |
Fri, 12 Feb 2021 12:36:23 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
There seems to be an assumption here that the defining info to hiding
a command (or not) is the current major mode.
While it's an important case, I think it'd be a mistake to design
a feature that can only use such tests. There are many other useful
conditions that one might like to test, such as the activation of the
region, the existence of some other buffer, etc...
Stefan
jao [2021-02-12 16:18:48] wrote:
> On Fri, Feb 12 2021, Lars Ingebrigtsen wrote:
>
>> "Jose A. Ortega Ruiz" <jao@gnu.org> writes:
>>
>>> You probably have already thought of it, and discarded it for a good
>>> reason, but why not, instead of a new `command' form, just add a new
>>> (optional) argument to `interactive'?
>>>
>>> (defun foo2 (arg)
>>> (interactive "p" c-mode)
>>> (message "%s 2" arg))
>>
>> The argument to `interactive' is optional, so it'd be
>>
>> (defun foo2 ()
>> (interactive nil c-mode)
>>
>> in most of the cases, which seemed less than ideal. But on the other
>> hand, not introducing a new keyword would perhaps help with reading
>> comprehension.
>
> it's perhaps more tricky, but it could also be
>
> (interactive 'c-mode)
>
> which is distinguisable from a string or a form:
>
> (interactive "p")
> (interactive (list a b))
>
> i.e., one adopts the convention that if the argument's value is a
> symbol, it denotes a mode. personally, i would like that option even
> better, but i'd understand people might consider it a bit brittle.
- Re: Smarter M-x that filters on major-mode, (continued)
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Jose A. Ortega Ruiz, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/12
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Stefan Kangas, 2021/02/12
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode,
Stefan Monnier <=
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Dmitry Gutov, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/12
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/12
- Re: [External] : Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/12
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/12
- Re: [External] : Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/13
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/13