|
| 1 | +;;; common-lisp-snippets.el --- Yasnippets for Common Lisp -*- lexical-binding: t; -*- |
| 2 | +;; |
| 3 | +;; Copyright © 2015 Mark Karpov <markkarpov@openmailbox.org> |
| 4 | +;; |
| 5 | +;; Author: Mark Karpov <markkarpov@openmailbox.org> |
| 6 | +;; URL: https://github.com/mrkkrp/common-lisp-snippets |
| 7 | +;; Version: 0.1.0 |
| 8 | +;; Package-Requires: ((yasnippet "0.8.0")) |
| 9 | +;; Keywords: snippets |
| 10 | +;; |
| 11 | +;; This file is not part of GNU Emacs. |
| 12 | +;; |
| 13 | +;; This program is free software: you can redistribute it and/or modify it |
| 14 | +;; under the terms of the GNU General Public License as published by the |
| 15 | +;; Free Software Foundation, either version 3 of the License, or (at your |
| 16 | +;; option) any later version. |
| 17 | +;; |
| 18 | +;; This program is distributed in the hope that it will be useful, but |
| 19 | +;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 21 | +;; Public License for more details. |
| 22 | +;; |
| 23 | +;; You should have received a copy of the GNU General Public License along |
| 24 | +;; with this program. If not, see <http://www.gnu.org/licenses/>. |
| 25 | + |
| 26 | +;;; Commentary: |
| 27 | + |
| 28 | +;; This is a collection of Yasnippets for Common Lisp. It mainly includes |
| 29 | +;; snippets for top-level forms and (as a bonus) headers for popular |
| 30 | +;; free-software licenses: GNU GPL and MIT License. |
| 31 | + |
| 32 | +;;; Code: |
| 33 | + |
| 34 | +(require 'yasnippet) |
| 35 | + |
| 36 | +(defvar common-lisp-snippets-root |
| 37 | + (file-name-directory (or load-file-name (buffer-file-name))) |
| 38 | + "Root directory of Common Lisp snippets.") |
| 39 | + |
| 40 | +;;;###autoload |
| 41 | +(defun common-lisp-snippets-initialize () |
| 42 | + "Initialize Common Lisp snippets, so Yasnippet can see them." |
| 43 | + (let ((dir (expand-file-name "snippets" common-lisp-snippets-root))) |
| 44 | + (when (boundp 'yas-snippet-dirs) |
| 45 | + (add-to-list 'yas-snippet-dirs dir)) |
| 46 | + (yas-load-directory dir))) |
| 47 | + |
| 48 | +;;;###autoload |
| 49 | +(eval-after-load 'yasnippet |
| 50 | + '(common-lisp-snippets-initialize)) |
| 51 | + |
| 52 | +(provide 'common-lisp-snippets) |
| 53 | + |
| 54 | +;;; common-lisp-snippets.el ends here |
0 commit comments