WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit dc32703

Browse files
committed
Merge branch 'main' into emacs-31
2 parents 867ba4c + ad6a2b8 commit dc32703

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

NEWS.org

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#+link: compat-gh https://github.com/emacs-compat/compat/issues/
33
#+options: toc:nil num:nil author:nil
44

5-
* Development
5+
* Development (emacs-31 branch)
66

77
- compat-28: New pcase pattern =cl-type=.
88
- compat-31: New macros =static-when= and =static-unless=.
@@ -21,6 +21,10 @@
2121
- Drop support for Emacs 24.x. Emacs 25.1 is required now. In case
2222
Emacs 24.x support is still needed, Compat 30 can be used.
2323

24+
* Development
25+
26+
- compat-29: Add =string-glyph-compose= and =string-glyph-decompose=.
27+
2428
* Release of "Compat" Version 30.1.0.1
2529

2630
- compat-28: Fix =named-let= tail recursion.

compat-29.el

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,30 @@ The variable list SPEC is the same as in `if-let*'."
609609
,@body)
610610
(throw ',done nil))))))
611611

612+
;;;; Defined in ucs-normalize.el
613+
614+
(compat-defun string-glyph-compose (string) ;; <compat-tests:string-glyph-compose>
615+
"Compose STRING according to the Unicode NFC.
616+
This returns a new string obtained by canonical decomposition
617+
of STRING (see `ucs-normalize-NFC-string') followed by canonical
618+
composition, a.k.a. the \"Unicode Normalization Form C\" of STRING.
619+
For instance:
620+
621+
(string-glyph-compose \"\") => \"Å\""
622+
(unless (fboundp 'ucs-normalize-NFC-string)
623+
(require 'ucs-normalize))
624+
(ucs-normalize-NFC-string string))
625+
626+
(compat-defun string-glyph-decompose (string) ;; <compat-tests:string-glyph-decompose>
627+
"Decompose STRING according to the Unicode NFD.
628+
This returns a new string that is the canonical decomposition of STRING,
629+
a.k.a. the \"Unicode Normalization Form D\" of STRING. For instance:
630+
631+
(ucs-normalize-NFD-string \"\") => \"\""
632+
(unless (fboundp 'ucs-normalize-NFD-string)
633+
(require 'ucs-normalize))
634+
(ucs-normalize-NFD-string string))
635+
612636
;;;; Defined in files.el
613637

614638
(compat-defun directory-abbrev-make-regexp (directory) ;; <compat-tests:directory-abbrev-make-regexp>

compat-tests.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,12 @@
19051905
(should-equal '("a" "b" "c") (split-string "a b c"))
19061906
(should-equal '("a" "b" "c") (string-split "a b c")))
19071907

1908+
(ert-deftest compat-string-glyph-decompose ()
1909+
(should-equal 10 (length (string-to-list (string-glyph-decompose "àèìòù")))))
1910+
1911+
(ert-deftest compat-string-glyph-compose ()
1912+
(should-equal "àèìòù" (string-glyph-compose (string-glyph-decompose "àèìòù"))))
1913+
19081914
(ert-deftest compat-string-equal-ignore-case ()
19091915
(should (string-equal-ignore-case "abc" "abc"))
19101916
(should (string-equal-ignore-case "abc" "ABC"))

compat.texi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,6 +2415,21 @@ you can say:
24152415
@xref{Size of Displayed Text,,,elisp}.
24162416
@end defun
24172417

2418+
@c copied from lisp/international/ucs-normalize.el
2419+
@defun string-glyph-compose string
2420+
Compose @var{string} according to the Unicode NFC. This returns a new
2421+
string obtained by canonical decomposition of @var{string} followed by
2422+
canonical composition, a.k.a. the "Unicode Normalization Form C" of
2423+
@var{string}.
2424+
@end defun
2425+
2426+
@c copied from lisp/international/ucs-normalize.el
2427+
@defun string-glyph-decompose string
2428+
Decompose @var{string} according to the Unicode NFD. This returns a
2429+
new string that is the canonical decomposition of @var{string},
2430+
a.k.a. the "Unicode Normalization Form D" of @var{string}.
2431+
@end defun
2432+
24182433
@c based on lisp/emacs-lisp/subr-x.el
24192434
@defmac with-buffer-unmodified-if-unchanged &rest body@dots{}
24202435
Evaluate @var{body} like @code{progn}, but change buffer-modified

0 commit comments

Comments
 (0)