all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Arthur Miller <arthur.miller@live.com>,
	 juri@linkov.net, emacs-devel@gnu.org
Subject: Re: Info-mode patch
Date: Tue, 04 Jul 2023 19:58:12 -0400	[thread overview]
Message-ID: <jwvjzvf3b2h.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83bkgsnctu.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 03 Jul 2023 20:07:25 +0300")

>> (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");




  reply	other threads:[~2023-07-04 23:58 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 16:09 Info-mode patch Arthur Miller
2023-06-26 17:56 ` Juri Linkov
2023-06-26 20:17   ` Arthur Miller
2023-06-27  6:32     ` Juri Linkov
2023-06-27  7:54       ` Arthur Miller
2023-06-27 18:11         ` Juri Linkov
2023-06-27 23:09           ` Arthur Miller
2023-06-28  6:50             ` Juri Linkov
2023-06-28 21:52               ` Arthur Miller
2023-06-29  6:44                 ` Juri Linkov
2023-06-29 12:42                   ` Arthur Miller
2023-06-29 15:00                     ` [External] : " Drew Adams
2023-06-29 16:24                       ` Arthur Miller
2023-06-29 17:44                     ` Juri Linkov
2023-06-29 22:28                       ` Arthur Miller
2023-06-30  7:13                         ` Juri Linkov
2023-06-30  8:41                           ` Arthur Miller
2023-06-30 17:57                             ` Juri Linkov
2023-07-01  9:11                               ` Arthur Miller
2023-07-02 17:53                                 ` Juri Linkov
2023-07-02 18:39                                   ` Eli Zaretskii
2023-07-02 22:43                                     ` Arthur Miller
2023-07-03 11:46                                       ` Eli Zaretskii
2023-07-03 12:57                                         ` Arthur Miller
2023-07-03 13:17                                           ` Eli Zaretskii
2023-07-03 18:40                                             ` Juri Linkov
2023-07-03 18:57                                               ` Eli Zaretskii
2023-07-04  6:50                                                 ` easy-menu-define keys for key-valid-p (was: Info-mode patch) Juri Linkov
2023-07-04 11:33                                                   ` Eli Zaretskii
2023-07-03 21:07                                               ` Info-mode patch Arthur Miller
2023-07-04  7:59                                                 ` Andreas Schwab
2023-07-04  8:44                                                   ` Arthur Miller
2023-07-03 17:07                                       ` Eli Zaretskii
2023-07-04 23:58                                         ` Stefan Monnier [this message]
2023-07-08  8:14                                           ` Eli Zaretskii
2023-07-02 22:05                                   ` Arthur Miller
2023-07-03 18:45                                     ` Juri Linkov
2023-07-03 22:24                                       ` Arthur Miller
2023-07-04  6:54                                         ` Juri Linkov
2023-07-04  9:43                                           ` Arthur Miller
2023-07-04 17:51                                             ` Juri Linkov
2023-07-04 21:40                                               ` Arthur Miller
2023-07-05  6:17                                                 ` Juri Linkov
2023-07-05 14:25                                                   ` Arthur Miller
2023-07-01  9:59                         ` Getting Gnus to highlight citations in long mails (was: Info-mode patch) Kévin Le Gouguec
2023-07-01 12:40                           ` Getting Gnus to highlight citations in long mails Arthur Miller
2023-07-02 17:56                           ` Juri Linkov
2023-06-27 11:45   ` Info-mode patch Eli Zaretskii
2023-06-27 12:15     ` Arthur Miller
2023-06-27 12:42       ` Eli Zaretskii
2023-06-27 15:28         ` Arthur Miller
2023-06-27 16:03           ` Eli Zaretskii
2023-06-27 16:33             ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvjzvf3b2h.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.