diff options
author | Tom Willemse | 2021-02-08 22:30:54 -0800 |
---|---|---|
committer | Tom Willemse | 2021-02-08 22:31:50 -0800 |
commit | c62a5ec9c6fb7d9ae1d00386d27d18c8ee2b6697 (patch) | |
tree | 7d7faf9a2db56f8fb5587b46ab7fb9a2191a92b5 | |
parent | d8249988845a0c0ab08c16d9ada9d6c8fa848600 (diff) | |
download | emacs-config-c62a5ec9c6fb7d9ae1d00386d27d18c8ee2b6697.tar.gz emacs-config-c62a5ec9c6fb7d9ae1d00386d27d18c8ee2b6697.zip |
Use ‘conf-unix-mode’ for ‘.service’ files
-rw-r--r-- | oni-conf/oni-conf.el | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | test/integration/oni-conf.bats | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/oni-conf/oni-conf.el b/oni-conf/oni-conf.el index 7cd2171..a191501 100644 --- a/oni-conf/oni-conf.el +++ b/oni-conf/oni-conf.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2020.0113.212837 +;; Version: 2021.0208.174956 ;; Package-Requires: (oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -53,6 +53,9 @@ (add-hook 'conf-mode-hook 'oni-conf--auto-fill-mode) ;;;###autoload +(add-to-list 'auto-mode-alist `(,(rx ".service" string-end) . conf-mode)) + +;;;###autoload (with-eval-after-load 'conf-mode (with-eval-after-load 'yasnippet (oni-conf-snippets-initialize))) diff --git a/test/integration/oni-conf.bats b/test/integration/oni-conf.bats index 1f9f2d3..aa1cc88 100644..100755 --- a/test/integration/oni-conf.bats +++ b/test/integration/oni-conf.bats @@ -7,5 +7,15 @@ echo "$output" - [ "$output" = "t" ] + [[ "$output" == *"t" ]] +} + +@test "Opening a .service file enables conf-mode" { + run emacs -batch -l package -f package-initialize \ + -visit test.service \ + -eval "(prin1 (derived-mode-p major-mode 'conf-mode))" + + echo "$output" + + [[ "$output" == *"t" ]] } |