snippets.el 644 B

123456789101112131415161718
  1. ;; Inspired by https://github.com/suzp1984/donkey/blob/master/elisp/auto-insert/my-auto-insert.el
  2. (defun yas-expand-current-buffer ()
  3. "Expand all yasnippet snippets in a current buffer."
  4. (interactive)
  5. (yas-expand-snippet (buffer-string) (point-min) (point-max)))
  6. (with-eval-after-load 'yasnippet
  7. (setq yas-snippet-dirs
  8. (append (wi-expand-file-names
  9. '("~/.emacs.d/snippets"
  10. "~/src/git.savannah.gnu.org/git/guix/etc/snippets"
  11. "~/.guix-profile/share/emacs/yasnippet-snippets"))
  12. yas-snippet-dirs))
  13. (yas-reload-all))
  14. (add-hook 'find-file-hook 'auto-insert)