mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
allow yas/dont-activate to take list of functions with default being (minibufferp)
- This allows the user to configure whether yasnippet should be enabled in minibuffer while preserving the current default.
This commit is contained in:
parent
5ed6adadce
commit
6b841dd247
16
yasnippet.el
16
yasnippet.el
@ -812,9 +812,14 @@ Key bindings:
|
|||||||
(remove-hook 'emulation-mode-map-alists 'yas/direct-keymaps))))
|
(remove-hook 'emulation-mode-map-alists 'yas/direct-keymaps))))
|
||||||
|
|
||||||
|
|
||||||
(defvar yas/dont-activate nil
|
(defvar yas/dont-activate '(minibufferp)
|
||||||
"If non-nil don't let `yas/minor-mode-on' active yas for this buffer.
|
"If non-nil don't let `yas/minor-mode-on' active yas for this buffer.
|
||||||
|
|
||||||
|
If a function, then its result is used.
|
||||||
|
|
||||||
|
If a list of functions, then all functions must return nil to
|
||||||
|
activate yas for this buffer.
|
||||||
|
|
||||||
`yas/minor-mode-on' is usually called by `yas/global-mode' so
|
`yas/minor-mode-on' is usually called by `yas/global-mode' so
|
||||||
this effectively lets you define exceptions to the \"global\"
|
this effectively lets you define exceptions to the \"global\"
|
||||||
behaviour. Can also be a function of zero arguments.")
|
behaviour. Can also be a function of zero arguments.")
|
||||||
@ -825,10 +830,11 @@ behaviour. Can also be a function of zero arguments.")
|
|||||||
|
|
||||||
Do this unless `yas/dont-activate' is truish "
|
Do this unless `yas/dont-activate' is truish "
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (or (minibufferp)
|
(unless (cond ((functionp yas/dont-activate)
|
||||||
(if (functionp yas/dont-activate)
|
(funcall yas/dont-activate))
|
||||||
(funcall yas/dont-activate)
|
((consp yas/dont-activate)
|
||||||
yas/dont-activate))
|
(some #'funcall yas/dont-activate))
|
||||||
|
(yas/dont-activate))
|
||||||
;; Load all snippets definitions unless we still don't have a
|
;; Load all snippets definitions unless we still don't have a
|
||||||
;; root-directory or some snippets have already been loaded.
|
;; root-directory or some snippets have already been loaded.
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user