mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +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)
|
||||
(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 ()
|
||||
(with-temp-buffer
|
||||
(should (= 4 (hash-table-count yas--scheduled-jit-loads)))
|
||||
|
11
yasnippet.el
11
yasnippet.el
@ -699,11 +699,12 @@ and friends."
|
||||
(push mode explored)
|
||||
(cons mode
|
||||
(loop for neighbour
|
||||
in (remove nil (cons (get mode
|
||||
'derived-mode-parent)
|
||||
(gethash mode yas--parents)))
|
||||
|
||||
unless (memq neighbour explored)
|
||||
in (cl-list* (get mode 'derived-mode-parent)
|
||||
(ignore-errors (symbol-function mode))
|
||||
(gethash mode yas--parents))
|
||||
when (and neighbour
|
||||
(not (memq neighbour explored))
|
||||
(symbolp neighbour))
|
||||
append (funcall dfs neighbour explored)))))
|
||||
(remove-duplicates (append yas--extra-modes
|
||||
(funcall dfs major-mode)))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user