diff options
| author | Stefan Monnier | 2024-03-14 12:49:08 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2024-03-18 09:32:53 -0400 |
| commit | 63e67916b01569da5bb24f6d9a354dc72897c468 (patch) | |
| tree | bb192d43d3e87a0945f0f05967da310aae29030a | |
| parent | e624bc62752ceb2e60940c5fd9cb6e70611df71c (diff) | |
| download | emacs-63e67916b01569da5bb24f6d9a354dc72897c468.tar.gz emacs-63e67916b01569da5bb24f6d9a354dc72897c468.zip | |
Followup changes to `cl-type-of`scratch/object-type
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.
| -rw-r--r-- | doc/lispref/objects.texi | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-preloaded.el | 1 | ||||
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 3 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/puresize.h | 2 | ||||
| -rw-r--r-- | src/sqlite.c | 17 |
6 files changed, 14 insertions, 21 deletions
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 1e448b64296..aa1e073042f 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -1485,8 +1485,8 @@ types that are not built into Emacs. | |||
| 1485 | @subsection Type Descriptors | 1485 | @subsection Type Descriptors |
| 1486 | 1486 | ||
| 1487 | A @dfn{type descriptor} is a @code{record} which holds information | 1487 | A @dfn{type descriptor} is a @code{record} which holds information |
| 1488 | about a type. Slot 1 in the record must be a symbol naming the type, and | 1488 | about a type. The first slot in the record must be a symbol naming the type, |
| 1489 | @code{type-of} relies on this to return the type of @code{record} | 1489 | and @code{type-of} relies on this to return the type of @code{record} |
| 1490 | objects. No other type descriptor slot is used by Emacs; they are | 1490 | objects. No other type descriptor slot is used by Emacs; they are |
| 1491 | free for use by Lisp extensions. | 1491 | free for use by Lisp extensions. |
| 1492 | 1492 | ||
| @@ -2175,7 +2175,7 @@ with references to further information. | |||
| 2175 | function @code{type-of}. Recall that each object belongs to one and | 2175 | function @code{type-of}. Recall that each object belongs to one and |
| 2176 | only one primitive type; @code{type-of} tells you which one (@pxref{Lisp | 2176 | only one primitive type; @code{type-of} tells you which one (@pxref{Lisp |
| 2177 | Data Types}). But @code{type-of} knows nothing about non-primitive | 2177 | Data Types}). But @code{type-of} knows nothing about non-primitive |
| 2178 | types. In most cases, it is more convenient to use type predicates than | 2178 | types. In most cases, it is preferable to use type predicates than |
| 2179 | @code{type-of}. | 2179 | @code{type-of}. |
| 2180 | 2180 | ||
| 2181 | @defun type-of object | 2181 | @defun type-of object |
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index d11c97a3e3a..cba56e0bbd4 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el | |||
| @@ -365,6 +365,7 @@ | |||
| 365 | (cl--define-built-in-type buffer atom) | 365 | (cl--define-built-in-type buffer atom) |
| 366 | (cl--define-built-in-type window atom) | 366 | (cl--define-built-in-type window atom) |
| 367 | (cl--define-built-in-type process atom) | 367 | (cl--define-built-in-type process atom) |
| 368 | (cl--define-built-in-type finalizer atom) | ||
| 368 | (cl--define-built-in-type window-configuration atom) | 369 | (cl--define-built-in-type window-configuration atom) |
| 369 | (cl--define-built-in-type overlay atom) | 370 | (cl--define-built-in-type overlay atom) |
| 370 | (cl--define-built-in-type number-or-marker atom | 371 | (cl--define-built-in-type number-or-marker atom |
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 20077db9e60..a20cff16982 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -362,8 +362,7 @@ the result. | |||
| 362 | 362 | ||
| 363 | The result is a sequence of the same type as SEQUENCE." | 363 | The result is a sequence of the same type as SEQUENCE." |
| 364 | (seq-concatenate | 364 | (seq-concatenate |
| 365 | (let ((type (type-of sequence))) | 365 | (if (listp sequence) 'list (type-of sequence)) |
| 366 | (if (eq type 'cons) 'list type)) | ||
| 367 | (seq-subseq sequence 0 n) | 366 | (seq-subseq sequence 0 n) |
| 368 | (seq-subseq sequence (1+ n)))) | 367 | (seq-subseq sequence (1+ n)))) |
| 369 | 368 | ||
diff --git a/src/lisp.h b/src/lisp.h index f353e4956eb..f86758c88fb 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -569,10 +569,8 @@ enum Lisp_Fwd_Type | |||
| 569 | your object -- this way, the same object could be used to represent | 569 | your object -- this way, the same object could be used to represent |
| 570 | several disparate C structures. | 570 | several disparate C structures. |
| 571 | 571 | ||
| 572 | In addition, you need to add switch branches in data.c for Ftype_of. | 572 | In addition, you need to add switch branches in data.c for Fcl_type_of |
| 573 | 573 | and `cl--define-builtin-type` in lisp/emacs-lisp/cl-preloaded.el. */ | |
| 574 | You also need to add the new type to the constant | ||
| 575 | `cl--typeof-types' in lisp/emacs-lisp/cl-preloaded.el. */ | ||
| 576 | 574 | ||
| 577 | 575 | ||
| 578 | /* A Lisp_Object is a tagged pointer or integer. Ordinarily it is a | 576 | /* A Lisp_Object is a tagged pointer or integer. Ordinarily it is a |
diff --git a/src/puresize.h b/src/puresize.h index ac5d2da30dc..2a716872832 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -47,7 +47,7 @@ INLINE_HEADER_BEGIN | |||
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #ifndef BASE_PURESIZE | 49 | #ifndef BASE_PURESIZE |
| 50 | #define BASE_PURESIZE (2750000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) | 50 | #define BASE_PURESIZE (3000000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| 53 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ | 53 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ |
diff --git a/src/sqlite.c b/src/sqlite.c index 7a018b28aa4..261080da673 100644 --- a/src/sqlite.c +++ b/src/sqlite.c | |||
| @@ -349,9 +349,7 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) | |||
| 349 | value = XCAR (values); | 349 | value = XCAR (values); |
| 350 | values = XCDR (values); | 350 | values = XCDR (values); |
| 351 | } | 351 | } |
| 352 | Lisp_Object type = Ftype_of (value); | 352 | if (STRINGP (value)) |
| 353 | |||
| 354 | if (EQ (type, Qstring)) | ||
| 355 | { | 353 | { |
| 356 | Lisp_Object encoded; | 354 | Lisp_Object encoded; |
| 357 | bool blob = false; | 355 | bool blob = false; |
| @@ -385,14 +383,11 @@ bind_values (sqlite3 *db, sqlite3_stmt *stmt, Lisp_Object values) | |||
| 385 | SSDATA (encoded), SBYTES (encoded), | 383 | SSDATA (encoded), SBYTES (encoded), |
| 386 | NULL); | 384 | NULL); |
| 387 | } | 385 | } |
| 388 | else if (EQ (type, Qinteger)) | 386 | else if (FIXNUMP (value)) |
| 389 | { | 387 | ret = sqlite3_bind_int64 (stmt, i + 1, XFIXNUM (value)); |
| 390 | if (BIGNUMP (value)) | 388 | else if (BIGNUMP (value)) |
| 391 | ret = sqlite3_bind_int64 (stmt, i + 1, bignum_to_intmax (value)); | 389 | ret = sqlite3_bind_int64 (stmt, i + 1, bignum_to_intmax (value)); |
| 392 | else | 390 | else if (FLOATP (value)) |
| 393 | ret = sqlite3_bind_int64 (stmt, i + 1, XFIXNUM (value)); | ||
| 394 | } | ||
| 395 | else if (EQ (type, Qfloat)) | ||
| 396 | ret = sqlite3_bind_double (stmt, i + 1, XFLOAT_DATA (value)); | 391 | ret = sqlite3_bind_double (stmt, i + 1, XFLOAT_DATA (value)); |
| 397 | else if (NILP (value)) | 392 | else if (NILP (value)) |
| 398 | ret = sqlite3_bind_null (stmt, i + 1); | 393 | ret = sqlite3_bind_null (stmt, i + 1); |