From: Gerd Möllmann Date: Tue, 25 Oct 2022 06:44:58 +0000 (+0200) Subject: Print symbols habing a deleted home package X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=27c86f5e2a28618ba6346c769cff8d90357ecfd4;p=emacs.git Print symbols habing a deleted home package This can't happen in normal circumstances, but it might while working on the package implementation itself. * src/print.c (print_symbol): Handle symbol-packages that are deleted, that is have a nil home package. * src/lisp.h (PACKAGE_USE_LIST): New macro. --- diff --git a/src/lisp.h b/src/lisp.h index f60583a1507..679c0d53bdc 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2268,6 +2268,12 @@ PACKAGE_NAMEX (Lisp_Object package) return XPACKAGE (package)->name; } +INLINE Lisp_Object +PACKAGE_USE_LIST (Lisp_Object package) +{ + return XPACKAGE (package)->use_list; +} + extern void init_pkg_once (void); extern void init_pkg (void); extern void syms_of_pkg (void); diff --git a/src/print.c b/src/print.c index 0bae167c00e..132b1e1101f 100644 --- a/src/print.c +++ b/src/print.c @@ -2230,14 +2230,20 @@ print_symbol (Lisp_Object symbol, Lisp_Object printcharfun, print_c_string (":", printcharfun); check_number_p = false; } - else if (EQ (package, Vearmuffs_package)) - ; else if (NILP (package)) { if (!NILP (Vprint_gensym)) print_c_string ("#:", printcharfun); } - else + else if (NILP (PACKAGE_NAMEX (package))) + { + /* This should not happen normally, because delete-package + should un-home symbols. But it can if we have a bug + in pkg.el which a test catches. */ + print_c_string ("#:", printcharfun); + check_number_p = false; + } + else if (!EQ (package, Vearmuffs_package)) { /* If the symbol is accessible, it need not be qualified. */ Lisp_Object status;