:type '(choice (const :tag "Call previous command" call-other-command)
(const :tag "Do nothing" return-nil))
:group 'yasnippet)
-(make-variable-buffer-local 'yas/fallback-behavior)
(defcustom yas/choose-keys-first nil
"If non-nil, prompt for snippet key first, then for template.
(command-2 (and keys-2 (key-binding keys-2)))
;; An (ugly) safety: prevents infinite recursion of
;; yas/expand* calls.
- (command (or (and (not (string-match "yas/expand" (symbol-name command-1)))
+ (command (or (and (symbolp command-1)
+ (not (string-match "yas/expand" (symbol-name command-1)))
command-1)
- command-2)))
+ (and (symbolp command-2)
+ command-2))))
(when (and (commandp command)
(not (string-match "yas/expand" (symbol-name command))))
(setq this-command command)
(defvar yas/editing-template nil
"Supporting variable for `yas/load-snippet-buffer' and `yas/visit-snippet'")
-(make-variable-buffer-local 'yas/editing-template)
(defvar yas/current-template nil
"Holds the current template being expanded into a snippet.")
(defvar yas/guessed-directories nil
"Supporting variable for `yas/load-snippet-buffer' and `yas/new-snippet'")
-(make-variable-buffer-local 'yas/guessed-directories)
(defun yas/load-snippet-buffer (&optional kill)
"Parse and load current buffer's snippet definition.
(help-xref-button 1 'help-snippet-def template)
(kill-region (match-beginning 0) (match-beginning 1)))))))
+(defun yas/expand-uuid (mode-symbol uuid &optional start end expand-env)
+ "Expand a snippet registered in MODE-SYMBOL's table with UUID.
+
+Remaining args as in `yas/expand-snippet'."
+ (let* ((table (gethash mode-symbol yas/tables))
+ (yas/current-template (and table
+ (gethash uuid (yas/table-uuidhash table)))))
+ (when yas/current-template
+ (yas/expand-snippet (yas/template-content yas/current-template)))))
+
\f
;;; Some hacks:
;; `locate-dominating-file' is added for compatibility in emacs < 23