From 41062da0a02867f2824c10106a7fc59bbf74e8c9 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 14:58:24 +0100 Subject: [PATCH] update hcl. Signed-off-by: Andreas Gerler --- elpa/hcl-mode-20160502.1700/hcl-mode-pkg.el | 1 - .../hcl-mode-autoloads.el | 12 ++- elpa/hcl-mode-20170107.827/hcl-mode-pkg.el | 2 + .../hcl-mode.el | 77 +++++++++++-------- 4 files changed, 56 insertions(+), 36 deletions(-) delete mode 100644 elpa/hcl-mode-20160502.1700/hcl-mode-pkg.el rename elpa/{hcl-mode-20160502.1700 => hcl-mode-20170107.827}/hcl-mode-autoloads.el (54%) create mode 100644 elpa/hcl-mode-20170107.827/hcl-mode-pkg.el rename elpa/{hcl-mode-20160502.1700 => hcl-mode-20170107.827}/hcl-mode.el (72%) 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-autoloads.el b/elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el similarity index 54% rename from elpa/hcl-mode-20160502.1700/hcl-mode-autoloads.el rename to elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el index f5b55767..fc19b9e3 100644 --- a/elpa/hcl-mode-20160502.1700/hcl-mode-autoloads.el +++ b/elpa/hcl-mode-20170107.827/hcl-mode-autoloads.el @@ -1,9 +1,12 @@ ;;; hcl-mode-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "hcl-mode" "hcl-mode.el" (22473 28699 0 0)) +;;;### (autoloads nil "hcl-mode" "hcl-mode.el" (0 0 0 0)) ;;; Generated autoloads from hcl-mode.el (autoload 'hcl-mode "hcl-mode" "\ @@ -13,11 +16,16 @@ Major mode for editing hcl configuration file (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-20160502.1700/hcl-mode.el b/elpa/hcl-mode-20170107.827/hcl-mode.el similarity index 72% rename from elpa/hcl-mode-20160502.1700/hcl-mode.el rename to elpa/hcl-mode-20170107.827/hcl-mode.el index 59efe88f..f6fc4918 100644 --- a/elpa/hcl-mode-20160502.1700/hcl-mode.el +++ b/elpa/hcl-mode-20170107.827/hcl-mode.el @@ -1,12 +1,12 @@ -;;; hcl-mode.el --- Major mode for Hashicorp +;;; hcl-mode.el --- Major mode for Hashicorp -*- lexical-binding: t -*- -;; Copyright (C) 2016 by Syohei YOSHIDA +;; Copyright (C) 2017 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")) +;; 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 @@ -142,27 +142,40 @@ (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))))) + "[^<]<<-?\\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 - (0 (ignore (hcl--syntax-propertize-heredoc end))))) + (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 @@ -189,28 +202,26 @@ (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 *") + (setq-local comment-start "#") + (setq-local comment-use-syntax t) + (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *") ;; indentation (make-local-variable 'hcl-indent-level) - (set (make-local-variable 'indent-line-function) 'hcl-indent-line) + (setq-local 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) + (setq-local beginning-of-defun-function #'hcl-beginning-of-defun) + (setq-local end-of-defun-function #'hcl-end-of-defun) - (set (make-local-variable 'syntax-propertize-function) - #'hcl--syntax-propertize-function) + (setq-local syntax-propertize-function #'hcl--syntax-propertize-function) ;; electric-mode - (set (make-local-variable 'electric-indent-chars) - (append "{}[]" electric-indent-chars))) + (setq-local electric-indent-chars (append "{}[]" electric-indent-chars))) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) +(progn + (add-to-list 'auto-mode-alist '("\\.hcl\\'" . hcl-mode)) + (add-to-list 'auto-mode-alist '("\\.nomad\\'" . hcl-mode))) (provide 'hcl-mode) -- 2.47.3