]> code.delx.au - gnu-emacs-elpa/blobdiff - company-elisp.el
Release 0.6.5
[gnu-emacs-elpa] / company-elisp.el
index c862edb8c57d300dc29958bba7314d0478fb7bcd..e4baca1706ef7791b2e2497d30ec84d9596ff30a 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-elisp.el --- A company-mode completion back-end for emacs-lisp-mode
+;;; company-elisp.el --- A company-mode completion back-end for emacs-lisp-mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 2009, 2011-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011-2013  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
@@ -113,7 +113,10 @@ first in the candidates list.")
 (defun company-elisp-candidates (prefix)
   (let* ((predicate (company-elisp-candidates-predicate prefix))
          (locals (company-elisp-locals prefix (eq predicate 'fboundp)))
-         (globals (company-elisp-globals prefix predicate)))
+         (globals (company-elisp-globals prefix predicate))
+         (locals (loop for local in locals
+                       when (not (member local globals))
+                       collect local)))
     (if company-elisp-show-locals-first
         (append (sort locals 'string<)
                 (sort globals 'string<))
@@ -132,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)))