expez / evil-smartparens

Evil integration for Smartparens
GNU General Public License v3.0
134 stars 17 forks source link

Indent after a change or delete, so that indenation is preserved. #12

Closed ane closed 9 years ago

ane commented 9 years ago

In smartparens-strict-mode, when deleting or changing the whole line, if the block is unbalanced, the operation is a no-op, but the mechanics of evil-delete sets the starting point of the motion (the whole line) as the beginning of the line, and thus the unbalanced sexps get deindented.

Another fix would be to modify evil-sp--new-beginning to use the start of thecurrent sexp as the beginning of the motion. This is probably a bit smarter, as the current feature feels a bit hairy, though it works.

Without this, the following behaviour occurs: (| represents point)

(defun foo (bar)
    (|let ((baz (+ bar 1)))
        baz))

Hitting dd here would do nothing, but the line with the let would be deindented, same with cc. Similarly, doing the same at |baz)) would delete or change baz and deindent.

expez commented 9 years ago

Thanks! :+1: