mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* yasnippet-tests.el (issue-492-and-494): New test. * yasnippet.el (yas--modes-to-activate): Consider each mode's symbol-function as a neighbour in case it's a symbol as well.
This commit is contained in:
parent
2b24aeaf80
commit
0b7b34a333
@ -426,6 +426,24 @@ TODO: correct this bug!"
|
|||||||
(should (= (length expected)
|
(should (= (length expected)
|
||||||
(length observed))))))))
|
(length observed))))))))
|
||||||
|
|
||||||
|
(ert-deftest issue-492-and-494 ()
|
||||||
|
(defalias 'yas--phony-c-mode 'c-mode)
|
||||||
|
(define-derived-mode yas--test-mode yas--phony-c-mode "Just a test mode")
|
||||||
|
(yas-with-snippet-dirs '((".emacs.d/snippets"
|
||||||
|
("yas--test-mode")))
|
||||||
|
(yas-reload-all)
|
||||||
|
(with-temp-buffer
|
||||||
|
(let* ((major-mode 'yas--test-mode)
|
||||||
|
(expected `(c-mode
|
||||||
|
,@(if (fboundp 'prog-mode)
|
||||||
|
'(prog-mode))
|
||||||
|
yas--phony-c-mode
|
||||||
|
yas--test-mode))
|
||||||
|
(observed (yas--modes-to-activate)))
|
||||||
|
(should (null (cl-set-exclusive-or expected observed)))
|
||||||
|
(should (= (length expected)
|
||||||
|
(length observed)))))))
|
||||||
|
|
||||||
(defun yas--basic-jit-loading-1 ()
|
(defun yas--basic-jit-loading-1 ()
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(should (= 4 (hash-table-count yas--scheduled-jit-loads)))
|
(should (= 4 (hash-table-count yas--scheduled-jit-loads)))
|
||||||
|
11
yasnippet.el
11
yasnippet.el
@ -699,11 +699,12 @@ and friends."
|
|||||||
(push mode explored)
|
(push mode explored)
|
||||||
(cons mode
|
(cons mode
|
||||||
(loop for neighbour
|
(loop for neighbour
|
||||||
in (remove nil (cons (get mode
|
in (cl-list* (get mode 'derived-mode-parent)
|
||||||
'derived-mode-parent)
|
(ignore-errors (symbol-function mode))
|
||||||
(gethash mode yas--parents)))
|
(gethash mode yas--parents))
|
||||||
|
when (and neighbour
|
||||||
unless (memq neighbour explored)
|
(not (memq neighbour explored))
|
||||||
|
(symbolp neighbour))
|
||||||
append (funcall dfs neighbour explored)))))
|
append (funcall dfs neighbour explored)))))
|
||||||
(remove-duplicates (append yas--extra-modes
|
(remove-duplicates (append yas--extra-modes
|
||||||
(funcall dfs major-mode)))))
|
(funcall dfs major-mode)))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user