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.
This commit is contained in:
João Távora 2015-11-26 13:18:16 +00:00
parent 1cf723a408
commit 2100b89eb8

View File

@ -156,8 +156,11 @@
(when load-file-name (when load-file-name
(concat (file-name-directory load-file-name) "snippets"))) (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 (defcustom yas-snippet-dirs (remove nil
(list "~/.emacs.d/snippets" (list yas--default-user-snippets-dir
'yas-installed-snippets-dir)) 'yas-installed-snippets-dir))
"List of top-level snippet directories. "List of top-level snippet directories.
@ -2416,7 +2419,7 @@ where snippets of table might exist."
(let ((main-dir (replace-regexp-in-string (let ((main-dir (replace-regexp-in-string
"/+$" "" "/+$" ""
(or (first (or (yas-snippet-dirs) (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 (tables (or (and table
(list table)) (list table))
(yas--get-snippet-tables)))) (yas--get-snippet-tables))))