better yas/describe-tables

This commit is contained in:
capitaomorte 2010-03-29 18:15:08 +00:00
parent 32336e1462
commit 2a88ccfaff

View File

@ -743,6 +743,7 @@ all defined direct keybindings to the command
(mode major-mode))
(while (setq mode (get mode 'derived-mode-parent))
(push mode modes-to-activate))
(push yas/mode-symbol modes-to-activate)
(dolist (mode modes-to-activate)
(let ((name (intern (format "yas//direct-%s" mode))))
(set-default name nil)
@ -2560,7 +2561,9 @@ With optional prefix argument KILL quit the window and buffer."
yas/tables)
all))
(table-lists (list active-tables remain-tables))
(continue t))
(original-buffer (current-buffer))
(continue t)
(yas/condition-cache-timestamp (current-time)))
(with-current-buffer buffer
(let ((buffer-read-only nil))
(erase-buffer)
@ -2572,24 +2575,33 @@ With optional prefix argument KILL quit the window and buffer."
(insert (format "\nSnippet table `%s'"
(yas/table-name table)))
(if (yas/table-parents table)
(insert (format " parents: %s\n\n"
(insert (format " parents: %s\n"
(mapcar #'yas/table-name
(yas/table-parents table))))
(insert "\n\n"))
(let ((templates))
(insert "\n"))
(let ((always (cons "(a)" (list)))
(active (cons "(y)" (list)))
(sleeping (cons "(n)" (list))))
(maphash #'(lambda (k v)
(push v templates))
(let ((condition (yas/template-condition v)))
(if condition
(with-current-buffer original-buffer
(if (yas/eval-condition condition)
(push v (cdr active))
(push v (cdr sleeping))))
(push v (cdr always)))))
(yas/table-uidhash table))
(dolist (p templates)
(let ((name (yas/template-name p)))
(insert (propertize (format "\\\\snippet `%s'" name) 'yasnippet p))
(insert (make-string (max (- 50 (length name))
1) ? ))
(when (yas/template-key p)
(insert (format "key \"%s\" " (yas/template-key p))))
(when (yas/template-keybinding p)
(insert (format "bound to %s " (key-description (yas/template-keybinding p)))))
(insert "\n")))))
(dolist (type-and-templates (list always active sleeping))
(dolist (p (cdr type-and-templates))
(let ((name (yas/template-name p)))
(insert (propertize (format "%s \\\\snippet `%s'" (car type-and-templates) name) 'yasnippet p))
(insert (make-string (max (- 50 (length name))
1) ? ))
(when (yas/template-key p)
(insert (format "key \"%s\" " (yas/template-key p))))
(when (yas/template-keybinding p)
(insert (format "bound to %s " (key-description (yas/template-keybinding p)))))
(insert "\n"))))))
(setq table-lists (cdr table-lists))
(when table-lists
(yas/create-snippet-xrefs)