mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Extra measures to prevent premature yas-minor-mode
The user's hooks may try to enable yas-minor-mode before yasnippet.el has finished loading. In [1], we catch and ignore the errors arising from this, but it's better if we can avoid hitting the error in the first place. This means we have 3 separate measures to avoid the problem, but since this bug can leave Emacs unusable due to a failing post-command-hook, a bit of redundant safety is not a bad thing. * yasnippet.el (yas-minor-mode): Only turn on if yasnippet is fully loaded. (yas--font-lock-keywords): Disable user hooks. [1]: "Avoid potential problems with user's hooks" 4c6064ce1aff07fe4481b5e2d987c8a7f044c207
This commit is contained in:
parent
1b8f5b7a72
commit
0d79e6988e
@ -776,7 +776,7 @@ Key bindings:
|
||||
;; The indicator for the mode line.
|
||||
" yas"
|
||||
:group 'yasnippet
|
||||
(cond (yas-minor-mode
|
||||
(cond ((and yas-minor-mode (featurep 'yasnippet))
|
||||
;; Install the direct keymaps in `emulation-mode-map-alists'
|
||||
;; (we use `add-hook' even though it's not technically a hook,
|
||||
;; but it works). Then define variables named after modes to
|
||||
@ -884,7 +884,9 @@ Honour `yas-dont-activate-functions', which see."
|
||||
(defvar yas--font-lock-keywords
|
||||
(append '(("^#.*$" . font-lock-comment-face))
|
||||
(with-temp-buffer
|
||||
(ignore-errors (emacs-lisp-mode))
|
||||
(let ((prog-mode-hook nil)
|
||||
(emacs-lisp-mode-hook nil))
|
||||
(ignore-errors (emacs-lisp-mode)))
|
||||
(font-lock-set-defaults)
|
||||
(if (eq t (car-safe font-lock-keywords))
|
||||
;; They're "compiled", so extract the source.
|
||||
|
Loading…
x
Reference in New Issue
Block a user