diff options
Diffstat (limited to '.emacs.d/lisp/yaml-mode.el')
| -rw-r--r-- | .emacs.d/lisp/yaml-mode.el | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/.emacs.d/lisp/yaml-mode.el b/.emacs.d/lisp/yaml-mode.el index dad0380..3add6b7 100644 --- a/.emacs.d/lisp/yaml-mode.el +++ b/.emacs.d/lisp/yaml-mode.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Marshall T. Vandegrift <llasram@gmail.com> | 6 | ;; Marshall T. Vandegrift <llasram@gmail.com> |
| 7 | ;; Maintainer: Vasilij Schneidermann <mail@vasilij.de> | 7 | ;; Maintainer: Vasilij Schneidermann <mail@vasilij.de> |
| 8 | ;; URL: https://github.com/yoshiki/yaml-mode | 8 | ;; URL: https://github.com/yoshiki/yaml-mode |
| 9 | ;; Package-Requires: ((emacs "24.1")) | 9 | ;; Package-Requires: ((emacs "24.3")) |
| 10 | ;; Keywords: data yaml | 10 | ;; Keywords: data yaml |
| 11 | ;; Version: 0.0.16 | 11 | ;; Version: 0.0.16 |
| 12 | 12 | ||
| @@ -109,7 +109,7 @@ that key is pressed to begin a block literal." | |||
| 109 | :group 'yaml) | 109 | :group 'yaml) |
| 110 | 110 | ||
| 111 | (defcustom yaml-imenu-generic-expression | 111 | (defcustom yaml-imenu-generic-expression |
| 112 | '((nil "^\\(:?[a-zA-Z_-]+\\):" 1)) | 112 | '((nil "^\\(:?[a-zA-Z_][-a-zA-Z0-9_.]*\\):" 1)) |
| 113 | "The imenu regex to parse an outline of the yaml file." | 113 | "The imenu regex to parse an outline of the yaml file." |
| 114 | :type 'string | 114 | :type 'string |
| 115 | :group 'yaml) | 115 | :group 'yaml) |
| @@ -218,17 +218,17 @@ that key is pressed to begin a block literal." | |||
| 218 | (define-derived-mode yaml-mode text-mode "YAML" | 218 | (define-derived-mode yaml-mode text-mode "YAML" |
| 219 | "Simple mode to edit YAML." | 219 | "Simple mode to edit YAML." |
| 220 | (setq-local electric-indent-inhibit t) ;We can't *re*indent reliably. | 220 | (setq-local electric-indent-inhibit t) ;We can't *re*indent reliably. |
| 221 | (set (make-local-variable 'comment-start) "# ") | 221 | (setq-local comment-start "# ") |
| 222 | (set (make-local-variable 'comment-start-skip) "#+ *") | 222 | (setq-local comment-start-skip "#+ *") |
| 223 | (set (make-local-variable 'comment-end) "") | 223 | (setq-local comment-end "") |
| 224 | (set (make-local-variable 'indent-line-function) #'yaml-indent-line) | 224 | (setq-local indent-line-function #'yaml-indent-line) |
| 225 | (set (make-local-variable 'indent-tabs-mode) nil) | 225 | (setq-local indent-tabs-mode nil) |
| 226 | (set (make-local-variable 'fill-paragraph-function) #'yaml-fill-paragraph) | 226 | (setq-local fill-paragraph-function #'yaml-fill-paragraph) |
| 227 | (set (make-local-variable 'page-delimiter) "^---\\([ \t].*\\)*\n") | 227 | (setq-local page-delimiter "^---\\([ \t].*\\)*\n") |
| 228 | 228 | ||
| 229 | (set (make-local-variable 'syntax-propertize-function) | 229 | (setq-local syntax-propertize-function #'yaml-mode-syntax-propertize-function) |
| 230 | #'yaml-mode-syntax-propertize-function) | 230 | (setq-local imenu-generic-expression yaml-imenu-generic-expression) |
| 231 | (setq font-lock-defaults '(yaml-font-lock-keywords))) | 231 | (setq-local font-lock-defaults '(yaml-font-lock-keywords))) |
| 232 | 232 | ||
| 233 | 233 | ||
| 234 | ;; Font-lock support | 234 | ;; Font-lock support |
| @@ -464,16 +464,6 @@ this will do usual adaptive fill behaviors." | |||
| 464 | (or (fill-comment-paragraph justify) | 464 | (or (fill-comment-paragraph justify) |
| 465 | (fill-paragraph justify region))))) | 465 | (fill-paragraph justify region))))) |
| 466 | 466 | ||
| 467 | (defun yaml-set-imenu-generic-expression () | ||
| 468 | ;; FIXME: Why set this var to its default value? | ||
| 469 | (setq-local imenu-create-index-function #'imenu-default-create-index-function) | ||
| 470 | (setq-local imenu-generic-expression yaml-imenu-generic-expression)) | ||
| 471 | |||
| 472 | ;; FIXME: Why not inline `yaml-set-imenu-generic-expression' into the | ||
| 473 | ;; major mode function? | ||
| 474 | (add-hook 'yaml-mode-hook #'yaml-set-imenu-generic-expression) | ||
| 475 | |||
| 476 | |||
| 477 | (defun yaml-mode-version () | 467 | (defun yaml-mode-version () |
| 478 | "Display version of `yaml-mode'." | 468 | "Display version of `yaml-mode'." |
| 479 | (interactive) | 469 | (interactive) |
