From 6b0304f2dd84f9904885f31b1d73f4b9f905a522 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Thu, 20 Oct 2022 10:21:55 +0200 Subject: [PATCH] Print package prefixes right --- src/print.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/print.c b/src/print.c index efef070497a..fed549099a2 100644 --- a/src/print.c +++ b/src/print.c @@ -2216,34 +2216,35 @@ print_symbol (Lisp_Object symbol, Lisp_Object printcharfun, bool escape) { const Lisp_Object name = SYMBOL_NAME (symbol); - const char *p = SSDATA (name); const Lisp_Object package = SYMBOL_PACKAGE (symbol); - /* print-gensym true means print #: for uninterned symbols. - PKG_FIXME: This looks like #: for an uninterned symbol with empty - name? */ - if (NILP (package)) + if (EQ (package, Vkeyword_package)) + print_c_string (":", printcharfun); + else if (EQ (package, Vearmuffs_package)) + ; + else if (NILP (package)) { if (!NILP (Vprint_gensym)) print_c_string ("#:", printcharfun); - else if (*p == 0) + else if (*SDATA (name) == 0) { print_c_string ("##", printcharfun); return; } } - - if (EQ (package, Vkeyword_package)) - print_c_string (":", printcharfun); - else if (!NILP (package) && !EQ (package, Vearmuffs_package)) + else { - /* Don't print qualification if in current package. */ + /* If the symbol is accessible, it need not be qualified. */ const Lisp_Object found = Ffind_symbol (name, Vearmuffs_package); - if (NILP (found) || !EQ (XCAR (found), symbol)) + const bool accessible = !NILP (found); + if (!accessible || !EQ (XCAR (found), symbol)) { print_symbol_name (XPACKAGE (package)->name, printcharfun, escape); - if (SYMBOL_EXTERNAL_P (symbol)) + const Lisp_Object found = Ffind_symbol (name, package); + eassert (!NILP (found)); + const Lisp_Object status = XCAR (XCDR (found)); + if (EQ (status, QCexternal)) print_c_string (":", printcharfun); else print_c_string ("::", printcharfun); -- 2.39.2