From: Andreas Gerler Date: Tue, 13 Nov 2018 13:58:24 +0000 (+0100) Subject: update hcl. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=41062da0a02867f2824c10106a7fc59bbf74e8c9;p=emacsconfig.git update hcl. Signed-off-by: Andreas Gerler --- diff --git a/elpa/hcl-mode-20160502.1700/hcl-mode-autoloads.el b/elpa/hcl-mode-20160502.1700/hcl-mode-autoloads.el deleted file mode 100644 index f5b55767..00000000 --- a/elpa/hcl-mode-20160502.1700/hcl-mode-autoloads.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; hcl-mode-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil "hcl-mode" "hcl-mode.el" (22473 28699 0 0)) -;;; Generated autoloads from hcl-mode.el - -(autoload 'hcl-mode "hcl-mode" "\ -Major mode for editing hcl configuration file - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; hcl-mode-autoloads.el ends here diff --git a/elpa/hcl-mode-20160502.1700/hcl-mode-pkg.el b/elpa/hcl-mode-20160502.1700/hcl-mode-pkg.el deleted file mode 100644 index d5544c3d..00000000 --- a/elpa/hcl-mode-20160502.1700/hcl-mode-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "hcl-mode" "20160502.1700" "Major mode for Hashicorp" '((emacs "24") (cl-lib "0.5")) :url "https://github.com/syohex/emacs-hcl-mode") diff --git a/elpa/hcl-mode-20160502.1700/hcl-mode.el b/elpa/hcl-mode-20160502.1700/hcl-mode.el deleted file mode 100644 index 59efe88f..00000000 --- a/elpa/hcl-mode-20160502.1700/hcl-mode.el +++ /dev/null @@ -1,217 +0,0 @@ -;;; hcl-mode.el --- Major mode for Hashicorp - -;; Copyright (C) 2016 by Syohei YOSHIDA - -;; Author: Syohei YOSHIDA -;; URL: https://github.com/syohex/emacs-hcl-mode -;; Package-Version: 20160502.1700 -;; Version: 0.02 -;; Package-Requires: ((emacs "24") (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: - -;; hcl-mode provides a major-mode of hcl file. - -;;; Code: - -(require 'cl-lib) -(require 'rx) - -(defgroup hcl nil - "Major mode of Hashicorp Configuration Language." - :group 'languages) - -(defcustom hcl-indent-level 2 - "The tab width to use when indenting." - :type 'integer) - -(defconst hcl--block-regexp - "^\\s-*[^{]+{") - -;; String Interpolation(This regexp is taken from ruby-mode) -(defconst hcl--string-interpolation-regexp - "\\${[^}\n\\\\]*\\(?:\\\\.[^}\n\\\\]*\\)*}") - -(defconst hcl--assignment-regexp - "\\s-*\\([[:word:]]+\\)\\s-*=\\(?:[^>=]\\)") - -(defconst hcl--map-regexp - "\\s-*\\([[:word:]]+\\)\\s-*{") - -(defconst hcl--boolean-regexp - (concat "\\(?:^\\|[^.]\\)" - (regexp-opt '("true" "false" "on" "off" "yes" "no") - 'words))) - -(defvar hcl-font-lock-keywords - `((,hcl--assignment-regexp 1 font-lock-variable-name-face) - (,hcl--boolean-regexp . font-lock-constant-face) - (,hcl--map-regexp 1 font-lock-type-face) - (,hcl--string-interpolation-regexp 0 font-lock-variable-name-face t))) - -(defsubst hcl--paren-level () - (car (syntax-ppss))) - -(defsubst hcl--in-string-or-comment-p () - (nth 8 (syntax-ppss))) - -(defun hcl--block-indentation () - (let ((curline (line-number-at-pos))) - (save-excursion - (condition-case nil - (progn - (backward-up-list) - (unless (= curline (line-number-at-pos)) - (current-indentation))) - (scan-error nil))))) - -(defun hcl--previous-indentation () - (save-excursion - (forward-line -1) - (let (finish) - (while (not finish) - (cond ((bobp) (setq finish t)) - ((hcl--in-string-or-comment-p) (forward-line -1)) - (t - (let ((line (buffer-substring-no-properties - (line-beginning-position) (line-end-position)))) - (if (not (string-match-p "\\`\\s-*\\'" line)) - (setq finish t) - (forward-line -1)))))) - (current-indentation)))) - -(defun hcl-indent-line () - "Indent current line as Hcl configuration." - (interactive) - (let* ((curpoint (point)) - (pos (- (point-max) curpoint))) - (back-to-indentation) - (if (hcl--in-string-or-comment-p) - (goto-char curpoint) - (let ((block-indentation (hcl--block-indentation))) - (delete-region (line-beginning-position) (point)) - (if block-indentation - (if (looking-at "[]}]") - (indent-to block-indentation) - (indent-to (+ block-indentation hcl-indent-level))) - (indent-to (hcl--previous-indentation))) - (when (> (- (point-max) pos) (point)) - (goto-char (- (point-max) pos))))))) - -(defun hcl-beginning-of-defun (&optional count) - (interactive "p") - (setq count (or count 1)) - (let ((match 0) - finish) - (while (and (not finish) - (re-search-backward hcl--block-regexp nil t)) - (unless (hcl--in-string-or-comment-p) - (cl-incf match) - (when (= match count) - (setq finish t)))))) - -(defun hcl-end-of-defun (&optional count) - (interactive "p") - (let ((paren-level (hcl--paren-level))) - (when (or (and (looking-at-p "}") (= paren-level 1)) - (= paren-level 0)) - (re-search-forward hcl--block-regexp nil t))) - (dotimes (_i count) - (when (looking-at-p hcl--block-regexp) - (goto-char (line-end-position))) - (hcl-beginning-of-defun 1) - (skip-chars-forward "^{") - (forward-char 1) - (let ((orig-level (hcl--paren-level))) - (while (>= (hcl--paren-level) orig-level) - (skip-chars-forward "^}") - (forward-line +1))))) - -(eval-and-compile - (defconst hcl--here-doc-beg-re - "<<[~-]?\\(?:\\([a-zA-Z0-9_]+\\)\\|\"\\([^\"]+\\)\"\\|'\\([^']+\\)'\\)")) - -(defun hcl--syntax-propertize-heredoc (limit) - (goto-char (match-beginning 0)) - (let ((heredoc-marker (cl-loop for i from 1 to 3 - when (match-string i) - return it))) - (put-text-property (point) (1+ (point)) 'syntax-table (string-to-syntax "|")) - (let ((end-re (concat "^\\(" heredoc-marker "\\)\\W"))) - (if (re-search-forward end-re nil t) - (goto-char (match-end 1)) - (goto-char (point-max))) - (put-text-property (1- (point)) (point) 'syntax-table (string-to-syntax "|")) - (goto-char (match-end 0))))) - -(defun hcl--syntax-propertize-function (start end) - (goto-char start) - (funcall - (syntax-propertize-rules - (hcl--here-doc-beg-re - (0 (ignore (hcl--syntax-propertize-heredoc end))))) - (point) end)) - -(defvar hcl-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-M-a") 'hcl-beginning-of-defun) - (define-key map (kbd "C-M-e") 'hcl-end-of-defun) - map) - "Keymap for Hcl major mode.") - -;;;###autoload -(define-derived-mode hcl-mode prog-mode "HCL" - "Major mode for editing hcl configuration file" - - (setq font-lock-defaults '((hcl-font-lock-keywords))) - - (modify-syntax-entry ?_ "w" hcl-mode-syntax-table) - - ;;; Comments - ;; Single line comment - (modify-syntax-entry ?# "< b" hcl-mode-syntax-table) - (modify-syntax-entry ?\n "> b" hcl-mode-syntax-table) - - ;; multiple line comment(/* ... */) taken from `go-mode' - (modify-syntax-entry ?/ ". 124b" hcl-mode-syntax-table) - (modify-syntax-entry ?* ". 23" hcl-mode-syntax-table) - - (set (make-local-variable 'comment-start) "#") - (set (make-local-variable 'comment-use-syntax) t) - (set (make-local-variable 'comment-start-skip) "\\(//+\\|/\\*+\\)\\s *") - - ;; indentation - (make-local-variable 'hcl-indent-level) - (set (make-local-variable 'indent-line-function) 'hcl-indent-line) - - (set (make-local-variable 'beginning-of-defun-function) - 'hcl-beginning-of-defun) - (set (make-local-variable 'end-of-defun-function) - 'hcl-end-of-defun) - - (set (make-local-variable 'syntax-propertize-function) - #'hcl--syntax-propertize-function) - - ;; electric-mode - (set (make-local-variable 'electric-indent-chars) - (append "{}[]" electric-indent-chars))) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) - -(provide 'hcl-mode) - -;;; hcl-mode.el ends here diff --git a/elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el b/elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el new file mode 100644 index 00000000..fc19b9e3 --- /dev/null +++ b/elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el @@ -0,0 +1,31 @@ +;;; hcl-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "hcl-mode" "hcl-mode.el" (0 0 0 0)) +;;; Generated autoloads from hcl-mode.el + +(autoload 'hcl-mode "hcl-mode" "\ +Major mode for editing hcl configuration file + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) + +(add-to-list 'auto-mode-alist '("\\.nomad\\'" . hcl-mode)) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "hcl-mode" '("hcl-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; hcl-mode-autoloads.el ends here diff --git a/elpa/hcl-mode-20170107.827/hcl-mode-pkg.el b/elpa/hcl-mode-20170107.827/hcl-mode-pkg.el new file mode 100644 index 00000000..a9e446b3 --- /dev/null +++ b/elpa/hcl-mode-20170107.827/hcl-mode-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "hcl-mode" "20170107.827" "Major mode for Hashicorp" '((emacs "24.3")) :commit "0f2c5ec7e7bcf77c8548e8cac8721ea935ca1b5e" :authors '(("Syohei YOSHIDA" . "syohex@gmail.com")) :maintainer '("Syohei YOSHIDA" . "syohex@gmail.com") :url "https://github.com/syohex/emacs-hcl-mode") diff --git a/elpa/hcl-mode-20170107.827/hcl-mode.el b/elpa/hcl-mode-20170107.827/hcl-mode.el new file mode 100644 index 00000000..f6fc4918 --- /dev/null +++ b/elpa/hcl-mode-20170107.827/hcl-mode.el @@ -0,0 +1,228 @@ +;;; hcl-mode.el --- Major mode for Hashicorp -*- lexical-binding: t -*- + +;; Copyright (C) 2017 by Syohei YOSHIDA + +;; Author: Syohei YOSHIDA +;; URL: https://github.com/syohex/emacs-hcl-mode +;; Package-Version: 20170107.827 +;; Version: 0.03 +;; Package-Requires: ((emacs "24.3")) + +;; 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: + +;; hcl-mode provides a major-mode of hcl file. + +;;; Code: + +(require 'cl-lib) +(require 'rx) + +(defgroup hcl nil + "Major mode of Hashicorp Configuration Language." + :group 'languages) + +(defcustom hcl-indent-level 2 + "The tab width to use when indenting." + :type 'integer) + +(defconst hcl--block-regexp + "^\\s-*[^{]+{") + +;; String Interpolation(This regexp is taken from ruby-mode) +(defconst hcl--string-interpolation-regexp + "\\${[^}\n\\\\]*\\(?:\\\\.[^}\n\\\\]*\\)*}") + +(defconst hcl--assignment-regexp + "\\s-*\\([[:word:]]+\\)\\s-*=\\(?:[^>=]\\)") + +(defconst hcl--map-regexp + "\\s-*\\([[:word:]]+\\)\\s-*{") + +(defconst hcl--boolean-regexp + (concat "\\(?:^\\|[^.]\\)" + (regexp-opt '("true" "false" "on" "off" "yes" "no") + 'words))) + +(defvar hcl-font-lock-keywords + `((,hcl--assignment-regexp 1 font-lock-variable-name-face) + (,hcl--boolean-regexp . font-lock-constant-face) + (,hcl--map-regexp 1 font-lock-type-face) + (,hcl--string-interpolation-regexp 0 font-lock-variable-name-face t))) + +(defsubst hcl--paren-level () + (car (syntax-ppss))) + +(defsubst hcl--in-string-or-comment-p () + (nth 8 (syntax-ppss))) + +(defun hcl--block-indentation () + (let ((curline (line-number-at-pos))) + (save-excursion + (condition-case nil + (progn + (backward-up-list) + (unless (= curline (line-number-at-pos)) + (current-indentation))) + (scan-error nil))))) + +(defun hcl--previous-indentation () + (save-excursion + (forward-line -1) + (let (finish) + (while (not finish) + (cond ((bobp) (setq finish t)) + ((hcl--in-string-or-comment-p) (forward-line -1)) + (t + (let ((line (buffer-substring-no-properties + (line-beginning-position) (line-end-position)))) + (if (not (string-match-p "\\`\\s-*\\'" line)) + (setq finish t) + (forward-line -1)))))) + (current-indentation)))) + +(defun hcl-indent-line () + "Indent current line as Hcl configuration." + (interactive) + (let* ((curpoint (point)) + (pos (- (point-max) curpoint))) + (back-to-indentation) + (if (hcl--in-string-or-comment-p) + (goto-char curpoint) + (let ((block-indentation (hcl--block-indentation))) + (delete-region (line-beginning-position) (point)) + (if block-indentation + (if (looking-at "[]}]") + (indent-to block-indentation) + (indent-to (+ block-indentation hcl-indent-level))) + (indent-to (hcl--previous-indentation))) + (when (> (- (point-max) pos) (point)) + (goto-char (- (point-max) pos))))))) + +(defun hcl-beginning-of-defun (&optional count) + (interactive "p") + (setq count (or count 1)) + (let ((match 0) + finish) + (while (and (not finish) + (re-search-backward hcl--block-regexp nil t)) + (unless (hcl--in-string-or-comment-p) + (cl-incf match) + (when (= match count) + (setq finish t)))))) + +(defun hcl-end-of-defun (&optional count) + (interactive "p") + (let ((paren-level (hcl--paren-level))) + (when (or (and (looking-at-p "}") (= paren-level 1)) + (= paren-level 0)) + (re-search-forward hcl--block-regexp nil t))) + (dotimes (_i count) + (when (looking-at-p hcl--block-regexp) + (goto-char (line-end-position))) + (hcl-beginning-of-defun 1) + (skip-chars-forward "^{") + (forward-char 1) + (let ((orig-level (hcl--paren-level))) + (while (>= (hcl--paren-level) orig-level) + (skip-chars-forward "^}") + (forward-line +1))))) + +(eval-and-compile + (defconst hcl--here-doc-beg-re + "[^<]<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)\\(\n\\)")) + +(defun hcl--syntax-propertize-heredoc (end) + (let ((ppss (syntax-ppss))) + (when (eq t (nth 3 ppss)) + (let ((key (get-text-property (nth 8 ppss) 'hcl-here-doc-marker)) + (case-fold-search nil)) + (when (re-search-forward + (concat "^\\(?:[ \t]*\\)" (regexp-quote key) "\\(\n\\)") + end 'move) + (let ((eol (match-beginning 1))) + (put-text-property eol (1+ eol) + 'syntax-table (string-to-syntax "|")))))))) + +(defun hcl--font-lock-open-heredoc (start string eol) + (unless (or (memq (char-before start) '(?< ?>)) + (save-excursion + (goto-char start) + (hcl--in-string-or-comment-p))) + (let ((str (replace-regexp-in-string "['\"]" "" string)) + (ppss (save-excursion (syntax-ppss eol)))) + (put-text-property eol (1+ eol) 'hcl-here-doc-marker str) + (prog1 (string-to-syntax "|") + (goto-char (+ 2 start)))))) + +(defun hcl--syntax-propertize-function (start end) + (goto-char start) + (hcl--syntax-propertize-heredoc end) + (funcall + (syntax-propertize-rules + (hcl--here-doc-beg-re + (2 (hcl--font-lock-open-heredoc + (match-beginning 0) (match-string 1) (match-beginning 2)))) + ("\\s|" (0 (prog1 nil (hcl--syntax-propertize-heredoc end))))) + (point) end)) + +(defvar hcl-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-M-a") 'hcl-beginning-of-defun) + (define-key map (kbd "C-M-e") 'hcl-end-of-defun) + map) + "Keymap for Hcl major mode.") + +;;;###autoload +(define-derived-mode hcl-mode prog-mode "HCL" + "Major mode for editing hcl configuration file" + + (setq font-lock-defaults '((hcl-font-lock-keywords))) + + (modify-syntax-entry ?_ "w" hcl-mode-syntax-table) + + ;;; Comments + ;; Single line comment + (modify-syntax-entry ?# "< b" hcl-mode-syntax-table) + (modify-syntax-entry ?\n "> b" hcl-mode-syntax-table) + + ;; multiple line comment(/* ... */) taken from `go-mode' + (modify-syntax-entry ?/ ". 124b" hcl-mode-syntax-table) + (modify-syntax-entry ?* ". 23" hcl-mode-syntax-table) + + (setq-local comment-start "#") + (setq-local comment-use-syntax t) + (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *") + + ;; indentation + (make-local-variable 'hcl-indent-level) + (setq-local indent-line-function 'hcl-indent-line) + + (setq-local beginning-of-defun-function #'hcl-beginning-of-defun) + (setq-local end-of-defun-function #'hcl-end-of-defun) + + (setq-local syntax-propertize-function #'hcl--syntax-propertize-function) + + ;; electric-mode + (setq-local electric-indent-chars (append "{}[]" electric-indent-chars))) + +;;;###autoload +(progn + (add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) + (add-to-list 'auto-mode-alist '("\\.nomad\\'" . hcl-mode))) + +(provide 'hcl-mode) + +;;; hcl-mode.el ends here