mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Closes #527: Unbreak case where yas-fallback-behaviour is a list
* yasnippet.el (yas--fallback): Extract interesting values from `yas-fallback-behaviour' before rebinding.
This commit is contained in:
parent
70151f4f1e
commit
6053db05ca
17
yasnippet.el
17
yasnippet.el
@ -289,7 +289,7 @@ next field"
|
|||||||
`yas-expand' returns nil)
|
`yas-expand' returns nil)
|
||||||
|
|
||||||
- A Lisp form (apply COMMAND . ARGS) means interactively call
|
- A Lisp form (apply COMMAND . ARGS) means interactively call
|
||||||
COMMAND, if ARGS is non-nil, call COMMAND non-interactively
|
COMMAND. If ARGS is non-nil, call COMMAND non-interactively
|
||||||
with ARGS as arguments."
|
with ARGS as arguments."
|
||||||
:type '(choice (const :tag "Call previous command" call-other-command)
|
:type '(choice (const :tag "Call previous command" call-other-command)
|
||||||
(const :tag "Do nothing" return-nil))
|
(const :tag "Do nothing" return-nil))
|
||||||
@ -2269,14 +2269,15 @@ Common gateway for `yas-expand-from-trigger-key' and
|
|||||||
((and (listp yas-fallback-behavior)
|
((and (listp yas-fallback-behavior)
|
||||||
(cdr yas-fallback-behavior)
|
(cdr yas-fallback-behavior)
|
||||||
(eq 'apply (car yas-fallback-behavior)))
|
(eq 'apply (car yas-fallback-behavior)))
|
||||||
(let ((yas-fallback-behavior 'yas--fallback)
|
(let ((command-or-fn (cadr yas-fallback-behavior))
|
||||||
|
(args (cddr yas-fallback-behavior))
|
||||||
|
(yas-fallback-behavior 'yas--fallback)
|
||||||
(yas-minor-mode nil))
|
(yas-minor-mode nil))
|
||||||
(if (cddr yas-fallback-behavior)
|
(if args
|
||||||
(apply (cadr yas-fallback-behavior)
|
(apply command-or-fn args)
|
||||||
(cddr yas-fallback-behavior))
|
(when (commandp command-or-fn)
|
||||||
(when (commandp (cadr yas-fallback-behavior))
|
(setq this-command command-or-fn)
|
||||||
(setq this-command (cadr yas-fallback-behavior))
|
(call-interactively command-or-fn)))))
|
||||||
(call-interactively (cadr yas-fallback-behavior))))))
|
|
||||||
(t
|
(t
|
||||||
;; also return nil if all the other fallbacks have failed
|
;; also return nil if all the other fallbacks have failed
|
||||||
nil)))
|
nil)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user