File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 3333clean-elc :
3434 rm -f f.elc
3535
36- .PHONY : all compile clean-elc package-lint
36+ .PHONY : all compile clean-elc package-lint test
Original file line number Diff line number Diff line change 102102 (forward-line -1 ))))))
103103 (current-indentation ))))
104104
105+ (defun hcl-calculate-indentation ()
106+ (let ((block-indentation (hcl--block-indentation)))
107+ (if block-indentation
108+ (if (looking-at " []}]" )
109+ block-indentation
110+ (+ block-indentation hcl-indent-level))
111+ (hcl--previous-indentation))))
112+
105113(defun hcl-indent-line ()
106114 " Indent current line as Hcl configuration."
107115 (interactive )
110118 (back-to-indentation )
111119 (if (hcl--in-string-or-comment-p)
112120 (goto-char curpoint)
113- (let ((block-indentation (hcl--block-indentation)))
114- (delete-region (line-beginning-position ) (point ))
115- (if block-indentation
116- (if (looking-at " []}]" )
117- (indent-to block-indentation)
118- (indent-to (+ block-indentation hcl-indent-level)))
119- (indent-to (hcl--previous-indentation)))
120- (when (> (- (point-max ) pos) (point ))
121- (goto-char (- (point-max ) pos)))))))
121+ (indent-line-to (hcl-calculate-indentation))
122+ (when (> (- (point-max ) pos) (point ))
123+ (goto-char (- (point-max ) pos))))))
122124
123125(defun hcl-beginning-of-defun (&optional count )
124126 (interactive " p" )
You can’t perform that action at this time.
0 commit comments