mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
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.
This commit is contained in:
parent
215ad9bcf2
commit
68b0ab66ca
@ -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"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user