From 380ef3e4b3907c5f4a203947f38bebe4c0498c4c Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 8 Mar 2017 13:41:14 +0100 Subject: Upgrade mod-php and yasnippet --- .emacs.d/lisp/yasnippet.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to '.emacs.d/lisp/yasnippet.el') diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 7b871b9..76e1d25 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el @@ -1352,7 +1352,7 @@ Returns (TEMPLATES START END). This function respects ((debug error) (cdr oops))))) (defun yas--eval-for-effect (form) - (yas--safely-run-hook (apply-partially #'eval form))) + (yas--safely-call-fun (apply-partially #'eval form))) (defun yas--read-lisp (string &optional nil-on-error) "Read STRING as a elisp expression and return it. @@ -3336,18 +3336,19 @@ This renders the snippet as ordinary text." (setq yas--snippets-to-move nil)) (defun yas--safely-call-fun (fun) + "Call FUN and catch any errors." (condition-case error (funcall fun) ((debug error) - (yas--message 2 "Error running %s: %s" - (if (symbolp fun) fun "a hook") + (yas--message 2 "Error running %s: %s" fun (error-message-string error))))) (defun yas--safely-run-hook (hook) + "Call HOOK's functions. +HOOK should be a symbol, a hook variable, as in `run-hooks'." (let ((debug-on-error (and (not (memq yas-good-grace '(t hooks))) debug-on-error))) - (if (functionp hook) (yas--safely-call-fun hook) - (mapc #'yas--safely-call-fun hook)))) + (yas--safely-call-fun (apply-partially #'run-hooks hook)))) (defun yas--check-commit-snippet () "Check if point exited the currently active field of the snippet. @@ -3355,7 +3356,9 @@ This renders the snippet as ordinary text." If so cleans up the whole snippet up." (let* ((snippets (yas-active-snippets 'all)) (snippets-left snippets) - (snippet-exit-transform nil) + (snippet-exit-transform) + ;; Record the custom snippet `yas-after-exit-snippet-hook' + ;; set in the expand-env field. (snippet-exit-hook yas-after-exit-snippet-hook)) (dolist (snippet snippets) (let ((active-field (yas--snippet-active-field snippet))) @@ -3383,9 +3386,10 @@ If so cleans up the whole snippet up." (t nil))))) (unless (or (null snippets) snippets-left) - (if snippet-exit-transform - (yas--eval-for-effect snippet-exit-transform)) - (yas--safely-run-hook snippet-exit-hook)))) + (when snippet-exit-transform + (yas--eval-for-effect snippet-exit-transform)) + (let ((yas-after-exit-snippet-hook snippet-exit-hook)) + (yas--safely-run-hook 'yas-after-exit-snippet-hook))))) ;; Apropos markers-to-points: ;; -- cgit v1.3