diff options
| -rw-r--r-- | NEWS.org | 1 | ||||
| -rw-r--r-- | compat-29.el | 8 | ||||
| -rw-r--r-- | compat-tests.el | 6 | ||||
| -rw-r--r-- | compat.texi | 7 |
4 files changed, 21 insertions, 1 deletions
@@ -4,6 +4,7 @@ * Development +- compat-29: Add function =bidi-string-strip-control-characters=. - compat-29: Add function =char-uppercase-p=. - compat-29: Add function =window-configuration-equal-p=. diff --git a/compat-29.el b/compat-29.el index 3db94c9..28e9105 100644 --- a/compat-29.el +++ b/compat-29.el @@ -508,6 +508,14 @@ thus overriding the value of the TIMEOUT argument to that function.") (when message (message "%s" message)) exitfun)) +;;;; Defined in characters.el + +(compat-defun bidi-string-strip-control-characters (string) ;; <compat-tests:bidi-string-strip-control-characters> + "Strip bidi control characters from STRING and return the result." + (apply #'string (seq-filter (lambda (char) + (not (memq char bidi-control-characters))) + string))) + ;;;; Defined in simple.el (compat-defun char-uppercase-p (char) ;; <compat-tests:char-uppercase-p> diff --git a/compat-tests.el b/compat-tests.el index 02fa536..19c13ed 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1843,6 +1843,12 @@ (dolist (c (list ?a ?b ?α ?β)) (should-not (char-uppercase-p c)))) +(ert-deftest compat-bidi-string-strip-control-characters () + (should-equal (bidi-string-strip-control-characters (apply #'string bidi-control-characters)) "") + (should-equal (bidi-string-strip-control-characters "\x202e") "") + (should-equal (bidi-string-strip-control-characters "abc") "abc") + (should-equal (bidi-string-strip-control-characters "x\x202ey\x202ez") "xyz")) + (ert-deftest compat-string-split () (should-equal '("a" "b" "c") (split-string "a b c")) (should-equal '("a" "b" "c") (string-split "a b c"))) diff --git a/compat.texi b/compat.texi index 1c9e278..4ec60a9 100644 --- a/compat.texi +++ b/compat.texi @@ -2613,6 +2613,11 @@ The name follows the convention of other string functions. @xref{Creating Strings,,,elisp}. @end defun +@c based on lisp/international/characters.el +@defun bidi-string-strip-control-characters string +Strip bidi control characters from @var{string} and return the result. +@end defun + @c copied from lispref/buffers.texi @defun buffer-match-p condition buffer-or-name &optional arg This function checks if a buffer designated by @code{buffer-or-name} @@ -2914,7 +2919,7 @@ local map. @xref{Key Binding Commands,,,elisp}. @end defun -@c based on from lisp/keymap.el +@c based on lisp/keymap.el @defun keymap-substitute keymap olddef newdef &optional oldmap prefix Replace @var{olddef} with @var{newdef} for any keys in @var{keymap} now defined as @var{olddef}. In other words, @var{olddef} is replaced |
