(defstruct (yas/template (:constructor yas/make-blank-template))
"A template for a snippet."
- table
key
content
name
menu-binding-pair
group ;; as dictated by the #group: directive or .yas-make-groups
perm-group ;; as dictated by `yas/define-menu'
+ table
)
(defun yas/populate-template (template &rest args)
(setq binding (match-string-no-properties 2)))))
(setq template
(buffer-substring-no-properties (point-min) (point-max))))
+ (unless (or key binding)
+ (setq key (and file (file-name-nondirectory file))))
(when (eq type 'command)
(setq template (yas/read-lisp (concat "(progn" template ")"))))
(when group
(defun yas/load-snippet-dirs ()
"Reload the directories listed in `yas/snippet-dirs' or
prompt the user to select one."
- (if yas/snippet-dirs
- (dolist (directory (reverse (yas/snippet-dirs)))
- (yas/load-directory directory))
- (call-interactively 'yas/load-directory)))
+ (let (errors)
+ (if yas/snippet-dirs
+ (dolist (directory (reverse (yas/snippet-dirs)))
+ (condition-case oops
+ (progn
+ (yas/load-directory directory)
+ (message "[yas] Loaded %s" directory))
+ (error (push oops errors)
+ (message "[yas] Check your `yas/snippet-dirs': %s" (second oops)))))
+ (call-interactively 'yas/load-directory))
+ errors))
(defun yas/reload-all (&optional with-jit)
"Reload all snippets and rebuild the YASnippet menu. "
;; Reload the directories listed in `yas/snippet-dirs' or prompt
;; the user to select one.
;;
- (condition-case oops
- (yas/load-snippet-dirs)
- (error (push oops errors)
- (message "[yas] Check your `yas/snippet-dirs': %s" (second oops))))
+ (setq errors (yas/load-snippet-dirs))
;; Reload the direct keybindings
;;
(yas/direct-keymaps-reload)