(require 'company)
(eval-when-compile (require 'cl))
-(defcustom company-elisp-functions-only-in-context nil
+(defcustom company-elisp-detect-function-context t
"*If enabled, offer lisp functions only in appropriate contexts.
Functions are offered for completion only after ' and \(."
:group 'company
- :type '(choice (const :tag "off (nil)" nil)
- (integer :tag "count" t)))
+ :type '(choice (const :tag "Off" nil)
+ (const :tag "On" t)))
(defvar company-lisp-symbol-regexp
"\\_<\\(\\sw\\|\\s_\\)+\\_>\\=")
(defun company-elisp-candidates (prefix)
(let* ((completion-ignore-case nil)
(before (char-before (- (point) (length prefix))))
- (predicate (if (and company-elisp-functions-only-in-context
+ (predicate (if (and company-elisp-detect-function-context
(not (eq before ?')))
(if (eq before ?\()
'fboundp
(match-string 0 doc))))
(defun company-elisp (command &optional arg &rest ignored)
- "A `company-mode' completion back-end for `emacs-lisp-mode'.
-See `company-elisp-functions-only-in-context'."
+ "A `company-mode' completion back-end for `emacs-lisp-mode'."
(case command
('prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
(company-grab-lisp-symbol)))
;;
;;; Change Log:
;;
-;; Added `company-elisp-functions-only-in-context' option.
+;; Added `company-elisp-detect-function-context' option.
;; The mouse can now be used for selection.
;;
;; 2009-03-22 (0.2)