[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e3f03ca 21/60: Test visiting compiled snippets
From: |
João Távora |
Subject: |
[elpa] master e3f03ca 21/60: Test visiting compiled snippets |
Date: |
Thu, 21 Jan 2016 22:35:55 +0000 |
branch: master
commit e3f03cabe01c3d218bc921b90f8946d5621efb8c
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Test visiting compiled snippets
* yasnippet-tests.el (visiting-compiled-snippets): New Test.
* yasnippet.el (yas--lookup-snippet-1, yas-lookup-snippet): Split new
function yas--lookup-snippet-1 from yas-lookup-snippet.
---
yasnippet-tests.el | 16 +++++++++++++++-
yasnippet.el | 14 +++++++++-----
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 0b14a56..a59cdf7 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -449,7 +449,7 @@ TODO: correct this bug!"
(yas--basic-jit-loading-1)))
(ert-deftest basic-jit-loading-with-compiled-snippets ()
- "Test basic loading and expansion of snippets"
+ "Test basic loading and expansion of compiled snippets"
(yas-with-some-interesting-snippet-dirs
(yas-reload-all)
(yas-recompile-all)
@@ -459,6 +459,20 @@ TODO: correct this bug!"
(yas-reload-all)
(yas--basic-jit-loading-1))))
+(ert-deftest visiting-compiled-snippets ()
+ "Test snippet visiting for compiled snippets."
+ (yas-with-some-interesting-snippet-dirs
+ (yas-recompile-all)
+ (yas-reload-all 'no-jit) ; must be loaded for `yas-lookup-snippet' to work.
+ (yas--with-temporary-redefinitions ((find-file-noselect
+ (filename &rest _)
+ (throw 'yas-snippet-file filename)))
+ (should (string-suffix-p
+ "cc-mode/def"
+ (catch 'yas-snippet-file
+ (yas--visit-snippet-file-1
+ (yas--lookup-snippet-1 "def" 'cc-mode))))))))
+
(ert-deftest loading-with-cyclic-parenthood ()
"Test loading when cyclic parenthood is setup."
(yas-saving-variables
diff --git a/yasnippet.el b/yasnippet.el
index 1fd08e2..ff46811 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2296,6 +2296,14 @@ Honours `yas-choose-tables-first',
`yas-choose-keys-first' and
(remove-duplicates (mapcan #'yas--table-templates tables)
:test #'equal))))
+(defun yas--lookup-snippet-1 (name mode)
+ "Get the snippet called NAME in MODE's tables."
+ (let ((yas-choose-tables-first nil) ; avoid prompts
+ (yas-choose-keys-first nil))
+ (cl-find name (yas--all-templates
+ (yas--get-snippet-tables mode))
+ :key #'yas--template-name :test #'string=)))
+
(defun yas-lookup-snippet (name &optional mode noerror)
"Get the snippet content for the snippet NAME in MODE's tables.
@@ -2304,11 +2312,7 @@ is non-nil, then don't signal an error if there isn't
any snippet
called NAME.
Honours `yas-buffer-local-condition'."
- (let* ((yas-choose-tables-first nil) ; avoid prompts
- (yas-choose-keys-first nil)
- (snippet (cl-find name (yas--all-templates
- (yas--get-snippet-tables mode))
- :key #'yas--template-name :test #'string=)))
+ (let ((snippet (yas--lookup-snippet-1 name mode)))
(cond
(snippet (yas--template-content snippet))
(noerror nil)
- [elpa] master 2f6cfef 17/60: Closes #601: updated snippets submodule, (continued)
- [elpa] master 2f6cfef 17/60: Closes #601: updated snippets submodule, João Távora, 2016/01/21
- [elpa] master 68b0ab6 20/60: Accept documented snippet list formats, João Távora, 2016/01/21
- [elpa] master cc1c758 18/60: Reorganize snippet construction from list code, João Távora, 2016/01/21
- [elpa] master 01139a2 23/60: * yasnippet.el (yas--define-snippets-2): Use file-name-NONdirectory., João Távora, 2016/01/21
- [elpa] master 8df6a6e 25/60: Fix invalid yas-key-syntaxes element warning, João Távora, 2016/01/21
- [elpa] master 7703a55 24/60: * doc/snippet-organization.org (.yas-skip): Add info., João Távora, 2016/01/21
- [elpa] master 041821a 22/60: * yasnippet-tests.el (string-suffix-p): Define for older Emacsen., João Távora, 2016/01/21
- [elpa] master fb6ec67 29/60: Fix #619; find parents for extra-modes too, João Távora, 2016/01/21
- [elpa] master 710ea4d 26/60: Update snippets module, João Távora, 2016/01/21
- [elpa] master 215ad9b 19/60: Fix #597; use SAVE-FILE to visit compiled snippets, João Távora, 2016/01/21
- [elpa] master e3f03ca 21/60: Test visiting compiled snippets,
João Távora <=
- [elpa] master e56aa6f 28/60: Build a single `explored' list., João Távora, 2016/01/21
- [elpa] master b6d924c 31/60: * yasnippet.el (yas--scan-sexps): Use ignore-errors., João Távora, 2016/01/21
- [elpa] master 00b84ce 27/60: Add (failing) yas--modes-to-activate test, João Távora, 2016/01/21
- [elpa] master 72c6c4c 32/60: Fix #618; save match data in yas--scan-sexps, João Távora, 2016/01/21
- [elpa] master ac3fe83 30/60: Merge pull request #621 from npostavs/dfs-extra-modes2, João Távora, 2016/01/21
- [elpa] master b8687bb 35/60: Avoid double snippet loading messages, João Távora, 2016/01/21
- [elpa] master 35642ac 33/60: Simplify string matching., João Távora, 2016/01/21
- [elpa] master b055f13 34/60: Fix #617; ensure point is visible before x prompt, João Távora, 2016/01/21
- [elpa] master f121645 38/60: Fix #607; avoid Emacs bug #21824, João Távora, 2016/01/21
- [elpa] master 1cf723a 41/60: Ignore trailing spaces in snippet definitions, João Távora, 2016/01/21