branch: master commit f7ef023ebb746ee1597b20d6770fffd106c802f4 Author: João Távora <joaotav...@gmail.com> Commit: João Távora <joaotav...@gmail.com>
Prevent disabling errors from recent `yas-current-syntaxes` logic * yasnippet.el (yas--templates-for-key-at-point): Don't error since this function is called very frequently on TAB. Use new `yas--warning'. (yas--warning): New function. --- yasnippet.el | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index ea5fe33..821e748 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1243,7 +1243,7 @@ Returns (TEMPLATES START END). This function respects 'again) (setq methods (cdr methods)))) (t - (error "[yas] invalid element in `yas-key-syntaxes'"))) + (yas--warning "Warning invalid element %s in `yas-key-syntaxes'" method))) (setq templates (mapcan #'(lambda (table) (yas--fetch table (buffer-substring-no-properties (point) @@ -4366,6 +4366,11 @@ object satisfying `yas--field-p' to restrict the expansion to."))) (when (> yas-verbosity level) (message "%s" (apply #'yas--format message args)))) +(defun yas--warning (format-control &rest format-args) + (let ((msg (apply #'format format-control format-args))) + (display-warning 'yasnippet msg :warning) + (yas--message 1 msg))) + (defun yas--format (format-control &rest format-args) (apply #'format (concat "[yas] " format-control) format-args))