Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
020e8505
Commit
020e8505
authored
Oct 28, 2015
by
Artur Malabarba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/character-fold.el (character-fold-to-regexp): Fix case
where string ends in space
parent
7dfe2478
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
lisp/character-fold.el
lisp/character-fold.el
+11
-6
No files found.
lisp/character-fold.el
View file @
020e8505
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment