From: Andreas Gerler Date: Tue, 13 Nov 2018 10:44:24 +0000 (+0100) Subject: update terraform-mode. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=a9c28d91671fa4b28408268005f72f4b2dd14b42;p=emacsconfig.git update terraform-mode. Signed-off-by: Andreas Gerler --- diff --git a/elpa/terraform-mode-20160823.31/terraform-mode-autoloads.el b/elpa/terraform-mode-20160823.31/terraform-mode-autoloads.el deleted file mode 100644 index a71ec4f8..00000000 --- a/elpa/terraform-mode-20160823.31/terraform-mode-autoloads.el +++ /dev/null @@ -1,24 +0,0 @@ -;;; terraform-mode-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil "terraform-mode" "terraform-mode.el" (22473 -;;;;;; 28701 0 0)) -;;; Generated autoloads from terraform-mode.el - -(autoload 'terraform-mode "terraform-mode" "\ -Major mode for editing terraform configuration file - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.tf\\(vars\\)?\\'" . terraform-mode)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; terraform-mode-autoloads.el ends here diff --git a/elpa/terraform-mode-20160823.31/terraform-mode-pkg.el b/elpa/terraform-mode-20160823.31/terraform-mode-pkg.el deleted file mode 100644 index 8bf601c6..00000000 --- a/elpa/terraform-mode-20160823.31/terraform-mode-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "terraform-mode" "20160823.31" "Major mode for terraform configuration file" '((hcl-mode "0.2") (cl-lib "0.5")) :url "https://github.com/syohex/emacs-terraform-mode") diff --git a/elpa/terraform-mode-20160823.31/terraform-mode.el b/elpa/terraform-mode-20160823.31/terraform-mode.el deleted file mode 100644 index 818db15c..00000000 --- a/elpa/terraform-mode-20160823.31/terraform-mode.el +++ /dev/null @@ -1,109 +0,0 @@ -;;; terraform-mode.el --- Major mode for terraform configuration file - -;; Copyright (C) 2016 by Syohei YOSHIDA - -;; Author: Syohei YOSHIDA -;; URL: https://github.com/syohex/emacs-terraform-mode -;; Package-Version: 20160823.31 -;; Version: 0.05 -;; Package-Requires: ((hcl-mode "0.02") (cl-lib "0.5")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Major mode of terraform configuration file. terraform-mode provides -;; syntax highlighting, indentation function and formatting. - -;; Format the current buffer with terraform-format-buffer. To always -;; format terraform buffers when saving, use: -;; (add-hook 'terraform-mode-hook #'terraform-format-on-save-mode) - -;;; Code: - -(require 'cl-lib) -(require 'rx) -(require 'hcl-mode) - -(defgroup terraform nil - "Major mode of Terraform configuration file." - :group 'languages) - -(defcustom terraform-indent-level 2 - "The tab width to use when indenting." - :type 'integer) - -(defconst terraform--block-regexp - "^\\s-*\\(provider\\|resource\\|data\\|module\\|variable\\|output\\)\\s-+\"") - -(defconst terraform--atlas-regexp - "^\\s-*\\(atlas\\)\\s-*") - -(defconst terraform--provisioner-regexp - "^\\s-+\\(provisioner\\)\\s-+\"") - -(defvar terraform-font-lock-keywords - `((,terraform--block-regexp 1 font-lock-function-name-face) - (,terraform--atlas-regexp 1 font-lock-function-name-face) - (,terraform--provisioner-regexp 1 font-lock-function-name-face) - ,@hcl-font-lock-keywords)) - -(defun terraform-format-buffer () - "Rewrite current buffer in a canonical format using terraform fmt." - (interactive) - (let ((buf (get-buffer-create "*terraform-fmt*"))) - (if (zerop (call-process-region (point-min) (point-max) - "terraform" nil buf nil "fmt" "-")) - (let ((point (point)) - (window-start (window-start))) - (erase-buffer) - (insert-buffer-substring buf) - (goto-char point) - (set-window-start nil window-start)) - (message "terraform fmt: %s" (with-current-buffer buf (buffer-string)))) - (kill-buffer buf))) - -(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))) - -;;;###autoload -(define-derived-mode terraform-mode hcl-mode "Terraform" - "Major mode for editing terraform configuration file" - - (setq font-lock-defaults '((terraform-font-lock-keywords))) - - ;; indentation - (make-local-variable 'terraform-indent-level) - (setq hcl-indent-level terraform-indent-level) - - ;; imenu - (setq imenu-generic-expression - '(("resource" "^resource\\s-+\"[^\"]+\"\\s-+\"\\([^\"]+\\)\"" 1) - ("data" "^data\\s-+\"[^\"]+\"\\s-+\"\\([^\"]+\\)\"" 1) - ("provider" "^provider\\s-+\"\\([^\"]+\\)\"" 1) - ("module" "^module\\s-+\"\\([^\"]+\\)\"" 1) - ("variable" "^variable\\s-+\"\\([^\"]+\\)\"" 1) - ("output" "^output\\s-+\"\\([^\"]+\\)\"" 1))) - (imenu-add-to-menubar "Index")) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tf\\(vars\\)?\\'" . terraform-mode)) - -(provide 'terraform-mode) - -;;; terraform-mode.el ends here diff --git a/elpa/terraform-mode-20170112.517/terraform-mode-autoloads.el b/elpa/terraform-mode-20170112.517/terraform-mode-autoloads.el new file mode 100644 index 00000000..13c82755 --- /dev/null +++ b/elpa/terraform-mode-20170112.517/terraform-mode-autoloads.el @@ -0,0 +1,30 @@ +;;; terraform-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "terraform-mode" "terraform-mode.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from terraform-mode.el + +(autoload 'terraform-mode "terraform-mode" "\ +Major mode for editing terraform configuration file + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.tf\\(vars\\)?\\'" . terraform-mode)) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "terraform-mode" '("terraform-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; terraform-mode-autoloads.el ends here diff --git a/elpa/terraform-mode-20170112.517/terraform-mode-pkg.el b/elpa/terraform-mode-20170112.517/terraform-mode-pkg.el new file mode 100644 index 00000000..05899c2a --- /dev/null +++ b/elpa/terraform-mode-20170112.517/terraform-mode-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "terraform-mode" "20170112.517" "Major mode for terraform configuration file" '((emacs "24.3") (hcl-mode "0.3")) :commit "6973d1acaba2835dfdf174f5a5e27de6366002e1" :authors '(("Syohei YOSHIDA" . "syohex@gmail.com")) :maintainer '("Syohei YOSHIDA" . "syohex@gmail.com") :url "https://github.com/syohex/emacs-terraform-mode") diff --git a/elpa/terraform-mode-20170112.517/terraform-mode.el b/elpa/terraform-mode-20170112.517/terraform-mode.el new file mode 100644 index 00000000..eedb596e --- /dev/null +++ b/elpa/terraform-mode-20170112.517/terraform-mode.el @@ -0,0 +1,114 @@ +;;; terraform-mode.el --- Major mode for terraform configuration file -*- lexical-binding: t -*- + +;; Copyright (C) 2017 by Syohei YOSHIDA + +;; Author: Syohei YOSHIDA +;; URL: https://github.com/syohex/emacs-terraform-mode +;; Package-Version: 20170112.517 +;; Version: 0.06 +;; Package-Requires: ((emacs "24.3") (hcl-mode "0.03")) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Major mode of terraform configuration file. terraform-mode provides +;; syntax highlighting, indentation function and formatting. + +;; Format the current buffer with terraform-format-buffer. To always +;; format terraform buffers when saving, use: +;; (add-hook 'terraform-mode-hook #'terraform-format-on-save-mode) + +;;; Code: + +(require 'cl-lib) +(require 'rx) +(require 'hcl-mode) + +(defgroup terraform nil + "Major mode of Terraform configuration file." + :group 'languages) + +(defcustom terraform-indent-level 2 + "The tab width to use when indenting." + :type 'integer) + +(defconst terraform--block-regexp + "^\\s-*\\(provider\\|resource\\|data\\|module\\|variable\\|output\\)\\s-+\"") + +(defconst terraform--atlas-regexp + "^\\s-*\\(atlas\\)\\s-*") + +(defconst terraform--provisioner-regexp + "^\\s-+\\(provisioner\\)\\s-+\"") + +(defconst terraform--inner-block-regexp + "^\\s-+\\(connection\\)\\s-+{" + "Inner special block.") + +(defvar terraform-font-lock-keywords + `((,terraform--block-regexp 1 font-lock-function-name-face) + (,terraform--atlas-regexp 1 font-lock-function-name-face) + (,terraform--provisioner-regexp 1 font-lock-function-name-face) + (,terraform--inner-block-regexp 1 font-lock-keyword-face) + ,@hcl-font-lock-keywords)) + +(defun terraform-format-buffer () + "Rewrite current buffer in a canonical format using terraform fmt." + (interactive) + (let ((buf (get-buffer-create "*terraform-fmt*"))) + (if (zerop (call-process-region (point-min) (point-max) + "terraform" nil buf nil "fmt" "-")) + (let ((point (point)) + (window-start (window-start))) + (erase-buffer) + (insert-buffer-substring buf) + (goto-char point) + (set-window-start nil window-start)) + (message "terraform fmt: %s" (with-current-buffer buf (buffer-string)))) + (kill-buffer buf))) + +(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))) + +;;;###autoload +(define-derived-mode terraform-mode hcl-mode "Terraform" + "Major mode for editing terraform configuration file" + + (setq font-lock-defaults '((terraform-font-lock-keywords))) + + ;; indentation + (make-local-variable 'terraform-indent-level) + (setq hcl-indent-level terraform-indent-level) + + ;; imenu + (setq imenu-generic-expression + '(("resource" "^resource\\s-+\"[^\"]+\"\\s-+\"\\([^\"]+\\)\"" 1) + ("data" "^data\\s-+\"[^\"]+\"\\s-+\"\\([^\"]+\\)\"" 1) + ("provider" "^provider\\s-+\"\\([^\"]+\\)\"" 1) + ("module" "^module\\s-+\"\\([^\"]+\\)\"" 1) + ("variable" "^variable\\s-+\"\\([^\"]+\\)\"" 1) + ("output" "^output\\s-+\"\\([^\"]+\\)\"" 1))) + (imenu-add-to-menubar "Index")) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.tf\\(vars\\)?\\'" . terraform-mode)) + +(provide 'terraform-mode) + +;;; terraform-mode.el ends here