-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpoly-slim.el
More file actions
78 lines (69 loc) · 2.63 KB
/
poly-slim.el
File metadata and controls
78 lines (69 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;;; poly-slim.el --- Polymodes for slim -*- lexical-binding: t -*-
;;
;; Author: Siavash Sajjadi and Vitalie Spinu
;; Maintainer: Vitalie Spinu
;; Version: 0.2.2
;; Package-Requires: ((emacs "25") (polymode "0.2.2") (slim-mode "1.1"))
;; URL: https://github.com/polymode/poly-slim
;; Keywords: emacs
;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This file is *NOT* part of GNU Emacs.
;;
;; 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, 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(require 'polymode)
(require 'ruby-mode)
(require 'slim-mode)
;; (require 'css-mode)
;; (require 'scss-mode)
;; (require 'coffee-mode)
;; (require 'markdown-mode)
(define-obsolete-variable-alias 'pm-host/slim 'poly-slim-hostmode "v0.2")
(define-obsolete-variable-alias 'pm-inner/slim-code-block 'poly-slim-code-block-innermode "v0.2")
(defconst poly-slim-engines (regexp-opt '("ruby" "javascript" "css" "sass" "scss"
"less" "coffe" "markdown" "textile" "rdoc")))
(define-hostmode poly-slim-hostmode
:mode 'slim-mode
;; temporary
:protect-font-lock t
:protect-syntax t
:protect-indent t)
;; https://github.com/slim-template/slim/blob/master/README.md#embedded-engines-markdown-
(define-auto-innermode poly-slim-code-block-innermode nil
"Slim code block.
Slim code blocks are defined by the same level of
indentation (like python)."
;; not in comment
:head-matcher (cons (format "^[^/]*?\\(%s.*?:\\)" poly-slim-engines) 1)
:tail-matcher #'pm-same-indent-tail-matcher
:head-mode 'slim-mode
:indent-offset 4
:mode-matcher "[^ \t:]+")
;;;###autoload (autoload 'poly-slim-mode "poly-slim")
(define-polymode poly-slim-mode
:hostmode 'poly-slim-hostmode
:innermodes '(poly-slim-code-block-innermode))
(add-to-list 'auto-mode-alist '("\\.slim\\'" . poly-slim-mode))
(provide 'poly-slim)