From cb6dcbe91bbe98d2a949b343f0ec42bb44efcc15 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Tue, 8 Aug 2023 08:15:59 +0200 Subject: [PATCH] Fixing 'export' * lisp/emacs-lisp/pkg.el (export): Add inherited symbols to package. * lisp/emacs-lisp/pkg.el (pkg-defpackage): Fix a typo. * src/pkg.c (pkg_set_status): Use pkg_error instead of eassert. --- lisp/emacs-lisp/pkg.el | 6 ++++-- src/pkg.c | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/pkg.el b/lisp/emacs-lisp/pkg.el index d56a034eb65..5083a056585 100644 --- a/lisp/emacs-lisp/pkg.el +++ b/lisp/emacs-lisp/pkg.el @@ -487,7 +487,9 @@ Value is the renamed package object." ;; And now, three pages later, we export the suckers. (dolist (sym syms) - (package-%set-status sym package :external)) + (if (eq (symbol-package sym) package) + (package-%set-status sym package :external) + (puthash sym :external (package-%symbols package)))) t)) @@ -609,7 +611,7 @@ Value is t." (let ((other-package (pkg--package-or-lose (car imports-from)))) (dolist (sym-name (cdr imports-from)) (import (list (pkg--ensure-symbol sym-name other-package)) - gpackage)))) + package)))) ;; Exports. (let ((old-exports nil) diff --git a/src/pkg.c b/src/pkg.c index 7f78c61cf32..ceb339e28cf 100644 --- a/src/pkg.c +++ b/src/pkg.c @@ -479,12 +479,16 @@ pkg_set_status (Lisp_Object symbol, Lisp_Object package, Lisp_Object status) { CHECK_SYMBOL (symbol); CHECK_PACKAGE (package); + if (!EQ (status, QCinternal) && !EQ (status, QCexternal)) pkg_error ("Invalid symbol status %s", status); struct Lisp_Hash_Table *h = XHASH_TABLE (PACKAGE_SYMBOLS (package)); - ptrdiff_t i = hash_lookup (h, SYMBOL_NAME (symbol), NULL); - eassert (i >= 0); + const ptrdiff_t i = hash_lookup (h, SYMBOL_NAME (symbol), NULL); + if (i < 0) + pkg_error ("Symbol '%s' is not an internal symbol in package '%s'", + SDATA (SYMBOL_NAME (symbol)), + SDATA (PACKAGE_NAMEX (package))); ASET (h->key_and_value, 2 * i + 1, status); return Qnil; } -- 2.39.2