emacs-diffs
[Top][All Lists]
Advanced

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

master acc985ae7c: CL types: Accept both `byte-code-function` and `compi


From: Stefan Monnier
Subject: master acc985ae7c: CL types: Accept both `byte-code-function` and `compiled-function`
Date: Fri, 29 Apr 2022 15:29:42 -0400 (EDT)

branch: master
commit acc985ae7cab66ceb4e81ab403e39e933e851d9e
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    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.
---
 lisp/emacs-lisp/cl-macs.el      |  3 +++
 lisp/emacs-lisp/cl-preloaded.el | 12 +++++++++++-
 lisp/emacs-lisp/nadvice.el      |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index c2f8c4d009..a9d422929f 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 93713f506d..ab7c56c4e0 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 b20415a2d3..00c9e5438b 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]