;;
;; Copyright (C) 2009 Nikolaj Schumacher
;;
-;; This file is part of company 0.2.
+;; This file is part of company 0.3.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
(require 'company)
(eval-when-compile (require 'cl))
+(require 'help-mode)
(defcustom company-elisp-detect-function-context t
"*If enabled, offer lisp functions only in appropriate contexts.
:type '(choice (const :tag "Off" nil)
(const :tag "On" t)))
-(defvar company-lisp-symbol-regexp
- "\\_<\\(\\sw\\|\\s_\\)+\\_>\\=")
-
(defun company-grab-lisp-symbol ()
- (let ((prefix (or (company-grab company-lisp-symbol-regexp) "")))
- (unless (and (company-in-string-or-comment (- (point) (length prefix)))
+ (let ((prefix (company-grab-symbol)))
+ (unless (and (company-in-string-or-comment)
(/= (char-before (- (point) (length prefix))) ?`))
prefix)))
(string-match ".*$" doc)
(match-string 0 doc))))
+;;;###autoload
(defun company-elisp (command &optional arg &rest ignored)
"A `company-mode' completion back-end for `emacs-lisp-mode'."
+ (interactive (list 'interactive))
(case command
+ ('interactive (company-begin-backend 'company-elisp))
('prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
- (company-grab-lisp-symbol)))
+ (or (company-grab-lisp-symbol) 'stop)))
('candidates (company-elisp-candidates arg))
('meta (company-elisp-doc arg))
('doc-buffer (let ((symbol (intern arg)))