diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-05-18 18:55:34 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-05-18 19:15:37 +0200 |
| commit | 0b4f2eafa49bff012adfe0178a366a2780b653a8 (patch) | |
| tree | 29bbe6db40c5548ae1d019340fff4e82a066b353 | |
| parent | b12b2e5cbe0baf23785f9dad342e3bb936549728 (diff) | |
compat-30: Add obarray-clear
| -rw-r--r-- | NEWS.org | 1 | ||||
| -rw-r--r-- | compat-30.el | 6 | ||||
| -rw-r--r-- | compat-tests.el | 13 | ||||
| -rw-r--r-- | compat.texi | 5 |
4 files changed, 25 insertions, 0 deletions
@@ -4,6 +4,7 @@ * Development +- compat-30: New function =obarray-clear=. - compat-30: New function =interpreted-function-p=. - compat-30: New function =primitive-function-p=. - compat-30: New function =closurep=. diff --git a/compat-30.el b/compat-30.el index 570ba46..81b8fef 100644 --- a/compat-30.el +++ b/compat-30.el @@ -27,6 +27,12 @@ ;; TODO Update to 30.1 as soon as the Emacs emacs-30 branch version bumped (compat-version "30.0.50") +;;;; Defined in lread.c + +(compat-defun obarray-clear (ob) ;; <compat-tests:obarray> + "Remove all symbols from obarray OB." + (fillarray ob 0)) + ;;;; Defined in buffer.c (compat-defun find-buffer (variable value) ;; <compat-tests:find-buffer> diff --git a/compat-tests.el b/compat-tests.el index ece115c..ec6f95e 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1005,6 +1005,19 @@ (should-equal compat-tests--local 2) (should-not (boundp 'compat-tests--unexist))))) +(ert-deftest compat-obarray-clear () + ;; obarray APIs are only available since 26 + (static-if (> emacs-major-version 25) + (progn + (let ((ob (obarray-make))) + (should-not (obarray-get ob "sym1")) + (should (intern "sym1" ob)) + (should (obarray-get ob "sym1")) + (obarray-clear ob) + (should-not (obarray-get ob "sym1")) + (should (intern "sym2" ob)) + (should (obarray-get ob "sym2")))))) + (ert-deftest compat-gensym () (let ((orig gensym-counter)) (should (integerp gensym-counter)) diff --git a/compat.texi b/compat.texi index 381232c..8d6dd50 100644 --- a/compat.texi +++ b/compat.texi @@ -3330,6 +3330,11 @@ older than 30.1. Note that due to upstream changes, it might happen that there will be the need for changes, so use these functions with care. +@c copied from lispref/symbols.texi +@defun obarray-clear obarray +This function removes all symbols from @var{obarray}. +@end defun + @c copied from lispref/functions.texi @defun closurep object This function returns @code{t} if @var{object} is a closure, which is |
