Skip to content

Commit fbc0b5f

Browse files
authored
Merge pull request #6 from jakewilliami/tests
Add tests/CI
2 parents 3a16a6c + 095d542 commit fbc0b5f

File tree

3 files changed

+68
-16
lines changed

3 files changed

+68
-16
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on: push
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
emacs_version:
10+
- 27.1
11+
- 27.2
12+
- 28.1
13+
- 28.2
14+
- 29.1
15+
- 29.2
16+
- 29.3
17+
- snapshot
18+
steps:
19+
- uses: purcell/setup-emacs@master
20+
with:
21+
version: ${{ matrix.emacs_version }}
22+
23+
- uses: actions/checkout@v2
24+
- name: Run tests
25+
run: make

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
EMACS ?= emacs
2+
3+
# A space-separated list of required package names
4+
NEEDED_PACKAGES = package-lint
5+
6+
INIT_PACKAGES="(progn \
7+
(require 'package) \
8+
(push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \
9+
(package-initialize) \
10+
(dolist (pkg '(${NEEDED_PACKAGES})) \
11+
(unless (package-installed-p pkg) \
12+
(unless (assoc pkg package-archive-contents) \
13+
(package-refresh-contents)) \
14+
(package-install pkg))) \
15+
)"
16+
17+
all: compile package-lint clean-elc
18+
19+
package-lint:
20+
${EMACS} -Q --eval ${INIT_PACKAGES} -batch -f package-lint-batch-and-exit splunk-mode.el
21+
22+
compile: clean-elc
23+
${EMACS} -Q --eval ${INIT_PACKAGES} -L . -batch -f batch-byte-compile *.el
24+
25+
clean-elc:
26+
rm -f f.elc
27+
28+
.PHONY: all compile clean-elc package-lint

splunk-mode.el

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
;;; splunk-mode.el --- Major Mode for editing Splunk Search Processing Language (SPL) source code -*- lexical-binding: t -*-
1+
;;; splunk-mode.el --- Major Mode for editing Splunk SPL source code -*- lexical-binding: t -*-
22

33
;; Copyright (C) 2022–2024 Jake Ireland
44

55
;; Author: Jake Ireland <jakewilliami@icloud.com>
66
;; URL: https://github.com/jakewilliami/splunk-mode/
7-
;; Version: 1.0
7+
;; Version: 1.1
88
;; Keywords: languages splunk mode
9-
;; Package-Requires: ((emacs "27"))
9+
;; Package-Requires: ((emacs "27.1"))
1010

1111
;;; Usage:
1212
;;
@@ -83,7 +83,7 @@
8383

8484
(defvar splunk-mode-hook nil)
8585

86-
(defgroup splunk-mode ()
86+
(defgroup splunk ()
8787
"Major mode for Splunk SPL code."
8888
:link '(url-link "https://docs.splunk.com/")
8989
:version "0.1"
@@ -126,67 +126,67 @@
126126
(defface splunk-comment-face
127127
'((t :inherit font-lock-comment-face))
128128
"Face for alternative comment syntax in Splunk."
129-
:group 'splunk-mode)
129+
:group 'splunk)
130130

131131
(defface splunk-builtin-functions-face
132132
'((t :inherit font-lock-builtin-face))
133133
;; '((t :inherit font-lock-function-name-face))
134134
;; '((t :inherit font-lock-constant-face))
135135
"Face for builtin functions such as `rename', `table', and `stat' in Splunk."
136-
:group 'splunk-mode)
136+
:group 'splunk)
137137

138138
(defface splunk-eval-functions-face
139139
'((t :inherit font-lock-function-name-face))
140140
;; '((t :inherit font-lock-keyword-face))
141141
;; '((t :inherit font-lock-type-face))
142142
"Face for eval functions such as `abs' and `mvindex' in Splunk."
143-
:group 'splunk-mode)
143+
:group 'splunk)
144144

145145
(defface splunk-transforming-functions-face
146146
'((t :inherit font-lock-function-name-face))
147147
;; '((t :inherit font-lock-keyword-face))
148148
;; '((t :inherit font-lock-type-face))
149149
"Face for transforming functions such as `count' and `values' in Splunk."
150-
:group 'splunk-mode)
150+
:group 'splunk)
151151

152152
(defface splunk-language-constants-face
153153
'((t :inherit font-lock-constant-face))
154154
;; '((t :inherit font-lock-type-face))
155155
;; '((t :inherit font-lock-function-name-face))
156156
"Face for language constants such as `as' and `by' in Splunk."
157-
:group 'splunk-mode)
157+
:group 'splunk)
158158

159159
(defface splunk-macros-face
160160
'((t :inherit font-lock-function-name-face))
161161
;; '((t :inherit font-lock-keyword-face))
162162
;; '((t :inherit font-lock-type-face))
163163
"Face for macros in Splunk."
164-
:group 'splunk-mode)
164+
:group 'splunk)
165165

166166
(defface splunk-keyword-face
167167
'((t :inherit font-lock-variable-name-face))
168168
;; '((t :inherit font-lock-constant-face))
169169
;; '((t :inherit font-lock-variable-name-face))
170170
"Face for keywords (e.g. `sourcetype=*') in Splunk."
171-
:group 'splunk-mode)
171+
:group 'splunk)
172172

173173
(defface splunk-digits-face
174174
;; '((t :inherit font-lock-number-face)) ;; Added too recently
175175
'((t :inherit font-lock-type-face))
176176
"Face for digits in Splunk."
177-
:group 'splunk-mode)
177+
:group 'splunk)
178178

179179
(defface splunk-escape-chars-face
180180
;; '((t :inherit font-lock-escape-face)) ;; Added too recently
181181
'((t :inherit font-lock-constant-face))
182182
"Face for escape characters in Splunk."
183-
:group 'splunk-mode)
183+
:group 'splunk)
184184

185185
(defface splunk-operators-face
186186
'((t :inherit font-lock-builtin-face
187187
:weight bold))
188188
"Face for operators in Splunk."
189-
:group 'splunk-mode)
189+
:group 'splunk)
190190

191191

192192

@@ -375,8 +375,7 @@
375375
:syntax-table splunk-mode-syntax-table
376376
(setq-local font-lock-defaults '(splunk-font-lock-keywords))
377377
(setq-local comment-start "//")
378-
(setq-local indent-line-function 'splunk-indent-line)
379-
(font-lock-fontify-buffer))
378+
(setq-local indent-line-function 'splunk-indent-line))
380379

381380
;;;###autoload
382381
(add-to-list 'auto-mode-alist '("\\.spl\\'" . splunk-mode))

0 commit comments

Comments
 (0)