mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
better yas/describe-tables
This commit is contained in:
parent
32336e1462
commit
2a88ccfaff
42
yasnippet.el
42
yasnippet.el
@ -743,6 +743,7 @@ all defined direct keybindings to the command
|
|||||||
(mode major-mode))
|
(mode major-mode))
|
||||||
(while (setq mode (get mode 'derived-mode-parent))
|
(while (setq mode (get mode 'derived-mode-parent))
|
||||||
(push mode modes-to-activate))
|
(push mode modes-to-activate))
|
||||||
|
(push yas/mode-symbol modes-to-activate)
|
||||||
(dolist (mode modes-to-activate)
|
(dolist (mode modes-to-activate)
|
||||||
(let ((name (intern (format "yas//direct-%s" mode))))
|
(let ((name (intern (format "yas//direct-%s" mode))))
|
||||||
(set-default name nil)
|
(set-default name nil)
|
||||||
@ -2560,7 +2561,9 @@ With optional prefix argument KILL quit the window and buffer."
|
|||||||
yas/tables)
|
yas/tables)
|
||||||
all))
|
all))
|
||||||
(table-lists (list active-tables remain-tables))
|
(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
|
(with-current-buffer buffer
|
||||||
(let ((buffer-read-only nil))
|
(let ((buffer-read-only nil))
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
@ -2572,24 +2575,33 @@ With optional prefix argument KILL quit the window and buffer."
|
|||||||
(insert (format "\nSnippet table `%s'"
|
(insert (format "\nSnippet table `%s'"
|
||||||
(yas/table-name table)))
|
(yas/table-name table)))
|
||||||
(if (yas/table-parents table)
|
(if (yas/table-parents table)
|
||||||
(insert (format " parents: %s\n\n"
|
(insert (format " parents: %s\n"
|
||||||
(mapcar #'yas/table-name
|
(mapcar #'yas/table-name
|
||||||
(yas/table-parents table))))
|
(yas/table-parents table))))
|
||||||
(insert "\n\n"))
|
(insert "\n"))
|
||||||
(let ((templates))
|
(let ((always (cons "(a)" (list)))
|
||||||
|
(active (cons "(y)" (list)))
|
||||||
|
(sleeping (cons "(n)" (list))))
|
||||||
(maphash #'(lambda (k v)
|
(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))
|
(yas/table-uidhash table))
|
||||||
(dolist (p templates)
|
(dolist (type-and-templates (list always active sleeping))
|
||||||
(let ((name (yas/template-name p)))
|
(dolist (p (cdr type-and-templates))
|
||||||
(insert (propertize (format "\\\\snippet `%s'" name) 'yasnippet p))
|
(let ((name (yas/template-name p)))
|
||||||
(insert (make-string (max (- 50 (length name))
|
(insert (propertize (format "%s \\\\snippet `%s'" (car type-and-templates) name) 'yasnippet p))
|
||||||
1) ? ))
|
(insert (make-string (max (- 50 (length name))
|
||||||
(when (yas/template-key p)
|
1) ? ))
|
||||||
(insert (format "key \"%s\" " (yas/template-key p))))
|
(when (yas/template-key p)
|
||||||
(when (yas/template-keybinding p)
|
(insert (format "key \"%s\" " (yas/template-key p))))
|
||||||
(insert (format "bound to %s " (key-description (yas/template-keybinding p)))))
|
(when (yas/template-keybinding p)
|
||||||
(insert "\n")))))
|
(insert (format "bound to %s " (key-description (yas/template-keybinding p)))))
|
||||||
|
(insert "\n"))))))
|
||||||
(setq table-lists (cdr table-lists))
|
(setq table-lists (cdr table-lists))
|
||||||
(when table-lists
|
(when table-lists
|
||||||
(yas/create-snippet-xrefs)
|
(yas/create-snippet-xrefs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user