Skip to content

Commit

Permalink
tla-mode: Let indent-line-to decide on (point) location
Browse files Browse the repository at this point in the history
This is similar to

     fc1af6d "Let `indent-line-to` decide on (point) location"

It turns out there's two indenation functions, so fix the 2nd one as well.

This unbreaks (newline-and-indent).

Before this commit calling newline-and-indent would put caret at the
beginning of line. This is not what a user wants, because they usually
desire continue typing code on the new line.

So remove the save-excursion call.

While at it, remove the beginning-of-line call as well, because both
are called first thing inside (pcal-mode--indent-column), so as far as
that function concerned having them earlier is unnecessary.
  • Loading branch information
Hi-Angel committed Jun 7, 2024
1 parent c858b57 commit 63e5879
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tla-pcal-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,8 @@
(defun tla-mode-indent-line ()
"Indent the current line according to TLA+ rules."
(interactive)
(save-excursion
(beginning-of-line)
(let ((col (tla-mode--indent-column)))
(when col
(indent-line-to col)))))
(when-let ((col (tla-mode--indent-column)))
(indent-line-to col)))

(defcustom pcal-mode-indent-offset 2
"Amount of columns to indent lines in PlusCal code."
Expand Down

0 comments on commit 63e5879

Please sign in to comment.