Fix off-by-one cursor issue with indent-new-comment-line

This commit is contained in:
Henrik Lissner 2016-03-04 18:26:25 -05:00
parent 0c885e450b
commit 37ea71eff6

View File

@ -147,7 +147,13 @@ spaces on either side of the point if so. Resorts to
(newline-and-indent)
(insert "* ")
(indent-according-to-mode))
(t (indent-new-comment-line))))
(t
;; Fix an off-by-one cursor-positioning issue
;; with `indent-new-comment-line'
(let ((col (save-excursion (comment-beginning) (current-column))))
(indent-new-comment-line)
(unless (= col (current-column))
(insert " "))))))
(t
(newline nil t)
(indent-according-to-mode))))