]> code.delx.au - gnu-emacs-elpa/commitdiff
company-elisp-candidates-predicate: Blacklist specific special forms
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 29 Mar 2013 09:58:22 +0000 (13:58 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 29 Mar 2013 09:58:22 +0000 (13:58 +0400)
company-elisp.el
company-tests.el

index eec64f44ee3fa22657d4c7eee915da01e7cedafe..e685c2f41dc5a581c7cf8dad462c0c8680cf535f 100644 (file)
@@ -135,8 +135,12 @@ first in the candidates list.")
                   (save-excursion
                     (ignore-errors
                       (up-list -2)
-                      (forward-char 1)
-                      (looking-at " *(")))))
+                      (and (save-excursion
+                             (forward-char 1)
+                             (looking-at "[ \t\n]*("))
+                           (prog1 (search-backward "(")
+                             (forward-char 1))
+                           (looking-at company-elisp-var-binding-regexp))))))
             'fboundp
           'boundp)
       'company-elisp-predicate)))
index 4fcb83c4bf582897255380a87ef52f8888eb4dd8..d053965c4646591d9f8f501302c69f629c5a6021 100644 (file)
 
 ;; This one's also an integration test.
 (ert-deftest company-elisp-candidates-recognizes-binding-form ()
-  (company-elisp-with-buffer
-    "(let ((foo 7) (wh| )))"
-    (let ((obarray [when what whelp])
-          (what 1)
-          (whelp 2)
-          (wisp 3))
+  (let ((company-elisp-detect-function-context t)
+        (obarray [when what whelp])
+        (what 1)
+        (whelp 2)
+        (wisp 3))
+    (company-elisp-with-buffer
+      "(let ((foo 7) (wh| )))"
       (should (equal '("what" "whelp")
-                     (let ((company-elisp-detect-function-context t))
-                       (company-elisp-candidates "wh")))))))
+                     (company-elisp-candidates "wh"))))
+    (company-elisp-with-buffer
+      "(cond ((null nil) (wh| )))"
+      (should (equal '("when")
+                     (company-elisp-candidates "wh"))))))
 
 (ert-deftest company-elisp-finds-vars ()
   (let ((obarray [boo bar baz backquote])