From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Info-mode patch Date: Tue, 04 Jul 2023 19:58:12 -0400 Message-ID: References: <86fs6ertto.fsf@mail.linkov.net> <86wmzpqva6.fsf@mail.linkov.net> <867cropyh3.fsf@mail.linkov.net> <86mt0kulli.fsf@mail.linkov.net> <86wmzmzs1s.fsf@mail.linkov.net> <86edluyxhl.fsf@mail.linkov.net> <86bkgxfm34.fsf@mail.linkov.net> <86zg4gddtf.fsf@mail.linkov.net> <86v8f2xkr4.fsf@mail.linkov.net> <835y72noo4.fsf@gnu.org> <83bkgsnctu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26598"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Arthur Miller , juri@linkov.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 05 01:59:15 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qGpvO-0006hH-Fr for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jul 2023 01:59:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGpuW-00067V-VJ; Tue, 04 Jul 2023 19:58:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGpuV-00067K-92 for emacs-devel@gnu.org; Tue, 04 Jul 2023 19:58:19 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGpuT-0008EQ-4G; Tue, 04 Jul 2023 19:58:18 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D8E2F1000D6; Tue, 4 Jul 2023 19:58:14 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7BB9410007B; Tue, 4 Jul 2023 19:58:13 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1688515093; bh=taUstB4mIKaO2GYzXoSR3Bwj4F2YTnysnuzEterHyYs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pFuRjMQ+KeqrxD3L/J5cRHYM72i5SD5KasfrSAybXdgm5npnP1XsFN4mfegYu54Nl B0OEXJEzbT5YNf2URaclzy6VHZ4DEcXuQYbohHiz+3wKCVsiqNEoZ9oG5I02gMXXLC 1TO57dCME/Ho8+gCJ3xdTQBQ7M4lqepMuTasHA+lEs5J94HEwnnUrHIYQH6Xw8V6/X 0KpR2wKTNX6cO2sgiDY6NBpQbwL4uLsGODQYwzvBU19AH4aG+sKnrwWMGYubvTb1GK 7hrTGe7TYcF7EqtvlblHHtZUnXk7H59NublX+XDfVimTFv/DIfW3TcMAhLaIwG+Ms5 1lp2iKn28sLqQ== Original-Received: from pastel (69-165-155-162.dsl.teksavvy.com [69.165.155.162]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4DD211204C0; Tue, 4 Jul 2023 19:58:13 -0400 (EDT) In-Reply-To: <83bkgsnctu.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 03 Jul 2023 20:07:25 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307444 Archived-At: >> (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");