From c62a5ec9c6fb7d9ae1d00386d27d18c8ee2b6697 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 8 Feb 2021 22:30:54 -0800 Subject: [PATCH] =?UTF-8?q?Use=20=E2=80=98conf-unix-mode=E2=80=99=20for=20?= =?UTF-8?q?=E2=80=98.service=E2=80=99=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oni-conf/oni-conf.el | 5 ++++- test/integration/oni-conf.bats | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) mode change 100644 => 100755 test/integration/oni-conf.bats 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 ;; 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 @@ -52,6 +52,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 diff --git a/test/integration/oni-conf.bats b/test/integration/oni-conf.bats old mode 100644 new mode 100755 index 1f9f2d3..aa1cc88 --- 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" ]] }