* Fix issue 160

* Fix issue 159
This commit is contained in:
capitaomorte 2011-05-07 19:39:37 +00:00
parent 7fe4e84f91
commit 98eef1e6f8

View File

@ -3053,9 +3053,7 @@ Also create some protection overlays"
snippet as ordinary text. snippet as ordinary text.
Return a buffer position where the point should be placed if Return a buffer position where the point should be placed if
exiting the snippet. exiting the snippet."
NO-HOOKS means don't run the `yas/after-exit-snippet-hook' hooks."
(let ((control-overlay (yas/snippet-control-overlay snippet)) (let ((control-overlay (yas/snippet-control-overlay snippet))
yas/snippet-beg yas/snippet-beg
@ -3099,6 +3097,13 @@ NO-HOOKS means don't run the `yas/after-exit-snippet-hook' hooks."
(message "[yas] snippet %s exited." (yas/snippet-id snippet))) (message "[yas] snippet %s exited." (yas/snippet-id snippet)))
(defun yas/safely-run-hooks (hook-var)
(condition-case error
(run-hooks hook-var)
(error
(message "[yas] %s error: %s" hook-var (error-message-string error)))))
(defun yas/check-commit-snippet () (defun yas/check-commit-snippet ()
"Checks if point exited the currently active field of the "Checks if point exited the currently active field of the
snippet, if so cleans up the whole snippet up." snippet, if so cleans up the whole snippet up."
@ -3126,10 +3131,10 @@ snippet, if so cleans up the whole snippet up."
(yas/update-mirrors snippet))) (yas/update-mirrors snippet)))
(t (t
nil)))) nil))))
(unless snippets-left (unless (or (null snippets) snippets-left)
(if snippet-exit-transform (if snippet-exit-transform
(yas/eval-lisp-no-saves snippet-exit-transform) (yas/eval-lisp-no-saves snippet-exit-transform))
(run-hooks 'yas/after-exit-snippet-hook))))) (yas/safely-run-hooks 'yas/after-exit-snippet-hook))))
;; Apropos markers-to-points: ;; Apropos markers-to-points:
;; ;;
@ -4105,7 +4110,7 @@ When multiple expressions are found, only the last one counts."
;;; Post-command hooks: ;;; Post-command hooks:
(defvar yas/post-command-runonce-actions nil (defvar yas/post-command-runonce-actions nil
"List of actions to run once `post-command-hook'. "List of actions to run once in `post-command-hook'.
Each element of this list looks like (FN . ARGS) where FN is Each element of this list looks like (FN . ARGS) where FN is
called with ARGS as its arguments after the currently executing called with ARGS as its arguments after the currently executing