[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5b59b80 139/177: Closes #495: Allow symbols as aliases in
From: |
João Távora |
Subject: |
[elpa] master 5b59b80 139/177: Closes #495: Allow symbols as aliases in `yas-snippet-dirs' |
Date: |
Sat, 28 Mar 2015 15:41:28 +0000 |
branch: master
commit 5b59b802ac4550394a810637de3af42f4d673abb
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Closes #495: Allow symbols as aliases in `yas-snippet-dirs'
* yasnippet.el (yas-installed-snippets-dir): New parameter. Set at
load time from `load-file-name'.
(yas--load-file-name): Removed.
(yas-snippet-dirs): Update docstring. Default value has symbol
`yas-installed-snippets-dir' as an alias to any bundled snippets.
(yas-snippet-dirs): Redesign for new `yas-snippet-dirs' semantics.
---
yasnippet.el | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index adcd44d..c25d78d 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -150,21 +150,25 @@
"Yet Another Snippet extension"
:group 'editing)
-(defvar yas--load-file-name load-file-name
- "Store the filename that yasnippet.el was originally loaded from.")
+(defvar yas-installed-snippets-dir nil)
+(setq yas-installed-snippets-dir
+ (when load-file-name
+ (concat (file-name-directory load-file-name) "snippets")))
(defcustom yas-snippet-dirs (remove nil
(list "~/.emacs.d/snippets"
- (when yas--load-file-name
- (concat (file-name-directory
yas--load-file-name) "snippets"))))
- "Directory or list of snippet dirs for each major mode.
-
-The directory where user-created snippets are to be stored. Can
-also be a list of directories. In that case, when used for
-bulk (re)loading of snippets (at startup or via
-`yas-reload-all'), directories appearing earlier in the list
-shadow other dir's snippets. Also, the first directory is taken
-as the default for storing the user's new snippets."
+ 'yas-installed-snippets-dir))
+ "List of top-level snippet directories.
+
+Each element, a string or a symbol whose value is a string,
+designates a top-level directory where per-mode snippet
+directories can be found.
+
+Elements appearing earlier in the list shadow later elements'
+snippets.
+
+The first directory is taken as the default for storing snippet's
+created with `yas-new-snippet'. "
:type '(choice (string :tag "Single directory (string)")
(repeat :args (string) :tag "List of directories (strings)"))
:group 'yasnippet
@@ -178,8 +182,18 @@ as the default for storing the user's new snippets."
(yas-reload-all)))))
(defun yas-snippet-dirs ()
- "Return `yas-snippet-dirs' (which see) as a list."
- (if (listp yas-snippet-dirs) yas-snippet-dirs (list yas-snippet-dirs)))
+ "Return variable `yas-snippet-dirs' as list of strings."
+ (cl-loop for e in (if (listp yas-snippet-dirs)
+ yas-snippet-dirs
+ (list yas-snippet-dirs))
+ collect
+ (cond ((stringp e) e)
+ ((and (symbolp e)
+ (boundp e)
+ (stringp (symbol-value e)))
+ (symbol-value e))
+ (t
+ (error "[yas] invalid element %s in `yas-snippet-dirs'"
e)))))
(defvaralias 'yas/root-directory 'yas-snippet-dirs)
- [elpa] master faed106 129/177: * yasnippet.el (yas-key-syntaxes): Improve documentation., (continued)
- [elpa] master faed106 129/177: * yasnippet.el (yas-key-syntaxes): Improve documentation., João Távora, 2015/03/28
- [elpa] master de34d91 130/177: Closes #470, handle non-whitespace newlines, João Távora, 2015/03/28
- [elpa] master 6b04dad 120/177: Document type directive, João Távora, 2015/03/28
- [elpa] master 10ecde1 132/177: Pass start point to yas-key-syntaxes functions, João Távora, 2015/03/28
- [elpa] master 47a3d5f 134/177: Fix yas-key-syntaxes example functions docstrings., João Távora, 2015/03/28
- [elpa] master d982b70 135/177: Fix edge case in yas-longest-key-from-whitespace, João Távora, 2015/03/28
- [elpa] master 5d10b5d 133/177: Add yas-longest-key-from-whitespace, João Távora, 2015/03/28
- [elpa] master f7ef023 137/177: Prevent disabling errors from recent `yas-current-syntaxes` logic, João Távora, 2015/03/28
- [elpa] master 1d4618b 138/177: Closes #504: Correctly discover buffers needing snippets immediately, João Távora, 2015/03/28
- [elpa] master e60e8b5 136/177: Merge pull request #503 from npostavs/key-syntaxes, João Távora, 2015/03/28
- [elpa] master 5b59b80 139/177: Closes #495: Allow symbols as aliases in `yas-snippet-dirs',
João Távora <=
- [elpa] master be2f815 140/177: Closes #508: Ensure original point when evaluating conditions, João Távora, 2015/03/28
- [elpa] master 241465c 141/177: move eof footer to the actual eof, João Távora, 2015/03/28
- [elpa] master 70de821 143/177: enforce use of spaces for indentation, João Távora, 2015/03/28
- [elpa] master 41cb5f5 145/177: Update snippets submodule, João Távora, 2015/03/28
- [elpa] master cc64ff6 144/177: Merge pull request #514 from tarsius/master, João Távora, 2015/03/28
- [elpa] master 8e9bf3c 147/177: Merge pull request #518 from rnkn/master, João Távora, 2015/03/28
- [elpa] master 6f7c915 146/177: Compatibility with custom-unlispify-remove-prefixes, João Távora, 2015/03/28
- [elpa] master 783cc33 148/177: Use cl-incf instead of cl, João Távora, 2015/03/28
- [elpa] master 08b044e 149/177: Merge pull request #519 from syohex/use-cl-macro, João Távora, 2015/03/28
- [elpa] master e731451 150/177: Signal an error on recursive yas--fallback calls, João Távora, 2015/03/28