;; Author: Nikolaj Schumacher
;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
-;; Version: 0.6.1
+;; Version: 0.6.2
;; Keywords: abbrev, convenience, matching
;; URL: http://company-mode.github.com/
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x, GNU Emacs 24.x
number where the completion candidate was defined.
`require-match': If this value is t, the user is not allowed to enter anything
-not offering as a candidate. Use with care! The default value nil gives the
+not offered as a candidate. Use with care! The default value nil gives the
user that choice with `company-require-match'. Return value 'never overrides
that option the other way around.
(defcustom company-completion-finished-hook nil
"Hook run when company successfully completes.
-The hook is called with the selected candidate as an argument."
+The hook is called with the selected candidate as an argument.
+
+If you indend to use it to post-process candidates from a specific back-end,
+consider using the `post-completion' command instead."
:group 'company
:type 'hook)
This can also be a function, which is called with the new input and should
return non-nil if company should auto-complete.
-A character that is part of a valid candidate never starts auto-completion."
+A character that is part of a valid candidate never triggers auto-completion."
:group 'company
:type '(choice (string :tag "Characters")
(set :tag "Syntax"
(company-cancel)
(kill-local-variable 'company-point)))
-(define-globalized-minor-mode global-company-mode company-mode
- (lambda () (unless (or noninteractive (eq (aref (buffer-name) 0) ?\s))
- (company-mode 1))))
+;;;###autoload
+(define-globalized-minor-mode global-company-mode company-mode company-mode-on)
+
+(defun company-mode-on ()
+ (unless (or noninteractive (eq (aref (buffer-name) 0) ?\s))
+ (company-mode 1)))
(defsubst company-assert-enabled ()
(unless company-mode
(apply 'company--multi-backend-adapter company-backend args)))
(defun company--multi-backend-adapter (backends command &rest args)
- (let ((backends (remove-if (lambda (b)
- (and (symbolp b)
- (eq 'failed (get b 'company-init))))
- backends)))
+ (let ((backends (loop for b in backends
+ when (not (and (symbolp b)
+ (eq 'failed (get b 'company-init))))
+ collect b)))
(case command
(candidates
(loop for backend in backends
(while c2
(setcdr c2 (progn (while (equal (pop c2) (car c2)))
c2)))))))
- (if (and candidates
- (or (cdr candidates)
- (not (eq t (compare-strings (car candidates) nil nil
- prefix nil nil ignore-case)))))
- candidates
- ;; Already completed and unique; don't start.
- ;; FIXME: Not the right place? maybe when setting?
- (and company-candidates t))))
+ (when candidates
+ (if (or (cdr candidates)
+ (not (eq t (compare-strings (car candidates) nil nil
+ prefix nil nil ignore-case))))
+ candidates
+ ;; Already completed and unique; don't start.
+ t))))
(defun company-idle-begin (buf win tick pos)
(and company-mode
(overlay-get company-pseudo-tooltip-overlay 'company-before))
(overlay-put company-pseudo-tooltip-overlay 'window (selected-window))))
+(defun company-pseudo-tooltip-guard ()
+ (buffer-substring-no-properties
+ (point) (overlay-start company-pseudo-tooltip-overlay)))
+
(defun company-pseudo-tooltip-frontend (command)
"A `company-mode' front-end similar to a tool-tip but based on overlays."
(case command
0))
(new-height (company--pseudo-tooltip-height)))
(unless (and (>= (* old-height new-height) 0)
- (>= (abs old-height) (abs new-height)))
+ (>= (abs old-height) (abs new-height))
+ (equal (company-pseudo-tooltip-guard)
+ (overlay-get company-pseudo-tooltip-overlay
+ 'company-guard)))
;; Redraw needed.
(company-pseudo-tooltip-show-at-point (- (point)
- (length company-prefix)))))
+ (length company-prefix)))
+ (overlay-put company-pseudo-tooltip-overlay
+ 'company-guard (company-pseudo-tooltip-guard))))
(company-pseudo-tooltip-unhide))
(hide (company-pseudo-tooltip-hide)
(setq company-tooltip-offset 0))
(post-command (company-echo-show-when-idle 'company-fetch-metadata))
(hide (company-echo-hide))))
-;; templates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(autoload 'company-template-declare-template "company-template")
-
(provide 'company)
;;; company.el ends here