emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 437862c 1/2: * lisp/character-fold.el: Fix lax whit


From: Artur Malabarba
Subject: [Emacs-diffs] master 437862c 1/2: * lisp/character-fold.el: Fix lax whitespace
Date: Wed, 05 Aug 2015 18:16:45 +0000

branch: master
commit 437862c5c9bf381669979b4ebbb13859c5d5d9a5
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/character-fold.el: Fix lax whitespace
    
    (character-fold-table): Don't make space match other whitespace chars.
    (character-fold-to-regexp): Simplify lax behaviour.
---
 lisp/character-fold.el |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/character-fold.el b/lisp/character-fold.el
index bf5ae59..6bbb3ec 100644
--- a/lisp/character-fold.el
+++ b/lisp/character-fold.el
@@ -94,8 +94,7 @@ some).")
       ;; Add some manual entries.
       (dolist (it '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" 
"„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»")
                     (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
-                    (?` "❛" "‘" "‛" "󠀢" "❮" "‹")
-                    (?\s "\t" "\r" "\n")))
+                    (?` "❛" "‘" "‛" "󠀢" "❮" "‹")))
         (let ((idx (car it))
               (chars (cdr it)))
           (aset equiv idx (append chars (aref equiv idx)))))
@@ -121,12 +120,11 @@ If LAX is non-nil, any single whitespace character is 
allowed to
 match any number of times."
   (if character-fold-search
       (apply #'concat
-        (mapcar (lambda (c) (let ((out (or (aref character-fold-table c)
-                                      (regexp-quote (string c)))))
-                         (if (and lax (memq c '(?\s ?\t ?\r ?\n )))
-                             (concat out "+")
-                           out)))
-                string))
+             (mapcar (lambda (c) (if (and lax (memq c '(?\s ?\t ?\r ?\n)))
+                                "[ 
\t\n\r\xa0\x2002\x2d\x200a\x202f\x205f\x3000]+"
+                              (or (aref character-fold-table c)
+                                  (regexp-quote (string c)))))
+                     string))
     (regexp-quote string)))
 
 ;;; character-fold.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]