emacs-devel
[Top][All Lists]
Advanced

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

Re: Leaving out non-applicable commands on Mx


From: Lars Magne Ingebrigtsen
Subject: Re: Leaving out non-applicable commands on Mx
Date: Sat, 09 Jan 2016 09:06:08 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux)

John Wiegley <address@hidden> writes:

>>>>>> Óscar Fuentes <address@hidden> writes:
>
>>> We've discussed before adding mechanisms for leaving mode-specific commands
>>> out, but I was apparently the only one enthusiastic about it...
>
>> You sketched a possible implementation. If you are interested on completing
>> the part that requires a smart hacker, I'll do the part that requires a dumb
>> one :-)
>
> What is this feature suggestion again?

Marking commands as applicable to a mode (or a set of modes) so that
completion doesn't list them outside of those modes.

This requires instrumentation of all interactive commands.  :-)  But for
virtually all modes, it's just a search and replace action.

Óscar mentioned one syntax suggestion for this:

(defun foo-something (bar)
  "docstring"
  (interactive "p")
  (declare (mode foo))
  ...)

This would be backwards compatible.  The other one is to introduce a new
form `command':

(defun foo-something (bar)
  "docstring"
  (command 'foo "p")
  ...)

where the first element is a mode name, or a list of mode names, where
the command applies.

So, three things need to be done:

1) Decide what syntax we want for this (and implement it in Emacs),

2) Alter `M-x' to react to this new data (which will probably be
something in the symbol list, I guess?) to complete only over commands
that are either available globally, or in the current local mode(s).

and then people can calmly

3) Convert all packages in Emacs (mostly with a replace-string) to use
the new syntax, and `M-x' will slowly grow better and better as a tool
to discover commands.

I favour the `command' solution.  It looks cleaner as a language
element, especially since virtually (well beyond 90%) every command in
Emacs will have one of these.

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