emacs-devel
[Top][All Lists]
Advanced

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

Re: Smarter M-x that filters on major-mode


From: Lars Ingebrigtsen
Subject: Re: Smarter M-x that filters on major-mode
Date: Fri, 12 Feb 2021 10:32:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"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 could even accept more than one mode
>
>   (defun foo2 (arg)
>    (interactive "p" text-mode json-mode)
>    (message "%s 2" arg))
>
> and for users it'd be arguably easier to recognize what it means at a
> glance (since we all know about `interactive').

Yup.

Hm...  I don't know?  Extending `interactive' may be a better than
introducing a new directive.  Any opinions here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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