* Fixed broken `yas/choose-keys-first'

This commit is contained in:
capitaomorte 2011-05-08 14:28:11 +00:00
parent 0a22a2bb63
commit 49a9d85d10

View File

@ -1086,6 +1086,13 @@ Also takes care of adding and updaring to the associated menu."
(let ((menu-binding-pair (yas/snippet-menu-binding-pair-get-create template))) (let ((menu-binding-pair (yas/snippet-menu-binding-pair-get-create template)))
(define-key keymap (vector (make-symbol (yas/template-uuid template))) (car menu-binding-pair)))))) (define-key keymap (vector (make-symbol (yas/template-uuid template))) (car menu-binding-pair))))))
(defun yas/namehash-templates-alist (namehash)
(let (alist)
(maphash #'(lambda (k v)
(push (cons k v) alist))
namehash)
alist))
(defun yas/fetch (table key) (defun yas/fetch (table key)
"Fetch templates in TABLE by KEY. "Fetch templates in TABLE by KEY.
@ -1094,12 +1101,7 @@ string and TEMPLATE is a `yas/template' structure."
(let* ((keyhash (yas/table-hash table)) (let* ((keyhash (yas/table-hash table))
(namehash (and keyhash (gethash key keyhash)))) (namehash (and keyhash (gethash key keyhash))))
(when namehash (when namehash
(yas/filter-templates-by-condition (yas/filter-templates-by-condition (yas/namehash-templates-alist namehash)))))
(let (alist)
(maphash #'(lambda (k v)
(push (cons k v) alist))
namehash)
alist)))))
;;; Filtering/condition logic ;;; Filtering/condition logic
@ -1204,8 +1206,8 @@ the template of a snippet in the current snippet-table."
(defun yas/table-all-keys (table) (defun yas/table-all-keys (table)
(when table (when table
(let ((acc)) (let ((acc))
(maphash #'(lambda (key templates) (maphash #'(lambda (key namehash)
(when (yas/filter-templates-by-condition templates) (when (yas/filter-templates-by-condition (yas/namehash-templates-alist namehash))
(push key acc))) (push key acc)))
(yas/table-hash table)) (yas/table-hash table))
acc))) acc)))