mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 13:33:04 +00:00
* started attack on template code as well
* still got indenting to do
This commit is contained in:
parent
ad570bf9e5
commit
01c626efbd
32
yasnippet.el
32
yasnippet.el
@ -350,6 +350,25 @@ fetch from parent if any."
|
|||||||
(yas/snippet-table-parent table)
|
(yas/snippet-table-parent table)
|
||||||
key)))
|
key)))
|
||||||
templates))
|
templates))
|
||||||
|
|
||||||
|
(defun yas/snippet-table-all-templates (table)
|
||||||
|
(when table
|
||||||
|
(let ((acc))
|
||||||
|
(maphash #'(lambda (key templates)
|
||||||
|
(setq acc (append acc templates)))
|
||||||
|
(yas/snippet-table-hash table))
|
||||||
|
(append acc
|
||||||
|
(yas/snippet-table-all-templates (yas/snippet-table-parent table))))))
|
||||||
|
|
||||||
|
(defun yas/snippet-table-all-keys (table)
|
||||||
|
(when table
|
||||||
|
(let ((acc))
|
||||||
|
(maphash #'(lambda (key templates)
|
||||||
|
(push key acc))
|
||||||
|
(yas/snippet-table-hash table))
|
||||||
|
(append acc
|
||||||
|
(yas/snippet-table-all-templates (yas/snippet-table-parent table))))))
|
||||||
|
|
||||||
(defun yas/snippet-table-store (table full-key key template)
|
(defun yas/snippet-table-store (table full-key key template)
|
||||||
"Store a snippet template in the table."
|
"Store a snippet template in the table."
|
||||||
(puthash key
|
(puthash key
|
||||||
@ -792,6 +811,19 @@ when the condition evaluated to non-nil."
|
|||||||
(undo 1))
|
(undo 1))
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
|
;; (defun yas/completing-expand ()
|
||||||
|
;; "Choose a snippet to expand, pop-up a list of choices according
|
||||||
|
;; to `yas/popup-function'"
|
||||||
|
;; (let ((keys)
|
||||||
|
;; (choice))
|
||||||
|
;; (maphash #'(lambda (key val)
|
||||||
|
;; (push key keys)) (yas/current-snippet-table))
|
||||||
|
;; (let ((choice (and keys
|
||||||
|
;; (ido-completing-read "Choose: " keys nil nil nil nil (car possibilities))))
|
||||||
|
;; (template (and choice
|
||||||
|
;; (gethash choice (yas/current-snippet-table)))))
|
||||||
|
|
||||||
|
|
||||||
(defun yas/expand ()
|
(defun yas/expand ()
|
||||||
"Expand a snippet."
|
"Expand a snippet."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user