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.
This commit is contained in:
João Távora 2014-08-20 20:23:00 +01:00
parent e60e8b5551
commit f7ef023ebb

View File

@ -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))