-;;; company.el --- Modular in-buffer completion framework
+;;; company.el --- Modular in-buffer completion framework -*- lexical-binding: t -*-
;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
;; Author: Nikolaj Schumacher
;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
-;; Version: 0.6.2
+;; Version: 0.6.7
;; Keywords: abbrev, convenience, matching
;; URL: http://company-mode.github.com/
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x, GNU Emacs 24.x
:group 'matching)
(defface company-tooltip
- '((t :background "yellow"
- :foreground "black"))
+ '((default :foreground "black")
+ (((class color) (min-colors 88) (background light))
+ (:background "cornsilk"))
+ (((class color) (min-colors 88) (background dark))
+ (:background "yellow")))
"Face used for the tool tip."
:group 'company)
(defface company-tooltip-selection
'((default :inherit company-tooltip)
- (((class color) (min-colors 88)) (:background "orange1"))
+ (((class color) (min-colors 88) (background light))
+ (:background "light blue"))
+ (((class color) (min-colors 88) (background dark))
+ (:background "orange1"))
(t (:background "green")))
"Face used for the selection in the tool tip."
:group 'company)
:group 'company)
(defface company-tooltip-common
- '((t :inherit company-tooltip
- :foreground "red"))
+ '((default :inherit company-tooltip)
+ (((background light))
+ :foreground "darkred")
+ (((background dark))
+ :foreground "red"))
"Face used for the common completion in the tool tip."
:group 'company)
(defface company-tooltip-common-selection
- '((t :inherit company-tooltip-selection
- :foreground "red"))
+ '((default :inherit company-tooltip-selection)
+ (((background light))
+ :foreground "darkred")
+ (((background dark))
+ :foreground "red"))
"Face used for the selected common completion in the tool tip."
:group 'company)
(define-key keymap [up-mouse-1] 'ignore)
(define-key keymap [up-mouse-3] 'ignore)
(define-key keymap [return] 'company-complete-selection)
+ (define-key keymap (kbd "RET") 'company-complete-selection)
(define-key keymap [tab] 'company-complete-common)
+ (define-key keymap (kbd "TAB") 'company-complete-common)
(define-key keymap (kbd "<f1>") 'company-show-doc-buffer)
(define-key keymap "\C-w" 'company-show-location)
(define-key keymap "\C-s" 'company-search-candidates)
(defun company-manual-begin ()
(interactive)
(setq company--explicit-action t)
- (company-auto-begin))
+ (unwind-protect
+ (company-auto-begin)
+ (unless company-candidates
+ (setq company--explicit-action nil))))
(defun company-other-backend (&optional backward)
(interactive (list current-prefix-arg))
args))
(overlay-put ov 'company-column column)
- (overlay-put ov 'company-height (abs height))))))
+ (overlay-put ov 'company-height height)))))
(defun company-pseudo-tooltip-show-at-point (pos)
(let ((col-row (company--col-row pos)))
(height (overlay-get company-pseudo-tooltip-overlay 'company-height)))
(overlay-put company-pseudo-tooltip-overlay 'company-before
(apply 'company--replacement-string
- (company--create-lines selection height)
+ (company--create-lines selection (abs height))
(overlay-get company-pseudo-tooltip-overlay
'company-replacement-args)))))
(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."
+ "`company-mode' front-end similar to a tool-tip but based on overlays."
(case command
(pre-command (company-pseudo-tooltip-hide-temporarily))
(post-command
(setq company-preview-overlay nil)))
(defun company-preview-frontend (command)
- "A `company-mode' front-end showing the selection as if it had been inserted."
+ "`company-mode' front-end showing the selection as if it had been inserted."
(case command
(pre-command (company-preview-hide))
(post-command (company-preview-show-at-point (point)))
(company-echo-show)))
(defun company-echo-frontend (command)
- "A `company-mode' front-end showing the candidates in the echo area."
+ "`company-mode' front-end showing the candidates in the echo area."
(case command
(post-command (company-echo-show-soon 'company-echo-format))
(hide (company-echo-hide))))
(defun company-echo-strip-common-frontend (command)
- "A `company-mode' front-end showing the candidates in the echo area."
+ "`company-mode' front-end showing the candidates in the echo area."
(case command
(post-command (company-echo-show-soon 'company-echo-strip-common-format))
(hide (company-echo-hide))))
(defun company-echo-metadata-frontend (command)
- "A `company-mode' front-end showing the documentation in the echo area."
+ "`company-mode' front-end showing the documentation in the echo area."
(case command
(post-command (company-echo-show-when-idle 'company-fetch-metadata))
(hide (company-echo-hide))))