[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 a5f2970 2/2: * lisp/character-fold.el: Allow comp
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] emacs-25 a5f2970 2/2: * lisp/character-fold.el: Allow complex chars to match their decomposition |
Date: |
Fri, 27 Nov 2015 12:02:57 +0000 |
branch: emacs-25
commit a5f2970207d792e5f5d40160485007f282a0569d
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* lisp/character-fold.el: Allow complex chars to match their decomposition
(character-fold-table): When a character's decomposition does not
involve a formatting tag (i.e., if it has an "exact" description via
other characters), then this character is allowed to match the
decomposition.
---
lisp/character-fold.el | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/character-fold.el b/lisp/character-fold.el
index 3d19d29..4b526c2 100644
--- a/lisp/character-fold.el
+++ b/lisp/character-fold.el
@@ -38,9 +38,15 @@
(map-char-table
(lambda (char decomp)
(when (consp decomp)
- ;; Discard a possible formatting tag.
- (when (symbolp (car decomp))
- (setq decomp (cdr decomp)))
+ (if (symbolp (car decomp))
+ ;; Discard a possible formatting tag.
+ (setq decomp (cdr decomp))
+ ;; If there's no formatting tag, ensure that char matches
+ ;; its decomp exactly. This is because we want 'ä' to
+ ;; match 'ä', but we don't want '¹' to match '1'.
+ (aset equiv char
+ (cons (apply #'string decomp)
+ (aref equiv char))))
;; Finally, figure out whether char has a simpler
;; equivalent (char-aux). If so, ensure that char-aux
;; matches char and maybe its decomp too.