"Given a symbol, `yas-activate-extra-mode' should be able to
add the snippets associated with the given mode."
(with-temp-buffer
- (emacs-lisp-mode)
- (yas-minor-mode-on)
- (yas-activate-extra-mode 'markdown-mode)
- (should (eq 'markdown-mode (car yas--extra-modes)))
- (yas-should-expand '(("_" . "_Text_ ")))
- (yas-should-expand '(("car" . "(car )")))))
-
-(ert-deftest test-yas-deactivate-extra-modes ()
- "Given a symbol, `yas-deactive-extra-mode' should be able to
-remove one of the extra modes that is present in the current
-buffer."
- (with-temp-buffer
- (emacs-lisp-mode)
- (yas-minor-mode-on)
- (yas-activate-extra-mode 'markdown-mode)
- (should (eq 'markdown-mode (car yas--extra-modes)))
- (yas-deactivate-extra-mode 'markdown-mode)
- (should-not (eq 'markdown-mode (car yas--extra-modes)))
- (yas-should-not-expand '("_"))
- (yas-should-expand '(("car" . "(car )")))))
+ (yas-saving-variables
+ (yas-with-snippet-dirs
+ '((".emacs.d/snippets"
+ ("markdown-mode"
+ ("_" . "_Text_ "))
+ ("emacs-lisp-mode"
+ ("car" . "(car )"))))
+ (yas-reload-all)
+ (emacs-lisp-mode)
+ (yas-minor-mode-on)
+ (yas-activate-extra-mode 'markdown-mode)
+ (should (eq 'markdown-mode (car yas--extra-modes)))
+ (yas-should-expand '(("_" . "_Text_ ")))
+ (yas-should-expand '(("car" . "(car )")))
+ (yas-deactivate-extra-mode 'markdown-mode)
+ (should-not (eq 'markdown-mode (car yas--extra-modes)))
+ (yas-should-not-expand '("_"))
+ (yas-should-expand '(("car" . "(car )")))))))
\f
;;; Helpers
(when (not (string= "" symbol))
(intern symbol)))))
(when mode
- (make-variable-buffer-local 'yas--extra-modes)
- (add-to-list 'yas--extra-modes mode)
+ (add-to-list (make-local-variable 'yas--extra-modes) mode)
(yas--load-pending-jits)))
(defun yas-deactivate-extra-mode (mode)
(list (intern
(completing-read
"Deactivate mode: " (mapcar #'list yas--extra-modes) nil t))))
- (setq yas--extra-modes
- (remove mode
- yas--extra-modes)))
+ (set (make-local-variable 'yas--extra-modes)
+ (remove mode
+ yas--extra-modes)))
(defvar yas-dont-activate '(minibufferp)
"If non-nil don't let `yas-global-mode' affect some buffers.