aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-02-13 22:46:14 +0100
committerLars Ingebrigtsen2021-02-13 22:46:14 +0100
commit636d2a71dd8d8f4730c7b2def10b93a14d026e0f (patch)
tree9e4cfe668a4bcea0299a628320ed07bcf348a588
parent56c03c05d7410e08e576ea983dc381dc6cfb5597 (diff)
downloademacs-636d2a71dd8d8f4730c7b2def10b93a14d026e0f.tar.gz
emacs-636d2a71dd8d8f4730c7b2def10b93a14d026e0f.zip
Experiment with a mode-base `declare'
-rw-r--r--doc/lispref/functions.texi3
-rw-r--r--lisp/emacs-lisp/byte-run.el9
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 9929739f04d..1e3da8e3a5d 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -2316,6 +2316,9 @@ completions in @kbd{M-x}. @var{completion-predicate} is called with
2316two parameters: The first parameter is the symbol, and the second is 2316two parameters: The first parameter is the symbol, and the second is
2317the current buffer. 2317the current buffer.
2318 2318
2319@item (modes @var{modes})
2320Specify that this command is meant to be applicable for @var{modes}
2321only.
2319@end table 2322@end table
2320 2323
2321@end defmac 2324@end defmac
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 2d34c98ba1b..bc7159c3ce0 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -148,6 +148,12 @@ The return value of this function is not used."
148 (list 'function-put (list 'quote f) 148 (list 'function-put (list 'quote f)
149 ''completion-predicate val))) 149 ''completion-predicate val)))
150 150
151(defalias 'byte-run--set-modes
152 #'(lambda (f _args val)
153 (list 'function-put (list 'quote f)
154 ''completion-predicate `(lambda (_ b)
155 (completion-with-modes-p ,var b)))))
156
151;; Add any new entries to info node `(elisp)Declare Form'. 157;; Add any new entries to info node `(elisp)Declare Form'.
152(defvar defun-declarations-alist 158(defvar defun-declarations-alist
153 (list 159 (list
@@ -165,7 +171,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
165 (list 'compiler-macro #'byte-run--set-compiler-macro) 171 (list 'compiler-macro #'byte-run--set-compiler-macro)
166 (list 'doc-string #'byte-run--set-doc-string) 172 (list 'doc-string #'byte-run--set-doc-string)
167 (list 'indent #'byte-run--set-indent) 173 (list 'indent #'byte-run--set-indent)
168 (list 'completion #'byte-run--set-completion)) 174 (list 'completion #'byte-run--set-completion)
175 (list 'modes #'byte-run--set-modes))
169 "List associating function properties to their macro expansion. 176 "List associating function properties to their macro expansion.
170Each element of the list takes the form (PROP FUN) where FUN is 177Each element of the list takes the form (PROP FUN) where FUN is
171a function. For each (PROP . VALUES) in a function's declaration, 178a function. For each (PROP . VALUES) in a function's declaration,