Function: ansible-maybe-unload-snippets

ansible-maybe-unload-snippets is a natively compiled function defined in ansible.el.

Signature

(ansible-maybe-unload-snippets &optional BUFFER-COUNT)

Documentation

Unload ansible snippets in case no other ansible buffers exists.

If BUFFER-COUNT is passed and is > 1, then skip unloading.

Source Code

;; Defined in /nix/store/ihs1wd4idvapzygy87ss7ddr2pwcpsxg-emacs-packages-deps/share/emacs/site-lisp/elpa/ansible-20260607.1852/ansible.el
(defun ansible-maybe-unload-snippets (&optional buffer-count)
  "Unload ansible snippets in case no other ansible buffers exists.
If BUFFER-COUNT is passed and is > 1, then skip unloading."
  ;; mitigates: https://github.com/k1LoW/emacs-ansible/issues/5
  (when (and (featurep 'yasnippet)
             ;; when called via kill-hook, the buffer is still existent
	     (= (or buffer-count 1)
		(seq-count (lambda (b)
                             (with-current-buffer b ansible-mode))
                           (buffer-list))))
    (setq yas-snippet-dirs (delete ansible-snip-dir yas-snippet-dirs))
    (yas-reload-all)))