Function: terraform-format-on-save-mode

terraform-format-on-save-mode is an interactive and natively compiled function defined in terraform-mode.el.

Signature

(terraform-format-on-save-mode &optional ARG)

Documentation

Run terraform-format-buffer before saving current buffer.

This is a minor mode. If called interactively, toggle the Terraform-Format-On-Save mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable terraform-format-on-save-mode(var)/terraform-format-on-save-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/2sgzhgfr3sxpjh5dpyjjiqacrm3016bl-emacs-packages-deps/share/emacs/site-lisp/elpa/terraform-mode-20251115.2210/terraform-mode.el
(define-minor-mode terraform-format-on-save-mode
  "Run terraform-format-buffer before saving current buffer."
  :lighter ""
  (if terraform-format-on-save-mode
      (add-hook 'before-save-hook #'terraform-format-buffer nil t)
    (remove-hook 'before-save-hook #'terraform-format-buffer t)))