emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dockerfile-mode 363aca7803 087/104: added: dockerfile-inde


From: ELPA Syncer
Subject: [nongnu] elpa/dockerfile-mode 363aca7803 087/104: added: dockerfile-indent-offset
Date: Sat, 29 Jan 2022 07:58:39 -0500 (EST)

branch: elpa/dockerfile-mode
commit 363aca780386c064b842f49cc89bd63700ab5a94
Author: ncaq <ncaq@ncaq.net>
Commit: ncaq <ncaq@ncaq.net>

    added: dockerfile-indent-offset
    
    `tab-width` is not the size of an indentation step.
    
    > NOTE: This controls the display width of a TAB character, and not the 
size of an indentation step.
    >
    > see `describe-variable` `tab-width`
    
    So, I add dockerfile-indent-offset and respect `standard-indent`.
---
 dockerfile-mode.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dockerfile-mode.el b/dockerfile-mode.el
index 6d9afa27ef..f7b82aa7f3 100644
--- a/dockerfile-mode.el
+++ b/dockerfile-mode.el
@@ -60,6 +60,12 @@ Each element of the list will be passed as a separate
   :type '(repeat string)
   :group 'dockerfile)
 
+(defcustom dockerfile-indent-offset (and standard-indent 2)
+  "Dockerfile number of columns for margin-changing functions to indent."
+  :type 'integer
+  :safe #'integerp
+  :group 'dockerfile)
+
 (defface dockerfile-image-name
   '((t (:inherit (font-lock-type-face bold))))
   "Face to highlight the base image name after FROM instruction.")
@@ -123,7 +129,7 @@ Each element of the list will be passed as a separate
   "Indent lines in a Dockerfile.
 
 Lines beginning with a keyword are ignored, and any others are
-indented by one `tab-width'."
+indented by one `dockerfile-indent-offset'."
   (unless (member (get-text-property (point-at-bol) 'face)
                   '(font-lock-comment-delimiter-face font-lock-keyword-face))
     (save-excursion
@@ -132,7 +138,7 @@ indented by one `tab-width'."
       (unless (equal (point) (point-at-eol)) ; Ignore empty lines.
         ;; Delete existing whitespace.
         (delete-char (- (point-at-bol) (point)))
-        (indent-to tab-width)))))
+        (indent-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

[Prev in Thread] Current Thread [Next in Thread]