diff options
| author | Artur Malabarba | 2015-08-05 18:51:34 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-08-05 19:15:44 +0100 |
| commit | 437862c5c9bf381669979b4ebbb13859c5d5d9a5 (patch) | |
| tree | 6754013017773037d8545d5a886aed75b67e40d9 | |
| parent | ee50e62a44d18be697917e1ea708db1c06f590fb (diff) | |
| download | emacs-437862c5c9bf381669979b4ebbb13859c5d5d9a5.tar.gz emacs-437862c5c9bf381669979b4ebbb13859c5d5d9a5.zip | |
* 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.
| -rw-r--r-- | 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 bf5ae59f41a..6bbb3ec87e4 100644 --- a/lisp/character-fold.el +++ b/lisp/character-fold.el | |||
| @@ -94,8 +94,7 @@ some).") | |||
| 94 | ;; Add some manual entries. | 94 | ;; Add some manual entries. |
| 95 | (dolist (it '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»") | 95 | (dolist (it '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»") |
| 96 | (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "" "❮" "❯" "‹" "›") | 96 | (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "" "❮" "❯" "‹" "›") |
| 97 | (?` "❛" "‘" "‛" "" "❮" "‹") | 97 | (?` "❛" "‘" "‛" "" "❮" "‹"))) |
| 98 | (?\s "\t" "\r" "\n"))) | ||
| 99 | (let ((idx (car it)) | 98 | (let ((idx (car it)) |
| 100 | (chars (cdr it))) | 99 | (chars (cdr it))) |
| 101 | (aset equiv idx (append chars (aref equiv idx))))) | 100 | (aset equiv idx (append chars (aref equiv idx))))) |
| @@ -121,12 +120,11 @@ If LAX is non-nil, any single whitespace character is allowed to | |||
| 121 | match any number of times." | 120 | match any number of times." |
| 122 | (if character-fold-search | 121 | (if character-fold-search |
| 123 | (apply #'concat | 122 | (apply #'concat |
| 124 | (mapcar (lambda (c) (let ((out (or (aref character-fold-table c) | 123 | (mapcar (lambda (c) (if (and lax (memq c '(?\s ?\t ?\r ?\n))) |
| 125 | (regexp-quote (string c))))) | 124 | "[ \t\n\r\xa0\x2002\x2d\x200a\x202f\x205f\x3000]+" |
| 126 | (if (and lax (memq c '(?\s ?\t ?\r ?\n ))) | 125 | (or (aref character-fold-table c) |
| 127 | (concat out "+") | 126 | (regexp-quote (string c))))) |
| 128 | out))) | 127 | string)) |
| 129 | string)) | ||
| 130 | (regexp-quote string))) | 128 | (regexp-quote string))) |
| 131 | 129 | ||
| 132 | ;;; character-fold.el ends here | 130 | ;;; character-fold.el ends here |