[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pkg 27c86f5e2a 1/3: Print symbols habing a deleted home package
From: |
Gerd Moellmann |
Subject: |
feature/pkg 27c86f5e2a 1/3: Print symbols habing a deleted home package |
Date: |
Tue, 25 Oct 2022 03:03:27 -0400 (EDT) |
branch: feature/pkg
commit 27c86f5e2a28618ba6346c769cff8d90357ecfd4
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
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.
---
src/lisp.h | 6 ++++++
src/print.c | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/lisp.h b/src/lisp.h
index f60583a150..679c0d53bd 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 0bae167c00..132b1e1101 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 ("#<deleted package>:", printcharfun);
+ check_number_p = false;
+ }
+ else if (!EQ (package, Vearmuffs_package))
{
/* If the symbol is accessible, it need not be qualified. */
Lisp_Object status;