emacs-devel
[Top][All Lists]
Advanced

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

Re: Ordering of command completions


From: Lars Magne Ingebrigtsen
Subject: Re: Ordering of command completions
Date: Sun, 07 Dec 2014 22:47:48 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

I've done ten minutes of exploratory hacking to see whether it would be
a lot of work to get this to work.  The `declare' solution turns out to
be rather trivial, apparently.

The patch below is all that's needed to add a new `declare' form.  And
then, after marking some stuff up, we just have to make the `M-x'
completion function examine the `mode' `function-get' value, and compare
it to the current modes in effect.

So if we decide to do something like this, getting the framework in
place is very little work.  Annotating all of Emacs is a bit larger
(ahem), but it can be done gradually, and `M-x TAB' would work a bit
better each week...

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 8bf63ea..098f1c4 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -105,6 +105,11 @@ The return value of this function is not used."
                    ''pure (list 'quote val)))
          "If non-nil, the compiler can replace calls with their return value.
 This may shift errors from run-time to compile-time.")
+   (list 'mode
+         #'(lambda (f _args val)
+             (list 'function-put (list 'quote f)
+                   ''mode (list 'quote val)))
+         "If non-nil, this command belongs in a specific mode, or a list of 
modes.")
    (list 'side-effect-free
          #'(lambda (f _args val)
              (list 'function-put (list 'quote f)

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