From: Stefan Monnier Date: Fri, 29 Apr 2022 19:29:35 +0000 (-0400) Subject: CL types: Accept both `byte-code-function` and `compiled-function` X-Git-Tag: emacs-29.0.90~1931^2~213 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=acc985ae7cab66ceb4e81ab403e39e933e851d9e;p=emacs.git CL types: Accept both `byte-code-function` and `compiled-function` `type-of` returns `compiled-function` for bytecode functions, but the predicate for those objects is called `byte-code-function-p`, So accept both `compiled-function` and `byte-code-function` as type names for those objects. * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add `byte-code-function`. * lisp/emacs-lisp/cl-macs.el (byte-code-function, compiled-function, subr): New types. --- diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c2f8c4d009c..a9d422929f1 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3403,9 +3403,11 @@ Of course, we really can't know that for sure, so it's just a heuristic." (boolean . booleanp) (bool-vector . bool-vector-p) (buffer . bufferp) + (byte-code-function . byte-code-function-p) (character . natnump) (char-table . char-table-p) (command . commandp) + (compiled-function . byte-code-function-p) (hash-table . hash-table-p) (cons . consp) (fixnum . fixnump) @@ -3419,6 +3421,7 @@ Of course, we really can't know that for sure, so it's just a heuristic." (null . null) (real . numberp) (sequence . sequencep) + (subr . subrp) (string . stringp) (symbol . symbolp) (vector . vectorp) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 93713f506d2..ab7c56c4e00 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -59,7 +59,17 @@ ;; accepted, pretty much. (marker number-or-marker atom) (overlay atom) (float number atom) (window-configuration atom) - (process atom) (window atom) (subr atom) (compiled-function function atom) + (process atom) (window atom) + ;; FIXME: We'd want to put `function' here, but that's only true + ;; for those `subr's which aren't special forms! + (subr atom) + ;; FIXME: We should probably reverse the order between + ;; `compiled-function' and `byte-code-function' since arguably + ;; `subr' and also "compiled functions" but not "byte code functions", + ;; but it would require changing the value returned by `type-of' for + ;; byte code objects, which risks breaking existing code, which doesn't + ;; seem worth the trouble. + (compiled-function byte-code-function function atom) (module-function function atom) (buffer atom) (char-table array sequence atom) (bool-vector array sequence atom) diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index b20415a2d3b..00c9e5438b8 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -513,7 +513,7 @@ HOW can be one of: (t (symbol-function symbol))) function props) ;; FIXME: We could use a defmethod on `function-documentation' instead, - ;; except when (or (not nf) (autoloadp nf))! + ;; except when (autoloadp nf)! (put symbol 'function-documentation `(advice--make-docstring ',symbol)) (add-function :around (get symbol 'defalias-fset-function) #'advice--defalias-fset))