     (setq ispell-complete-word-dict (concat (expand-file-name user-emacs-directory) "dict/en_GB.dic"))
     (ispell-change-dictionary "en_GB"))
   :config
-  (setq ispell-program-name "aspell"
-        ispell-really-aspell t
-        ispell-extra-args '("--sug-mode=ultra")
-        ispell-list-command "--list"
+  (cond ((executable-find "hunspell")
+         (setq ispell-program-name "hunspell"
+               ispell-really-hunspell t))
+        ((executable-find "aspell")
+         (setq ispell-program-name "aspell"
+               ispell-really-aspell t
+               ispell-extra-args '("--sug-mode=ultra"))))
+  (setq ispell-list-command "--list"
         ispell-look-p nil
         ispell-grep-command "rg"
         ispell-grep-options "-i"

;; Modelo (Template)
(use-package yasnippet
  :ensure t
  :diminish yas-minor-mode " ⓨ"
  :commands yas-minor-mode yas-global-mode
  :init
  (add-hook 'prog-mode-hook 'yas-minor-mode)

  (setq aya-persist-snippets-dir (concat user-emacs-directory ".cache/auto-snippets/")))

(use-package autoinsert
  :hook (after-init . auto-insert-mode)
  :init
  (add-hook 'find-file-hook 'auto-insert)
  :config
  (defun autoinsert-yas-expand()
    "Replace text in yasnippet template."
    (yas-expand-snippet (buffer-string) (point-min) (point-max)))
  (setq auto-insert-directory (concat user-emacs-directory "templates")
        auto-insert-query nil)
  (define-auto-insert "\\.c$"    ["template-c"      autoinsert-yas-expand])
  (define-auto-insert "\\.java$" ["template-java"   autoinsert-yas-expand])
  (define-auto-insert "\\.rkt$"  ["template-racket" autoinsert-yas-expand]))
;; ---

