summaryrefslogtreecommitdiff
path: root/debian/patches/0003-Debian-yas-installed-snippets-dir.patch
blob: 7bb58881a25fb27a70fb20092d6bad10aba892dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Sun, 27 Nov 2016 22:05:41 -0700
Subject: Debian-yas-installed-snippets-dir

This replaces the old emacsen-startup script.

Forwarded: not-needed
---
 yasnippet.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index a6977d1..22477cc 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -153,9 +153,9 @@
   :group 'editing)
 
 (defvar yas-installed-snippets-dir nil)
-(setq yas-installed-snippets-dir
-      (when load-file-name
-        (expand-file-name "snippets" (file-name-directory load-file-name))))
+(let ((snippets-directory "/usr/share/yasnippet-snippets"))
+  (when (file-exists-p snippets-directory)
+    (setq yas-installed-snippets-dir snippets-directory)))
 
 (defconst yas--default-user-snippets-dir
   (expand-file-name "snippets" user-emacs-directory))
@@ -197,7 +197,11 @@ created with `yas-new-snippet'. "
                        (stringp (symbol-value e)))
                   (symbol-value e))
                  (t
-                  (error "[yas] invalid element %s in `yas-snippet-dirs'" e)))))
+                  (error "[yas] invalid element %s in `yas-snippet-dirs'
+
+Perhaps you need to install the yasnippet-snippets Debian package,
+or remove %s from `yas-snippet-dirs'
+before loading yasnippet." e e)))))
 
 (defcustom yas-new-snippet-default "\
 # -*- mode: snippet -*-