Skip to content

Commit

Permalink
Merge pull request #6 from jakewilliami/tests
Browse files Browse the repository at this point in the history
Add tests/CI
  • Loading branch information
jakewilliami authored Apr 22, 2024
2 parents 3a16a6c + 095d542 commit fbc0b5f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 16 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
emacs_version:
- 27.1
- 27.2
- 28.1
- 28.2
- 29.1
- 29.2
- 29.3
- snapshot
steps:
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}

- uses: actions/checkout@v2
- name: Run tests
run: make
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
EMACS ?= emacs

# A space-separated list of required package names
NEEDED_PACKAGES = package-lint

INIT_PACKAGES="(progn \
(require 'package) \
(push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \
(package-initialize) \
(dolist (pkg '(${NEEDED_PACKAGES})) \
(unless (package-installed-p pkg) \
(unless (assoc pkg package-archive-contents) \
(package-refresh-contents)) \
(package-install pkg))) \
)"

all: compile package-lint clean-elc

package-lint:
${EMACS} -Q --eval ${INIT_PACKAGES} -batch -f package-lint-batch-and-exit splunk-mode.el

compile: clean-elc
${EMACS} -Q --eval ${INIT_PACKAGES} -L . -batch -f batch-byte-compile *.el

clean-elc:
rm -f f.elc

.PHONY: all compile clean-elc package-lint
31 changes: 15 additions & 16 deletions splunk-mode.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;;; splunk-mode.el --- Major Mode for editing Splunk Search Processing Language (SPL) source code -*- lexical-binding: t -*-
;;; splunk-mode.el --- Major Mode for editing Splunk SPL source code -*- lexical-binding: t -*-

;; Copyright (C) 2022–2024 Jake Ireland

;; Author: Jake Ireland <[email protected]>
;; URL: https://github.com/jakewilliami/splunk-mode/
;; Version: 1.0
;; Version: 1.1
;; Keywords: languages splunk mode
;; Package-Requires: ((emacs "27"))
;; Package-Requires: ((emacs "27.1"))

;;; Usage:
;;
Expand Down Expand Up @@ -83,7 +83,7 @@

(defvar splunk-mode-hook nil)

(defgroup splunk-mode ()
(defgroup splunk ()
"Major mode for Splunk SPL code."
:link '(url-link "https://docs.splunk.com/")
:version "0.1"
Expand Down Expand Up @@ -126,67 +126,67 @@
(defface splunk-comment-face
'((t :inherit font-lock-comment-face))
"Face for alternative comment syntax in Splunk."
:group 'splunk-mode)
:group 'splunk)

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

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

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

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

(defface splunk-macros-face
'((t :inherit font-lock-function-name-face))
;; '((t :inherit font-lock-keyword-face))
;; '((t :inherit font-lock-type-face))
"Face for macros in Splunk."
:group 'splunk-mode)
:group 'splunk)

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

(defface splunk-digits-face
;; '((t :inherit font-lock-number-face)) ;; Added too recently
'((t :inherit font-lock-type-face))
"Face for digits in Splunk."
:group 'splunk-mode)
:group 'splunk)

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

(defface splunk-operators-face
'((t :inherit font-lock-builtin-face
:weight bold))
"Face for operators in Splunk."
:group 'splunk-mode)
:group 'splunk)



Expand Down Expand Up @@ -375,8 +375,7 @@
:syntax-table splunk-mode-syntax-table
(setq-local font-lock-defaults '(splunk-font-lock-keywords))
(setq-local comment-start "//")
(setq-local indent-line-function 'splunk-indent-line)
(font-lock-fontify-buffer))
(setq-local indent-line-function 'splunk-indent-line))

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

0 comments on commit fbc0b5f

Please sign in to comment.