diff options
author | Taylor R Campbell <campbell+paredit@mumble.net> | 2017-04-05 18:47:53 +0000 |
---|---|---|
committer | Taylor R Campbell <campbell+paredit@mumble.net> | 2017-04-05 18:48:14 +0000 |
commit | 38899558cf242187966d8bf1771a3c8e48eb5090 (patch) | |
tree | ef76ff6c4137b318c551b4a6f5fc7637e14b813f /paredit.el | |
parent | 7c27746a8eb259ae24b5dce9380801c4846258f0 (diff) |
Don't reindent single-line edits in paredit-raise-sexp.
Add a couple trivial tests for paredit-raise-sexp.
Bug reported by Alex Plotnick.
Diffstat (limited to 'paredit.el')
-rw-r--r-- | paredit.el | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2156,7 +2156,15 @@ If the point is on an S-expression, such as a string or a symbol, not (delete-region (point) (scan-sexps (point) 1)) (let* ((indent-start (point)) (indent-end (save-excursion (insert sexps) (point)))) - (indent-region indent-start indent-end nil))))) + ;; If the expression spans multiple lines, its indentation is + ;; probably broken, so reindent it -- but don't reindent + ;; anything that we didn't touch outside the expression. + ;; + ;; XXX What if the *column* of the starting point was preserved + ;; too? Should we avoid reindenting in that case? + (if (not (eq (save-excursion (goto-char indent-start) (point-at-eol)) + (save-excursion (goto-char indent-end) (point-at-eol)))) + (indent-region indent-start indent-end nil)))))) ;;; The effects of convolution on the surrounding whitespace are pretty ;;; random. If you have better suggestions, please let me know. |