branch: master commit 68b0ab66ca3668846a8931774bef46c49dda1149 Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
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)) nil))) ;; 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"))