From: Gerd Möllmann Date: Thu, 20 Oct 2022 08:21:55 +0000 (+0200) Subject: Print package prefixes right X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6b0304f2dd84f9904885f31b1d73f4b9f905a522;p=emacs.git Print package prefixes right --- 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);