emacs-devel
[Top][All Lists]
Advanced

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

Re: Current mode command discovery


From: Lars Ingebrigtsen
Subject: Re: Current mode command discovery
Date: Wed, 17 Feb 2021 12:30:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Note: THIS IS NOT A DISCUSSION ABOUT M-X.

Óscar Fuentes <ofv@wanadoo.es> writes:

> That would be very interesting, but AFAIU with the current
> implementation it has some problems.
>
> It would miss some candidates which belong to the current mode although
> they are not marked as mode-specific because they are also applicable to
> other contexts. This would be confusing for the user.
>
> So we need a mechanism for saying `foo-bar-command' belongs to
> `foo-mode', but it is not specific of that mode.

Yes, that's a problem.

Hm...  there's two obvious sources if information about what commands
"belong" to a mode: There's the key bindings, and then there's the new
mode tagging.  We could perhaps use both in this new command?  I.e., if
somebody has gone to the trouble to add a command to the keymap of the
mode, then it's probably pretty useful for that mode?

A more serious problem that this brings up is the problem with
non-mode-specific predicates: They don't convey any information about
why the predicate is t/nil.  Say you have

(defun foo-spiffy-command ()
  (declare (predicate my-clever-predicate-p))
  (interactive))

When listing mode-specific commands, and this predicate returns t,
should it be included?  Yes?  No?  There's no way of saying, really...

So: Tagging by mode conveys more information to the system than just
having predicates, and we can use that.  This also means that

  (declare (modes ...))

should be implemented differently than it is today (which is just
slapping a predicate onto the symbol-plist).

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