before expansion hook

This commit is contained in:
Zhang Chiyuan 2008-03-20 08:11:39 +00:00
parent b2c59c0722
commit 33c0cd5fe1

View File

@ -120,9 +120,7 @@ proper values:
(defvar yas/before-expand-snippet-hook (defvar yas/before-expand-snippet-hook
'() '()
"Hooks to run after a before expanding a snippet. "Hooks to run after a before expanding a snippet.")
If you move the cursor (e.g. call `re-search-forward') in this hook,
please wrap it with `save-excursion', or else yanippet will get confused.")
(defvar yas/buffer-local-condition t (defvar yas/buffer-local-condition t
"Condition to yasnippet local to each buffer. "Condition to yasnippet local to each buffer.
@ -517,6 +515,8 @@ redo-ed."
(defun yas/expand-snippet (start end template) (defun yas/expand-snippet (start end template)
"Expand snippet at current point. Text between START and END "Expand snippet at current point. Text between START and END
will be deleted before inserting template." will be deleted before inserting template."
(run-hooks 'yas/before-expand-snippet-hook)
(goto-char start) (goto-char start)
(let ((key (buffer-substring-no-properties start end)) (let ((key (buffer-substring-no-properties start end))