diff options
author | Dieter Komendera <dieter@komendera.com> | 2018-09-30 18:46:45 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2018-09-30 21:36:50 +0300 |
commit | 15548cc3b82f2056925ace1e8edd7c35a61d1e65 (patch) | |
tree | d607cec9fdd52e87484fddcb46ad8162a802f6ca /cider-format.el | |
parent | 3cb2dbb701953c5fde9604d50bc5f791cc4ad721 (diff) |
Fix restoring point after formatting in some conditions
The snippet is used as a regex, so it needs to be quoted to not cause any regex
errors further down and also make the search more precise.
An example would be that the snippet would contain the opening [ of a clojure
vector, but not the closing ], which lead to an invalid regex and thus make
re-search-forward/re-search-backward break.
Diffstat (limited to 'cider-format.el')
-rw-r--r-- | cider-format.el | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cider-format.el b/cider-format.el index 0bcbd9b3..8256ea8a 100644 --- a/cider-format.el +++ b/cider-format.el @@ -68,6 +68,7 @@ Uses the following heuristic to try to maintain point position: (endp (> (+ pos l) pos-max)) (snippet (thread-last (buffer-substring-no-properties pos (min (+ pos l) pos-max)) + (regexp-quote) (replace-regexp-in-string "[[:space:]\t\n\r]+" "[[:space:]\t\n\r]*")))) (delete-region start end) (insert indented) |