From: Gerd Möllmann Date: Sat, 22 Oct 2022 13:21:40 +0000 (+0200) Subject: Fixes in package functions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=06fa6b1e39e9109d08127e6dbb7d535a938a4d95;p=emacs.git Fixes in package functions * lisp/emacs-lisp/pkg.el (pkg-stringify-names): De-duplicate names. (delete-package): Unregister package. --- diff --git a/lisp/emacs-lisp/pkg.el b/lisp/emacs-lisp/pkg.el index c9759b51e7c..8a2afb2966a 100644 --- a/lisp/emacs-lisp/pkg.el +++ b/lisp/emacs-lisp/pkg.el @@ -72,7 +72,9 @@ but have common elements %s" key1 key2 common)))) (t (error "Bogus %s name: %s" kind name)))) (defun pkg-stringify-names (names kind) - (mapcar (lambda (name) (pkg-stringify-name name kind)) names)) + (cl-remove-duplicates + (mapcar (lambda (name) (pkg-stringify-name name kind)) names) + :test #'equal)) (defun pkg-package-namify (n) (pkg-stringify-name n "package")) @@ -152,7 +154,8 @@ but have common elements %s" key1 key2 common)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;###autoload -(cl-defun make-package (name &key nicknames use (size 10)) + +(cl-defun make-package (name &key nicknames use (size 0)) "tbd" (cl-check-type size natnum) (let* ((name (pkg-stringify-name name "package name")) @@ -206,15 +209,15 @@ but have common elements %s" key1 key2 common)))) ;;;###autoload (defun delete-package (package) (if (and (packagep package) - (null (package-name package))) + (null (package-%name package))) nil (let ((package (pkg-package-or-lose package))) - (when (or (eq package *emacs-package*) - (eq package *keyword-package*)) - (error "Cannot delete standard package")) - (pkg--remove-from-registry package) - (setf (package-%name package) nil) - t))) + (when (or (eq package *emacs-package*) + (eq package *keyword-package*)) + (error "Cannot delete standard package")) + (pkg--remove-from-registry package) + (setf (package-%name package) nil) + t))) ;;;###autoload (defun rename-package (package new-name &optional new-nicknames)