[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Info-mode patch
From: |
Stefan Monnier |
Subject: |
Re: Info-mode patch |
Date: |
Tue, 04 Jul 2023 19:58:12 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> (keymap
>> #^[nil nil keymap
>> #^^[3 0 nil nil nil nil nil nil nil nil nil Info-next-reference nil nil
>> nil Info-follow-nearest-node nil nil nil nil nil nil nil nil nil nil nil nil
>> nil
>>
>> I have removed rest of printed code for the brewity for the mail, but if you
>> eval above and place the cursor somewhere after the "keymap", or before the
>> char
>> table, and then try to read the subtype with:
>>
>> (char-table-subtype (read (current-buffer)))
Hmm... I now see that `read` does work on a sub-char-table and returns
that sub-char-table, so contrary to what I thought, they are exposed to
ELisp, and also contrary to what `lisp.h` suggests:
/* A char-table is a kind of vectorlike, with contents like a vector,
but with a few additional slots. [...]
[...] A sub-char-table appears only in an element of a
char-table, and there's no way to access it directly from a Lisp
program. */
I wonder what ELisp can do with it (other than abort/crash, that is :-)
> AFAICT, this happens because the debugger now uses cl-print to display
> objects in the backtrace, and cl-print calls type-of, which aborts if
> presented with a sub-char-table:
>
> /* "Impossible" cases. */
> case PVEC_MISC_PTR:
> case PVEC_OTHER:
> case PVEC_SUB_CHAR_TABLE:
> case PVEC_FREE: ;
> }
> emacs_abort ();
The easy fix is to make `type-of` return `sub-char-table`, of course, as
in the patch below. But if we go that way, then we should at least
update the comment in `lisp.h`.
Another option is to change `read` so it refuses to return
a sub-char-table.
Stefan
diff --git a/src/data.c b/src/data.c
index 9d7e7effdcd..6de8e0cf1a1 100644
--- a/src/data.c
+++ b/src/data.c
@@ -269,10 +269,11 @@ DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0,
return Qtreesit_compiled_query;
case PVEC_SQLITE:
return Qsqlite;
+ case PVEC_SUB_CHAR_TABLE:
+ return Qsub_char_table;
/* "Impossible" cases. */
case PVEC_MISC_PTR:
case PVEC_OTHER:
- case PVEC_SUB_CHAR_TABLE:
case PVEC_FREE: ;
}
emacs_abort ();
@@ -4215,6 +4216,7 @@ #define PUT_ERROR(sym, tail, msg) \
DEFSYM (Qvector, "vector");
DEFSYM (Qrecord, "record");
DEFSYM (Qchar_table, "char-table");
+ DEFSYM (Qsub_char_table, "sub-char-table");
DEFSYM (Qbool_vector, "bool-vector");
DEFSYM (Qhash_table, "hash-table");
DEFSYM (Qthread, "thread");
- Re: Info-mode patch, (continued)
- Re: Info-mode patch, Arthur Miller, 2023/07/03
- Re: Info-mode patch, Eli Zaretskii, 2023/07/03
- Re: Info-mode patch, Juri Linkov, 2023/07/03
- Re: Info-mode patch, Eli Zaretskii, 2023/07/03
- easy-menu-define keys for key-valid-p (was: Info-mode patch), Juri Linkov, 2023/07/04
- Re: easy-menu-define keys for key-valid-p (was: Info-mode patch), Eli Zaretskii, 2023/07/04
- Re: Info-mode patch, Arthur Miller, 2023/07/03
- Re: Info-mode patch, Andreas Schwab, 2023/07/04
- Re: Info-mode patch, Arthur Miller, 2023/07/04
- Re: Info-mode patch, Eli Zaretskii, 2023/07/03
- Re: Info-mode patch,
Stefan Monnier <=
- Re: Info-mode patch, Eli Zaretskii, 2023/07/08
Re: Info-mode patch, Arthur Miller, 2023/07/02
- Re: Info-mode patch, Juri Linkov, 2023/07/03
- Re: Info-mode patch, Arthur Miller, 2023/07/03
- Re: Info-mode patch, Juri Linkov, 2023/07/04
- Re: Info-mode patch, Arthur Miller, 2023/07/04
- Re: Info-mode patch, Juri Linkov, 2023/07/04
- Re: Info-mode patch, Arthur Miller, 2023/07/04
- Re: Info-mode patch, Juri Linkov, 2023/07/05
- Re: Info-mode patch, Arthur Miller, 2023/07/05