branch: externals/substitute commit ccf35a65098c9923a01a2aa08a3f6a99f5462a4a Author: Kostas Andreadis <kandr...@umass.edu> Commit: Kostas Andreadis <kandr...@umass.edu>
Handle strings with escape sequences --- substitute.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substitute.el b/substitute.el index 0c39c4f66a..9598a35196 100644 --- a/substitute.el +++ b/substitute.el @@ -186,7 +186,7 @@ Each entry is a list of the symbol and its buffer positions.") (save-restriction (substitute--setup-scope target scope) (while (funcall search-fn target nil t) - (push (list (match-string-no-properties 0) + (push (list (regexp-quote (match-string-no-properties 0)) (match-beginning 0) (match-end 0)) substitute--last-matches)))) @@ -249,7 +249,7 @@ target at point. Report a `user-error' if no target is found." (cond ((region-active-p) - (buffer-substring-no-properties (region-beginning) (region-end))) + (regexp-quote (buffer-substring-no-properties (region-beginning) (region-end)))) (t (if-let ((thing (thing-at-point 'symbol t))) (format "\\_<%s\\_>" thing)