From 8b956d6a100f9a9db2c0bd45c79c28830dcfba7c Mon Sep 17 00:00:00 2001 From: Nikolaj Schumacher Date: Fri, 27 Mar 2009 21:23:30 +0100 Subject: [PATCH] Added company-elisp-detect-function-context option. --- company-elisp.el | 11 +++++------ company.el | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/company-elisp.el b/company-elisp.el index b77851e18..4f8df83ad 100644 --- a/company-elisp.el +++ b/company-elisp.el @@ -20,12 +20,12 @@ (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_\\)+\\_>\\=") @@ -72,7 +72,7 @@ Functions are offered for completion only after ' and \(." (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 @@ -91,8 +91,7 @@ Functions are offered for completion only after ' and \(." (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))) diff --git a/company.el b/company.el index ea482c7e0..99570b94b 100644 --- a/company.el +++ b/company.el @@ -56,7 +56,7 @@ ;; ;;; 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) -- 2.39.2