]> git.eshelyaron.com Git - emacs.git/commitdiff
Followup changes to `cl-type-of`
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 14 Mar 2024 16:49:08 +0000 (12:49 -0400)
committerEshel Yaron <me@eshelyaron.com>
Mon, 18 Mar 2024 15:46:13 +0000 (16:46 +0100)
These changes came up while working on `cl-type-of` but are not
directly related to the new `cl-type-of`.
The BASE_PURESIZE bump was needed at some point on one of my
machine, not sure why.

* src/puresize.h (BASE_PURESIZE): Bump up.
* src/sqlite.c (bind_value): Don't use `Ftype_of`.
* lisp/emacs-lisp/seq.el (seq-remove-at-position): Simplify.
* lisp/emacs-lisp/cl-preloaded.el (finalizer):
New (previously missing) type.
* doc/lispref/objects.texi (Type Predicates): Minor tweaks.

(cherry picked from commit 63e67916b01569da5bb24f6d9a354dc72897c468)

doc/lispref/objects.texi
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/seq.el
src/lisp.h
src/puresize.h
src/sqlite.c

index 1e448b64296fd6a2f0114620ff4f1b2931e659bb..aa1e073042fb2699e8269f102db3c554ce706122 100644 (file)
@@ -1485,8 +1485,8 @@ types that are not built into Emacs.
 @subsection Type Descriptors
 
   A @dfn{type descriptor} is a @code{record} which holds information
-about a type.  Slot 1 in the record must be a symbol naming the type, and
-@code{type-of} relies on this to return the type of @code{record}
+about a type.  The first slot in the record must be a symbol naming the type,
+and @code{type-of} relies on this to return the type of @code{record}
 objects.  No other type descriptor slot is used by Emacs; they are
 free for use by Lisp extensions.
 
@@ -2175,7 +2175,7 @@ with references to further information.
 function @code{type-of}.  Recall that each object belongs to one and
 only one primitive type; @code{type-of} tells you which one (@pxref{Lisp
 Data Types}).  But @code{type-of} knows nothing about non-primitive
-types.  In most cases, it is more convenient to use type predicates than
+types.  In most cases, it is preferable to use type predicates than
 @code{type-of}.
 
 @defun type-of object
index d11c97a3e3adb1b2f5903bd0db5ff5389e61a08c..cba56e0bbd4235045fcbe6753561451051237eac 100644 (file)
 (cl--define-built-in-type buffer atom)
 (cl--define-built-in-type window atom)
 (cl--define-built-in-type process atom)
+(cl--define-built-in-type finalizer atom)
 (cl--define-built-in-type window-configuration atom)
 (cl--define-built-in-type overlay atom)
 (cl--define-built-in-type number-or-marker atom
index 20077db9e60e75f1115dbef1bbc437b237354682..a20cff169824a6540a1213521d1f0c661ed13b72 100644 (file)
@@ -362,8 +362,7 @@ the result.
 
 The result is a sequence of the same type as SEQUENCE."
   (seq-concatenate
-   (let ((type (type-of sequence)))
-     (if (eq type 'cons) 'list type))
+   (if (listp sequence) 'list (type-of sequence))
    (seq-subseq sequence 0 n)
    (seq-subseq sequence (1+ n))))
 
index f353e4956ebc5d6d137f98a7e1262cc1ed6dde11..f86758c88fbaa568fda9c3da9a4d20c29a2a2f82 100644 (file)
@@ -569,10 +569,8 @@ enum Lisp_Fwd_Type
    your object -- this way, the same object could be used to represent
    several disparate C structures.
 
-   In addition, you need to add switch branches in data.c for Ftype_of.
-
-   You also need to add the new type to the constant
-   `cl--typeof-types' in lisp/emacs-lisp/cl-preloaded.el.  */
+   In addition, you need to add switch branches in data.c for Fcl_type_of
+   and `cl--define-builtin-type` in lisp/emacs-lisp/cl-preloaded.el.  */
 
 
 /* A Lisp_Object is a tagged pointer or integer.  Ordinarily it is a
index ac5d2da30dc824e51eb94504a2bf2e02dcaf156e..2a7168728329b3a5eec7d49050bad6f70facb208 100644 (file)
@@ -47,7 +47,7 @@ INLINE_HEADER_BEGIN
 #endif
 
 #ifndef BASE_PURESIZE
-#define BASE_PURESIZE (2750000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
+#define BASE_PURESIZE (3000000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
 #endif
 
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */
index 7a018b28aa4aa5ce27473916ee20f206462fe67d..261080da673bea1f3f9b0362c927c043a6415a8c 100644 (file)
@@ -349,9 +349,7 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values)
          value = XCAR (values);
          values = XCDR (values);
        }
-      Lisp_Object type = Ftype_of (value);
-
-      if (EQ (type, Qstring))
+      if (STRINGP (value))
        {
          Lisp_Object encoded;
          bool blob = false;
@@ -385,14 +383,11 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values)
                                       SSDATA (encoded), SBYTES (encoded),
                                       NULL);
        }
-      else if (EQ (type, Qinteger))
-       {
-         if (BIGNUMP (value))
-           ret = sqlite3_bind_int64 (stmt, i + 1, bignum_to_intmax (value));
-         else
-           ret = sqlite3_bind_int64 (stmt, i + 1, XFIXNUM (value));
-       }
-      else if (EQ (type, Qfloat))
+      else if (FIXNUMP (value))
+       ret = sqlite3_bind_int64 (stmt, i + 1, XFIXNUM (value));
+      else if (BIGNUMP (value))
+       ret = sqlite3_bind_int64 (stmt, i + 1, bignum_to_intmax (value));
+      else if (FLOATP (value))
        ret = sqlite3_bind_double (stmt, i + 1, XFLOAT_DATA (value));
       else if (NILP (value))
        ret = sqlite3_bind_null (stmt, i + 1);