[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pkg d6d92270be: Fixes for obarray-tests
From: |
Gerd Moellmann |
Subject: |
feature/pkg d6d92270be: Fixes for obarray-tests |
Date: |
Fri, 21 Oct 2022 10:16:10 -0400 (EDT) |
branch: feature/pkg
commit d6d92270be84b819556b2b47c301bf8cf8bb4701
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Fixes for obarray-tests
* src/pkg.c (pkg_emacs_unintern): Take args, and return a value
consistent with traditional unintern.
---
src/pkg.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/pkg.c b/src/pkg.c
index 8570990beb..47b647aed4 100644
--- a/src/pkg.c
+++ b/src/pkg.c
@@ -562,7 +562,7 @@ pkg_emacs_intern_soft (Lisp_Object name, Lisp_Object
package)
name = SYMBOL_NAME (name);
CHECK_STRING (name);
- /* PKG-FIXME: We are assuming that this is intended to be a keyword
+ /* PKG-FIXME? We are assuming that this is intended to be a keyword
like it was before. */
if (SREF (name, 0) == ':' && NILP (package))
{
@@ -591,10 +591,37 @@ pkg_emacs_intern_soft (Lisp_Object name, Lisp_Object
package)
Lisp_Object
pkg_emacs_unintern (Lisp_Object name, Lisp_Object package)
{
+ /* unintern allows symbols. */
+ Lisp_Object orig = name;
+ 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;
+ }
+
+ if (VECTORP (package))
+ package = pkg_fake_me_an_obarray (package);
+ package = pkg_package_or_default (package);
+
+ Lisp_Object found = pkg_find_symbol (name, package, NULL);
+ if (EQ (found, Qunbound))
+ return Qnil;
+
+ if (SYMBOLP (orig) && !EQ (found, orig))
+ return Qnil;
+
+ /* We should never find an uninterned symbol in a package. */
+ eassert (!NILP (SYMBOL_PACKAGE (found)));
if (VECTORP (package))
package = pkg_fake_me_an_obarray (package);
package = pkg_package_or_default (package);
- return pkg_unintern_symbol (name, package);
+ return pkg_unintern_symbol (found, package);
}
/* Implements Emacs mapatoms. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/pkg d6d92270be: Fixes for obarray-tests,
Gerd Moellmann <=