1
0
Fork 0

Automatically load scheme-mode for scsh files

When the interpreter contains scsh, load ‘scheme-mode’.
This commit is contained in:
Tom Willemse 2020-01-06 20:09:13 -08:00
parent 39bbfffbd8
commit 0115885ae5
2 changed files with 25 additions and 1 deletions

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2019.1210.231332 ;; Version: 2020.0106.200514
;; Package-Requires: (oni-company oni-paredit oni-fci rainbow-delimiters) ;; Package-Requires: (oni-company oni-paredit oni-fci rainbow-delimiters)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -37,6 +37,7 @@
(add-hook 'scheme-mode-hook 'rainbow-delimiters-mode) (add-hook 'scheme-mode-hook 'rainbow-delimiters-mode)
(add-hook 'scheme-mode-hook 'oni-scheme--auto-fill-mode) (add-hook 'scheme-mode-hook 'oni-scheme--auto-fill-mode)
;;;###autoload
(add-to-list 'interpreter-mode-alist '("scsh" . scheme-mode)) (add-to-list 'interpreter-mode-alist '("scsh" . scheme-mode))
;;;###autoload(with-eval-after-load 'scheme (require 'oni-scheme)) ;;;###autoload(with-eval-after-load 'scheme (require 'oni-scheme))

23
test/oni-scheme.bats Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bats
@test "Opening a scheme file loads oni-scheme" {
run emacs -batch -l package -f package-initialize \
-visit test.scm \
-eval "(prin1 (featurep 'oni-scheme))"
[ "$output" = "t" ]
}
@test "Opening a file with the SCSH interpreter loads scheme-mode" {
filename="$(mktemp)"
echo "#!/usr/bin/scsh -s" > "$filename"
run emacs -batch -l package -f package-initialize \
-visit "$filename" \
-eval "(prin1 major-mode)"
rm "$filename"
[ "$output" = "scheme-mode" ]
}