From 4c1bbd4fd7655eec840d37e61a9d48816f5f9aed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Sun, 16 Oct 2022 14:10:13 +0200 Subject: [PATCH] intern-soft with ':' trick * src/lread.c (Fintern): Move everything to pkg.c * src/pkg.c (pkg_emacs_intern): Handle ':' in symbol names. (pkg_emacs_intern_soft): Ditto. --- src/lread.c | 7 ------- src/pkg.c | 28 +++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/lread.c b/src/lread.c index 3dad2650f28..f322dc43e7b 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4785,13 +4785,6 @@ A second optional argument specifies the obarray to use; it defaults to the value of `obarray'. */) (Lisp_Object string, Lisp_Object package) { - if (SREF (string, 0) == ':' && NILP (package)) - { - /* PKG-FIXME: We are assuming that this is intended to be a - keyword like it was before. */ - string = Fsubstring (string, make_fixnum (1), Qnil); - package = Vkeyword_package; - } return pkg_emacs_intern (string, package); } diff --git a/src/pkg.c b/src/pkg.c index 9019b698291..53be9496bf6 100644 --- a/src/pkg.c +++ b/src/pkg.c @@ -642,12 +642,20 @@ pkg_emacs_intern (Lisp_Object name, Lisp_Object package) { CHECK_STRING (name); + /* PKG-FIXME: We are assuming that this is intended to be a keyword + like it was before. */ + if (SREF (name, 0) == ':' && NILP (package)) + { + name = Fsubstring (name, make_fixnum (1), Qnil); + package = Vkeyword_package; + } + eassert (SREF (name, 0) != ':'); - /* This is presumable an obarray, and we are intending - to intern into the default pacakge. */ + /* PKG-FIXME: This is presumable an obarray, and we are intending to + intern into the default pacakge. */ if (VECTORP (package)) - package = Vearmuffs_package; + package = Vemacs_package; package = package_or_default (package); return pkg_intern_symbol (name, package); @@ -656,11 +664,21 @@ pkg_emacs_intern (Lisp_Object name, Lisp_Object package) /* Implements Emacs' old Fintern_soft function. */ Lisp_Object -pkg_emacs_intern_soft (Lisp_Object symbol, Lisp_Object package) +pkg_emacs_intern_soft (Lisp_Object name, Lisp_Object package) { - const Lisp_Object name = SYMBOLP (symbol) ? SYMBOL_NAME (symbol) : symbol; + /* intern-soft allows symbols. */ + if (SYMBOLP (name)) + name = SYMBOL_NAME (name); CHECK_STRING (name); + /* PKG-FIXME: We are assuming that this is intended to be a keyword + like it was before. */ + if (SREF (name, 0) == ':' && NILP (package)) + { + name = Fsubstring (name, make_fixnum (1), Qnil); + package = Vkeyword_package; + } + package = package_or_default (package); Lisp_Object found = lookup_symbol (name, package); if (!EQ (found, Qunbound)) -- 2.39.2