[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 020e850: * lisp/character-fold.el (character-fold-t
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] master 020e850: * lisp/character-fold.el (character-fold-to-regexp): Fix case |
Date: |
Wed, 28 Oct 2015 15:50:33 +0000 |
branch: master
commit 020e8505575390ef464b8058d07cee9b161827b1
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* lisp/character-fold.el (character-fold-to-regexp): Fix case
where string ends in space
---
lisp/character-fold.el | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lisp/character-fold.el b/lisp/character-fold.el
index 521e98b..223a2cd 100644
--- a/lisp/character-fold.el
+++ b/lisp/character-fold.el
@@ -101,6 +101,13 @@
equiv))
"Used for folding characters of the same group during search.")
+(defun character-fold--make-space-string (n)
+ "Return a string that matches N spaces."
+ (format "\\(?:%s\\|%s\\)"
+ (make-string n ?\s)
+ (apply #'concat
+ (make-list n (or (aref character-fold-table ?\s) " ")))))
+
;;;###autoload
(defun character-fold-to-regexp (string &optional _lax)
"Return a regexp matching anything that character-folds into STRING.
@@ -121,18 +128,16 @@ regexp) and other characters are `regexp-quote'd."
(setq spaces (1+ spaces))
nil)
((> spaces 0)
- (prog1 (format "\\(?:%s\\|%s\\)%s"
- (make-string spaces ?\s)
- (apply #'concat
- (make-list spaces
- (or (aref
character-fold-table ?\s) " ")))
+ (prog1 (concat (character-fold--make-space-string spaces)
(or (aref character-fold-table c)
(regexp-quote (string c))))
(setq spaces 0)))
(t (or (aref character-fold-table c)
(regexp-quote (string c))))))
(setq chars (cdr chars))))
- (apply #'concat out)))
+ (concat (apply #'concat out)
+ (when (> spaces 0)
+ (character-fold--make-space-string spaces)))))
;;; Commands provided for completeness.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 020e850: * lisp/character-fold.el (character-fold-to-regexp): Fix case,
Artur Malabarba <=