Disable ‘shfmt-on-save-mode’ for ‘bats-mode’ buffers
This commit is contained in:
parent
23a23d3c1b
commit
a8b95ba858
2 changed files with 16 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2020.0108.154614
|
;; Version: 2020.0407.213908
|
||||||
;; Package-Requires: (bats-mode oni-sh)
|
;; Package-Requires: (bats-mode oni-sh)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -30,6 +30,13 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'autoinsert)
|
(require 'autoinsert)
|
||||||
|
(require 'oni-sh)
|
||||||
|
|
||||||
|
(defun oni-bats-disable-shfmt-on-save-mode ()
|
||||||
|
"Disable ‘shfmt-on-save-mode’."
|
||||||
|
(shfmt-on-save-mode -1))
|
||||||
|
|
||||||
|
(add-hook 'bats-mode-hook #'oni-bats-disable-shfmt-on-save-mode)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(with-eval-after-load 'autoinsert
|
(with-eval-after-load 'autoinsert
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
(require 'oni-bats)
|
||||||
|
|
||||||
(ert-deftest oni-bats-test-auto-insert ()
|
(ert-deftest oni-bats-test-auto-insert ()
|
||||||
"Test that ‘auto-insert’ inserts the proper interpreter."
|
"Test that ‘auto-insert’ inserts the proper interpreter."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
@ -5,3 +7,9 @@
|
||||||
(let ((auto-insert-query nil))
|
(let ((auto-insert-query nil))
|
||||||
(auto-insert))
|
(auto-insert))
|
||||||
(should (string= "#!/usr/bin/env bats\n\n" (buffer-string)))))
|
(should (string= "#!/usr/bin/env bats\n\n" (buffer-string)))))
|
||||||
|
|
||||||
|
(ert-deftest oni-bats-has-shfmt-on-save-mode-disabled ()
|
||||||
|
"Test that ‘shfmt-on-save-mode’ is disabled in a ‘bats-mode’ buffer."
|
||||||
|
(with-temp-buffer
|
||||||
|
(bats-mode)
|
||||||
|
(should-not shfmt-on-save-mode)))
|
||||||
|
|
Loading…
Reference in a new issue