Skip to content

Commit

Permalink
ansible: fix error void function ansible:auto-decrypt-encrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Jan 29, 2018
1 parent 5f6f9d2 commit d1b7872
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 8 additions & 0 deletions layers/+tools/ansible/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@
;;; License: GPLv3

(defun spacemacs//ansible-should-enable? ()
"Return non-nil if `ansible' should be enabled for the current file."
(and (stringp buffer-file-name)
(string-match spacemacs--ansible-filename-re buffer-file-name)))

(defun spacemacs/ansible-maybe-enable ()
"Enable `ansible-mode' if required."
(when (spacemacs//ansible-should-enable?)
(ansible 1)))

(defun spacemacs/ansible-auto-decrypt-encrypt-vault ()
"Auto decrypt/encrypt Vault files."
(when (spacemacs//ansible-should-enable?)
(ansible::auto-decrypt-encrypt)))

(defun spacemacs/ansible-company-maybe-enable ()
"Add the ansible company backend only for when ansible mode is active."
(when (spacemacs//ansible-should-enable?)
(add-to-list 'company-backends 'company-ansible)))

(defun spacemacs/ansible-doc-maybe-enable ()
"Enable `ansible-doc-mode` if possible.'"
(when (spacemacs//ansible-should-enable?)
(ansible-doc-mode 1)))
14 changes: 8 additions & 6 deletions layers/+tools/ansible/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@
(defun ansible/init-ansible ()
(use-package ansible
:defer t
:commands ansible::auto-decrypt-encrypt
:init
(progn
(add-hook 'yaml-mode-hook 'spacemacs/ansible-maybe-enable)
(put 'ansible::vault-password-file 'safe-local-variable #'stringp)
(if ansible-auto-encrypt-decrypt
;; add this hook to local-vars-hook to allow users to specify
;; a password file in directory local variables
(add-hook 'yaml-mode-local-vars-hook 'ansible::auto-decrypt-encrypt)
(remove-hook 'yaml-mode-local-vars-hook 'ansible::auto-decrypt-encrypt))
(with-eval-after-load 'ansible
(spacemacs/set-leader-keys-for-minor-mode 'ansible
"bd" 'ansible::decrypt-buffer
"be" 'ansible::encrypt-buffer)))))
(add-hook 'yaml-mode-local-vars-hook
'spacemacs/ansible-auto-decrypt-encrypt-vault)
(remove-hook 'yaml-mode-local-vars-hook
'spacemacs/ansible-auto-decrypt-encrypt-vault))
(spacemacs/set-leader-keys-for-minor-mode 'ansible
"bd" 'ansible::decrypt-buffer
"be" 'ansible::encrypt-buffer))))

(defun ansible/init-ansible-doc ()
(use-package ansible-doc
Expand Down

0 comments on commit d1b7872

Please sign in to comment.