branch: master
commit 2100b89eb89a7e1e06b5a54ff52c6b9db1995208
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Closes #632: Use `user-emacs-directory' instead of hardcoded "~/emacs.d"
* yasnippet.el (yas--default-user-snippets-dir): New defconst.
(yas-snippet-dirs, yas--guess-snippet-directories): Use it.
---
yasnippet.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index c456247..803be0b 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -156,8 +156,11 @@
(when load-file-name
(concat (file-name-directory load-file-name) "snippets")))
+(defconst yas--default-user-snippets-dir
+ (concat user-emacs-directory "snippets"))
+
(defcustom yas-snippet-dirs (remove nil
- (list "~/.emacs.d/snippets"
+ (list yas--default-user-snippets-dir
'yas-installed-snippets-dir))
"List of top-level snippet directories.
@@ -2416,7 +2419,7 @@ where snippets of table might exist."
(let ((main-dir (replace-regexp-in-string
"/+$" ""
(or (first (or (yas-snippet-dirs)
- (setq yas-snippet-dirs
'("~/.emacs.d/snippets")))))))
+ (setq yas-snippet-dirs (list
yas--default-user-snippets-dir)))))))
(tables (or (and table
(list table))
(yas--get-snippet-tables))))