]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/company/company-elisp.el
company: Release 0.6.7
[gnu-emacs-elpa] / packages / company / company-elisp.el
index faab0b0decd848819210361d7fe40bed914cbe62..338acc544e24068ccbaa3b977833df647aff2f5b 100644 (file)
@@ -157,24 +157,29 @@ first in the candidates list."
 
 (defun company-elisp--candidates-predicate (prefix)
   (let* ((completion-ignore-case nil)
-         (before (char-before (- (point) (length prefix)))))
+         (beg (- (point) (length prefix)))
+         (before (char-before beg)))
     (if (and company-elisp-detect-function-context
-             (not (eq before ?')))
+             (not (memq before '(?' ?`))))
         (if (and (eq before ?\()
                  (not
                   (save-excursion
                     (ignore-errors
-                      (up-list -2)
-                      (and (save-excursion
-                             (forward-char 1)
-                             (looking-at "[ \t\n]*("))
-                           (prog1 (search-backward "(")
-                             (forward-char 1))
-                           (looking-at company-elisp-var-binding-regexp))))))
+                      (goto-char (1- beg))
+                      (or (company-elisp--before-binding-varlist-p)
+                          (progn
+                            (up-list -1)
+                            (company-elisp--before-binding-varlist-p)))))))
             'fboundp
           'boundp)
       'company-elisp--predicate)))
 
+(defun company-elisp--before-binding-varlist-p ()
+  (save-excursion
+    (and (prog1 (search-backward "(")
+           (forward-char 1))
+         (looking-at company-elisp-var-binding-regexp))))
+
 (defun company-elisp--doc (symbol)
   (let* ((symbol (intern symbol))
          (doc (if (fboundp symbol)