From: Nikolaj Schumacher Date: Sun, 5 Apr 2009 10:09:58 +0000 (+0200) Subject: Don't add incomplete text as elisp candidate. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/c1ee06620f0af633e6dc51cc5590890c232e6af6 Don't add incomplete text as elisp candidate. --- diff --git a/company-elisp.el b/company-elisp.el index c26e16ee0..c03ebf685 100644 --- a/company-elisp.el +++ b/company-elisp.el @@ -55,7 +55,8 @@ Functions are offered for completion only after ' and \(." (defun company-elisp-parse-local (prefix vars) (let ((regexp (concat "[ \t\n]*\\(\\_<" (regexp-quote prefix) - "\\(?:\\sw\\|\\s_\\)*\\_>\\)"))) + "\\(?:\\sw\\|\\s_\\)*\\_>\\)")) + (pos (point))) (ignore-errors (save-excursion (dotimes (i company-elisp-parse-depth) @@ -69,13 +70,17 @@ Functions are offered for completion only after ' and \(." (save-excursion (when (looking-at "[ \t\n]*(") (down-list 1)) - (when (looking-at regexp) - (add-to-list 'vars (match-string-no-properties 1)))) + (and (looking-at regexp) + ;; Don't add incomplete text as candidate. + (not (eq (match-end 0) pos)) + (add-to-list 'vars (match-string-no-properties 1)))) (forward-sexp)))) ((looking-at company-elisp-binding-regexp-1) (down-list 2) - (when (looking-at regexp) - (add-to-list 'vars (match-string-no-properties 1))))))))) + (and (looking-at regexp) + ;; Don't add incomplete text as candidate. + (not (eq (match-end 0) pos)) + (add-to-list 'vars (match-string-no-properties 1))))))))) vars)) (defun company-elisp-candidates (prefix)