From: Nikolaj Schumacher Date: Sat, 21 Mar 2009 21:55:50 +0000 (+0100) Subject: Offer more Lisp variables as candidates. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/6cb973ff77b4d0eb1b27f5217b2eac6d317ce2c0 Offer more Lisp variables as candidates. --- diff --git a/company-elisp.el b/company-elisp.el index 341eca807..b3536eb8a 100644 --- a/company-elisp.el +++ b/company-elisp.el @@ -36,7 +36,12 @@ (defvar company-elisp-parse-limit 30) (defvar company-elisp-parse-depth 100) -(defun company-elisp-parse-let (prefix vars) +(defvar company-elisp-binding-regexp + (concat "([ \t\n]*\\_<" (regexp-opt '("let" "defun" "defmacro" "defsubst" + "lambda" "lexical-let")) + "\\*?")) + +(defun company-elisp-parse-local (prefix vars) (let ((regexp (concat "[ \t\n]*\\(" (regexp-quote prefix) "\\(?:\\sw\\|\\s_\\)*\\_>\\)"))) (ignore-errors @@ -44,7 +49,7 @@ (dotimes (i company-elisp-parse-depth) (up-list -1) (save-excursion - (when (looking-at "([ \t\n]*let") + (when (looking-at company-elisp-binding-regexp) (down-list 2) (ignore-errors (dotimes (i company-elisp-parse-limit) @@ -60,7 +65,7 @@ (defun company-elisp-candidates (prefix) (let* ((completion-ignore-case nil) (candidates (all-completions prefix obarray 'company-elisp-predicate))) - (company-elisp-parse-let prefix candidates))) + (company-elisp-parse-local prefix candidates))) (defun company-elisp-doc (symbol) (let* ((symbol (intern symbol)) diff --git a/company.el b/company.el index 9c62ed191..d93a66336 100644 --- a/company.el +++ b/company.el @@ -55,6 +55,8 @@ ;; ;;; Change Log: ;; +;; More local Lisp variables are now included in the candidates. +;; ;; 2009-03-21 (0.1.5) ;; Fixed elisp documentation buffer always showing the same doc. ;; Added `company-echo-strip-common-frontend'.