diff options
Diffstat (limited to '.emacs.d/snippets/yasnippet-snippets.el')
| -rw-r--r-- | .emacs.d/snippets/yasnippet-snippets.el | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/.emacs.d/snippets/yasnippet-snippets.el b/.emacs.d/snippets/yasnippet-snippets.el new file mode 100644 index 0000000..958f6da --- /dev/null +++ b/.emacs.d/snippets/yasnippet-snippets.el | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | ;;; yasnippet-snippets.el --- Collection of yasnippet snippets -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Andrea Crotti | ||
| 4 | |||
| 5 | ;; Author: Andrea Crotti <andrea.crotti.0@gmail.com> | ||
| 6 | ;; Keywords: snippets | ||
| 7 | ;; Version: 1.0 | ||
| 8 | ;; Package-Requires: ((yasnippet "0.8.0")) | ||
| 9 | ;; Keywords: convenience, snippets | ||
| 10 | ;; Homepage: https://github.com/AndreaCrotti/yasnippet-snippets | ||
| 11 | |||
| 12 | ;;; Commentary: | ||
| 13 | |||
| 14 | ;; Official snippet collection for the yasnippet package. | ||
| 15 | |||
| 16 | ;;; License: | ||
| 17 | |||
| 18 | ;; This program is free software; you can redistribute it and/or modify | ||
| 19 | ;; it under the terms of the GNU General Public License as published by | ||
| 20 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 21 | ;; (at your option) any later version. | ||
| 22 | |||
| 23 | ;; This program is distributed in the hope that it will be useful, | ||
| 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 26 | ;; GNU General Public License for more details. | ||
| 27 | |||
| 28 | ;; You should have received a copy of the GNU General Public License | ||
| 29 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 30 | |||
| 31 | ;;; Code: | ||
| 32 | |||
| 33 | (require 'yasnippet) | ||
| 34 | |||
| 35 | (defconst yasnippet-snippets-dir | ||
| 36 | (expand-file-name | ||
| 37 | "snippets" | ||
| 38 | (file-name-directory | ||
| 39 | ;; Copied from ‘f-this-file’ from f.el. | ||
| 40 | (cond | ||
| 41 | (load-in-progress load-file-name) | ||
| 42 | ((and (boundp 'byte-compile-current-file) byte-compile-current-file) | ||
| 43 | byte-compile-current-file) | ||
| 44 | (:else (buffer-file-name)))))) | ||
| 45 | |||
| 46 | ;;;###autoload | ||
| 47 | (defun yasnippet-snippets-initialize () | ||
| 48 | "Load the `yasnippet-snippets' snippets directory." | ||
| 49 | ;; NOTE: we add the symbol `yasnippet-snippets-dir' rather than its | ||
| 50 | ;; value, so that yasnippet will automatically find the directory | ||
| 51 | ;; after this package is updated (i.e., moves directory). | ||
| 52 | (unless (member 'yasnippet-snippets-dir yas-snippet-dirs) | ||
| 53 | (add-to-list 'yas-snippet-dirs 'yasnippet-snippets-dir t) | ||
| 54 | (yas--load-snippet-dirs))) | ||
| 55 | |||
| 56 | (defgroup yasnippet-snippets nil | ||
| 57 | "Options for yasnippet setups. | ||
| 58 | |||
| 59 | This is useful for customizing options declared in | ||
| 60 | “.yas-setup.el” files. For example, you could declare a | ||
| 61 | customizable variable used for a snippet expansion. | ||
| 62 | |||
| 63 | See Info node `(elisp)Customization Types'." | ||
| 64 | :group 'yasnippet) | ||
| 65 | |||
| 66 | (defun yasnippet-snippets--no-indent () | ||
| 67 | "Set `yas-indent-line' to nil." | ||
| 68 | (set (make-local-variable 'yas-indent-line) nil)) | ||
| 69 | |||
| 70 | ;;;###autoload | ||
| 71 | (eval-after-load 'yasnippet | ||
| 72 | '(yasnippet-snippets-initialize)) | ||
| 73 | |||
| 74 | |||
| 75 | (provide 'yasnippet-snippets) | ||
| 76 | |||
| 77 | ;;; yasnippet-snippets.el ends here | ||
