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: tomas
Subject: Re: Smarter M-x that filters on major-mode
Date: Thu, 11 Feb 2021 09:40:19 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Feb 10, 2021 at 08:50:10PM -0600, Stefan Kangas wrote:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
> 
> > Matt Armstrong <matt@rfc20.org> writes:
> >
> >> What if instead help showed all the interactive commands provided by
> >> the mode? What if M-x were smarter about highlighting mode specific
> >> commands?
> >
> > It's been discussed before -- somebody just has to implement one of the
> > various possibilities here.  The problem is that commands are only tied
> > very loosely to modes:
> >
> > (defun foo-thing ()
> >   (interactive)
> >   ...)
> >
> > will make `M-x fTAB' show `foo-thing' even if it's useless outside of
> > all other modes than `foo-mode'.  Conversely, `C-h m' in `foo-mode'
> > won't, as you mention, list `foo-thing' unless there's a binding for it.
> >
> > My suggestion is to introduce a new form:
> >
> > (defun foo-thing ()
> >   (command foo-mode)
> >   ...)
> >
> > This would be just like `interactive', but will do the right thing in
> > `M-x fTAB' and `C-h m' in modes derived from `foo-mode'.  (It could also
> > be a list of mode, of course, but that'd be more rare, is my guess.)
> 
> It would indeed be very useful to provide a mechanism to exclude
> commands from M-x that are useless outside of their major mode.

Nobody uses M-x in an explorative way?

IMO this is a bad idea for discoverability. What is (and what is not)
relevant to a mode is necessarily subject to a judgement call by
someone.

Some thought needs to go into how give users a way to escape that
confinement, I think.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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