branch: elpa/dockerfile-mode
commit 39d33264c062713ac73147e676cbb78d7a7fd080
Author: Konstantin Kharlamov <hi-an...@yandex.ru>
Commit: Drew Csillag <d...@thecsillags.com>

    Do not modify indentation if there's nothing to modify
    
    The older code has been always deleting the whitespace, even if
    indentation is already as expected. Fix that by replacing `indent-to`
    with `indent-line-to` which avoids modifying the line if there's
    nothing to modify.
    
    As a bonus, this simplifies the code.
---
 dockerfile-mode.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/dockerfile-mode.el b/dockerfile-mode.el
index 0f8f61a6c9..48fc11db9b 100644
--- a/dockerfile-mode.el
+++ b/dockerfile-mode.el
@@ -162,9 +162,7 @@ by `dockerfile-enable-auto-indent'."
        (beginning-of-line)
        (skip-chars-forward "[ \t]" (point-at-eol))
        (unless (equal (point) (point-at-eol)) ; Ignore empty lines.
-         ;; Delete existing whitespace.
-         (delete-char (- (point-at-bol) (point)))
-         (indent-to dockerfile-indent-offset))))))
+         (indent-line-to dockerfile-indent-offset))))))
 
 (defun dockerfile-build-arg-string ()
   "Create a --build-arg string for each element in `dockerfile-build-args'."

Reply via email to