diff options
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/rust-mode.el b/rust-mode.el index 988b869..a2e1fc0 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -114,14 +114,14 @@ ;; Otherwise we're in a column-zero definition (t 0)))))) - (cond - ;; If we're to the left of the indentation, reindent and jump to it. - ((<= (current-column) indent) - (indent-line-to indent)) - - ;; We're to the right; if it needs indent, do so but save excursion. - ((not (eq (current-indentation) indent)) - (save-excursion (indent-line-to indent)))))) + (when (not (eq (current-indentation) indent)) + ;; If we're at the beginning of the line (before or at the current + ;; indentation), jump with the indentation change. Otherwise, save the + ;; excursion so that adding the indentations will leave us at the + ;; equivalent position within the line to where we were before. + (if (<= (current-column) (current-indentation)) + (indent-line-to indent) + (save-excursion (indent-line-to indent)))))) ;; Font-locking definitions and helpers |
