Commit b976e099 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(dired-string-replace-match): Return `nil' when no match

found with global search.
parent ee13a145
......@@ -1315,12 +1315,12 @@ If it does not match, nil is returned instead of the new string.
Optional arg LITERAL means to take NEWTEXT literally.
Optional arg GLOBAL means to replace all matches."
(if global
(let ((start 0))
(let ((start 0) ret)
(while (string-match regexp string start)
(let ((from-end (- (length string) (match-end 0))))
(setq string (replace-match newtext t literal string))
(setq ret (setq string (replace-match newtext t literal string)))
(setq start (- (length string) from-end))))
(if (not (string-match regexp string 0))
(replace-match newtext t literal string))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment