Setup `yasnippet' properly

This commit is contained in:
Gerard Vermeulen 2024-06-30 20:59:32 +02:00
parent edd6442bbf
commit a12fae266b

View File

@ -5266,6 +5266,9 @@ formatter for Python]].
:CUSTOM_ID: sec:smart-snippets :CUSTOM_ID: sec:smart-snippets
:END: :END:
Listing [[lst:setup-yasnippet]] ensures [[https://joaotavora.github.io/yasnippet/][YaSnippet]] installation and enables
=yas-minor-mode= in LaTeX, Org, and Python buffers.
#+caption[Setup =yasnippet=]: #+caption[Setup =yasnippet=]:
#+caption: Setup =yasnippet=. #+caption: Setup =yasnippet=.
#+name: lst:setup-yasnippet #+name: lst:setup-yasnippet
@ -5273,9 +5276,14 @@ formatter for Python]].
(when (ensure-package-installation 'yasnippet) (when (ensure-package-installation 'yasnippet)
;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'. ;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'.
(setopt yas-alias-to-yas/prefix-p nil) (setopt yas-alias-to-yas/prefix-p nil)
(with-eval-after-load 'yasnippet
(yas-load-directory (car yas-snippet-dirs)))
(add-hook 'LaTeX-mode-hook #'yas-minor-mode) (add-hook 'LaTeX-mode-hook #'yas-minor-mode)
(add-hook 'org-mode-hook #'yas-minor-mode) (add-hook 'org-mode-hook #'yas-minor-mode)
(add-hook 'python-mode-hook #'yas-minor-mode)) (add-hook 'python-mode-hook #'yas-minor-mode)
(add-hook 'python-ts-mode-hook #'yas-minor-mode))
#+end_src #+end_src
* [[info:emacs#Display][Display (info)]] * [[info:emacs#Display][Display (info)]]