diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-08-01 17:22:17 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-08-01 17:22:17 +0200 |
| commit | 3d0e0469197ee574b3c3d310bd7987a5ec60f087 (patch) | |
| tree | 1662d798569e94a1db7d431499b0853122ec262d | |
| parent | ba8091c57fbb822c6b7093d0a01d455fa60d49ff (diff) | |
compat-29: Add char-uppercase-p
| -rw-r--r-- | NEWS.org | 4 | ||||
| -rw-r--r-- | compat-29.el | 8 | ||||
| -rw-r--r-- | compat-tests.el | 6 | ||||
| -rw-r--r-- | compat.texi | 6 |
4 files changed, 24 insertions, 0 deletions
@@ -2,6 +2,10 @@ #+link: compat-gh https://github.com/emacs-compat/compat/issues/ #+options: toc:nil num:nil author:nil +* Development + +- compat-29: Add function =char-uppercase-p=. + * Release of "Compat" Version 29.1.4.2 - compat-28: Improve =make-separator-line= visuals on graphic displays. diff --git a/compat-29.el b/compat-29.el index 675d2c7..fc17e0f 100644 --- a/compat-29.el +++ b/compat-29.el @@ -506,6 +506,14 @@ thus overriding the value of the TIMEOUT argument to that function.") ;;;; Defined in simple.el +(compat-defun char-uppercase-p (char) ;; <compat-tests:char-uppercase-p> + "Return non-nil if CHAR is an upper-case character. +If the Unicode tables are not yet available, e.g. during bootstrap, +then gives correct answers only for ASCII characters." + (cond ((unicode-property-table-internal 'lowercase) + (characterp (get-char-code-property char 'lowercase))) + ((and (>= char ?A) (<= char ?Z))))) + (compat-defun use-region-noncontiguous-p () ;; <compat-tests:region-noncontiguous-p> "Return non-nil for a non-contiguous region if `use-region-p'." (and (use-region-p) (region-noncontiguous-p))) diff --git a/compat-tests.el b/compat-tests.el index 60e652b..834fe0c 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1828,6 +1828,12 @@ (should-equal (replace-regexp-in-region " bar" "" (point-min) 8) 1) (should-equal (buffer-string) "foo bar")))) +(ert-deftest compat-char-uppercase-p () + (dolist (c (list ?R ?S ?Ω ?Ψ)) + (should (char-uppercase-p c))) + (dolist (c (list ?a ?b ?α ?β)) + (should-not (char-uppercase-p c)))) + (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 0362091..fc1a54b 100644 --- a/compat.texi +++ b/compat.texi @@ -2445,6 +2445,12 @@ efficient). @end defun @c copied from lispref/display.texi +@defun char-uppercase-p char +Return non-@code{nil} if @var{char} is an uppercase character +according to Unicode. +@end defun + +@c copied from lispref/display.texi @defmac with-delayed-message (timeout message) body@dots{} Sometimes it's unclear whether an operation will take a long time to execute or not, or it can be inconvenient to implement a progress |
