Skip to content

Commit fbbbe60

Browse files
authored
Merge pull request purescript-emacs#18 from Hi-Angel/dont-modify-on-same-indentation
purescript-indentation.el: don't modify buffer if indentation unchanged
2 parents c3f0d6e + 53c4675 commit fbbbe60

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

purescript-indentation.el

+12-11
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,18 @@ autofill-mode."
196196
(end-of-line))))
197197

198198
(defun purescript-indentation-reindent (col)
199-
(beginning-of-line)
200-
(delete-region (point)
201-
(progn
202-
(when (and (eq purescript-literate 'bird)
203-
(eq (char-after) ?>))
204-
(forward-char))
205-
(skip-syntax-forward "-")
206-
(point)))
207-
(when (eq purescript-literate 'bird)
208-
(insert ">"))
209-
(indent-to col))
199+
(unless (= col (purescript-indentation-current-indentation))
200+
(beginning-of-line)
201+
(delete-region (point)
202+
(progn
203+
(when (and (eq purescript-literate 'bird)
204+
(eq (char-after) ?>))
205+
(forward-char))
206+
(skip-syntax-forward "-")
207+
(point)))
208+
(when (eq purescript-literate 'bird)
209+
(insert ">"))
210+
(indent-to col)))
210211

211212
(defun purescript-indentation-current-indentation ()
212213
(if (eq purescript-literate 'bird)

0 commit comments

Comments
 (0)