summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2024-02-05 17:56:11 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2024-02-05 18:02:19 +0100
commit5e69376292994ffe69b7f8f52ae1ad85c60c2d29 (patch)
tree034db50033fe762a575f2bb3e13365a01ae92499 /lisp/emacs-lisp
parent95c8bfb11ec82e67652e5903495c1fcb5c61ace2 (diff)
downloademacs-5e69376292994ffe69b7f8f52ae1ad85c60c2d29.tar.gz
emacs-5e69376292994ffe69b7f8f52ae1ad85c60c2d29.tar.bz2
emacs-5e69376292994ffe69b7f8f52ae1ad85c60c2d29.zip
Grudgingly accept function values in the function position
* lisp/emacs-lisp/cconv.el (cconv-convert): Warn about (F ...) where F is a non-symbol function value (bytecode object etc), but let it pass for compatibility's sake (bug#68931). * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--fun-value-as-head): New test.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cconv.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index e210cfdf5ce..4ff47971351 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -621,12 +621,16 @@ places where they originally did not directly appear."
(cconv-convert exp env extend))
(`(,func . ,forms)
- (if (symbolp func)
+ (if (or (symbolp func) (functionp func))
;; First element is function or whatever function-like forms are:
;; or, and, if, catch, progn, prog1, while, until
- `(,func . ,(mapcar (lambda (form)
- (cconv-convert form env extend))
- forms))
+ (let ((args (mapcar (lambda (form) (cconv-convert form env extend))
+ forms)))
+ (unless (symbolp func)
+ (byte-compile-warn-x
+ form
+ "Use `funcall' instead of `%s' in the function position" func))
+ `(,func . ,args))
(byte-compile-warn-x form "Malformed function `%S'" func)
nil))