emacs-devel
[Top][All Lists]
Advanced

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

Re: Experimentally unbind M-o on the trunk


From: Lars Ingebrigtsen
Subject: Re: Experimentally unbind M-o on the trunk
Date: Wed, 10 Feb 2021 20:16:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

A

  (declare (mode foo-mode))

form would also work, but it's a bit more verbose and noisy.

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