[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 12578d6: Change how (declare (modes store the data
From: |
Lars Ingebrigtsen |
Subject: |
master 12578d6: Change how (declare (modes store the data |
Date: |
Sat, 20 Feb 2021 08:29:50 -0500 (EST) |
branch: master
commit 12578d6aca2cc7182afdd070aa31c7aff6a3add8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Change how (declare (modes store the data
* lisp/emacs-lisp/byte-run.el (byte-run--set-modes): Change from
being a predicate to storing the modes. This allows using the
modes for positive command discovery, too.
* src/data.c (Fcommand_modes): Look at the `command-modes' symbol
property, too.
---
lisp/emacs-lisp/byte-run.el | 4 +---
src/data.c | 10 +++++++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 76e7f01..afe94bb 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -154,9 +154,7 @@ The return value of this function is not used."
(defalias 'byte-run--set-modes
#'(lambda (f _args &rest val)
(list 'function-put (list 'quote f)
- ''completion-predicate
- `(lambda (_ b)
- (command-completion-with-modes-p ',val b)))))
+ ''command-modes (list 'quote val))))
;; Add any new entries to info node `(elisp)Declare Form'.
(defvar defun-declarations-alist
diff --git a/src/data.c b/src/data.c
index ace859d..9af9131 100644
--- a/src/data.c
+++ b/src/data.c
@@ -957,9 +957,17 @@ The value, if non-nil, is a list of mode name symbols. */)
if (NILP (fun))
return Qnil;
+ /* Use a `command-modes' property if present, analogous to the
+ function-documentation property. */
fun = command;
while (SYMBOLP (fun))
- fun = Fsymbol_function (fun);
+ {
+ Lisp_Object modes = Fget (fun, Qcommand_modes);
+ if (!NILP (modes))
+ return modes;
+ else
+ fun = Fsymbol_function (fun);
+ }
if (COMPILEDP (fun))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 12578d6: Change how (declare (modes store the data,
Lars Ingebrigtsen <=