Created
September 8, 2009 03:17
-
-
Save imakado/182695 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- auto-complete-yasnippet.el.orig 2009-09-08 11:44:45.000000000 +0900 | |
+++ auto-complete-yasnippet.el 2009-09-08 12:05:18.000000000 +0900 | |
@@ -3,21 +3,16 @@ | |
(defun ac-yasnippet-candidate-1 (table) | |
(let ((hashtab (yas/snippet-table-hash table)) | |
- (parent (yas/snippet-table-parent table)) | |
candidates) | |
(maphash (lambda (key value) | |
(push key candidates)) | |
hashtab) | |
- (setq candidates (all-completions ac-prefix (nreverse candidates))) | |
- (if parent | |
- (setq candidates | |
- (append candidates (ac-yasnippet-candidate-1 parent)))) | |
- candidates)) | |
+ (all-completions ac-prefix (nreverse candidates)))) | |
(defun ac-yasnippet-candidate () | |
- (let ((table (yas/snippet-table major-mode))) | |
- (if table | |
- (ac-yasnippet-candidate-1 table)))) | |
+ (let ((tables (yas/get-snippet-tables))) ; yas/get-snippet-tables returns all tables include parent tables. | |
+ (loop for table in tables | |
+ append (ac-yasnippet-candidate-1 table)))) | |
(defface ac-yasnippet-candidate-face | |
'((t (:background "sandybrown" :foreground "black"))) | |
@@ -37,3 +32,17 @@ | |
(provide 'auto-complete-yasnippet) | |
+ | |
+;;; Test | |
+(dont-compile | |
+ (when (fboundp 'expectations) | |
+ (expectations | |
+ (desc "ac-yasnippet-candidate lives ok") | |
+ (expect t | |
+ (cond | |
+ ((ignore-errors | |
+ (let ((ac-prefix "")) | |
+ (ac-yasnippet-candidate))) | |
+ t) | |
+ (t nil)))))) | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment