[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 68b0ab6 20/60: Accept documented snippet list formats

From: João Távora
Subject: [elpa] master 68b0ab6 20/60: Accept documented snippet list formats
Date: Thu, 21 Jan 2016 22:35:55 +0000

branch: master
commit 68b0ab66ca3668846a8931774bef46c49dda1149
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Accept documented snippet list formats
    yas-define-snippets was making assumptions that happended to be true for
    its current calls, but could fail if given differently formatted snippet
    lists that still meet the docstring description.
    * yasnippet.el (yas-define-snippets): Handle incomplete snippet lists.
 yasnippet.el |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index e580426..1fd08e2 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -1660,11 +1660,13 @@ the current buffers contents."
       (let ((print-length nil))
         (insert ";;; Snippet definitions:\n;;;\n")
         (dolist (snippet snippets)
+          ;; Fill in missing elements with nil.
+          (setq snippet (append snippet (make-list (- 10 (length snippet)) 
           ;; Move LOAD-FILE to SAVE-FILE because we will load from the
           ;; compiled file, not LOAD-FILE.
-          (let ((load-file-cell (nthcdr 6 snippet)))
-            (setcdr (last snippet) (list (car load-file-cell)))
-            (setcar (nthcdr 6 snippet) nil)))
+          (let ((load-file (nth 6 snippet)))
+            (setcar (nthcdr 6 snippet) nil)
+            (setcar (nthcdr 9 snippet) load-file)))
         (insert (pp-to-string
                  `(yas-define-snippets ',mode ',snippets)))
         (insert "\n\n"))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]