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: Sat, 13 Feb 2021 12:28:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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...

Commands bound to modes cover 97% of the cases, my stats dept. informs
me, so I think it's important to have a short, easy form to allow
annotating functions according to modes -- hence the
`interactive'/`command' bit: If there's any hope in having people
actually do markup in this way, it should be easy to do, and the
resulting code shouldn't be a chore to look at.

But for the remaining 3% of the cases, a more general mechanism is
needed, and that's why I added the (declare (completion PREDICATE))
thing, too.

That is

  (interactive "p" foo-mode)

is identical to

  (declare (completion completion-major-mode-p))
  (interactive "p")

in effect.  But the former is nicer to type and read, I think.

-- 
(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]