branch: externals/substitute commit 75298b6f508925b23efeafdd14449c69f54a463e Merge: 3c80ceeb4f ccf35a6509 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: GitHub <nore...@github.com>
Merge pull request #3 from kandread/fix/special-strings 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)