]> code.delx.au - gnu-emacs-elpa/commitdiff
add dropdown-list.el support.
authorZhang Chiyuan <pluskid@gmail.com>
Sun, 16 Mar 2008 01:43:39 +0000 (01:43 +0000)
committerZhang Chiyuan <pluskid@gmail.com>
Sun, 16 Mar 2008 01:43:39 +0000 (01:43 +0000)
yasnippet.el

index 7da2c1a481a7addfeda0746f73997a96948eb76a..67ed7fe5ec4374fa9ae5dd4b942e56c776921a7e 100644 (file)
@@ -721,6 +721,20 @@ t is returned simply."
 (defun yas/text-popup-for-template (templates)
   "Can't display popup menu in text mode. Just select the first one."
   (yas/template-content (cdar templates)))
+(defun yas/dropdown-list-popup-for-template (templates)
+  "Use dropdown-list.el to popup for templates. Better than the 
+default \"select first\" behavior of `yas/text-popup-for-template'.
+You can also use this in window-system.
+
+NOTE: You need to download and install dropdown-list.el to use this."
+  (if (fboundp 'dropdown-list)
+      (yas/template-content
+       (cdr (nth (dropdown-list (mapcar (lambda (i)
+                                         (yas/template-name
+                                          (cdr i)))
+                                       templates))
+                templates)))
+    (error "Please download and install dropdown-list.el to use this")))
 
 (defun yas/popup-for-template (templates)