[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cf98238 04/29: Preview the common part of completion candi
From: |
Dmitry Gutov |
Subject: |
[elpa] master cf98238 04/29: Preview the common part of completion candidates |
Date: |
Tue, 28 Mar 2017 20:50:33 -0400 (EDT) |
branch: master
commit cf982388e9d34655653f7bfbd2e1053e26b86ab2
Author: Kiso Katsuyuki <address@hidden>
Commit: Kiso Katsuyuki <address@hidden>
Preview the common part of completion candidates
The new frontends to preview the common part of candidates was added.
company-preview-common-frontend
I changed a little the function company-preview-show-at-point to
be used in this frontend. The default frontend
company-preview-if-just-one-frontend originally uses the function,
so both frontends reference it.
Configuration of customized variable company-frontends and
the fuction company-frontends-set to set the frontends are also
changed since the new frontend is added.
In the default configuration the new frontend is not activated.
---
company.el | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/company.el b/company.el
index 7fde671..ac96146 100644
--- a/company.el
+++ b/company.el
@@ -188,14 +188,19 @@ attention to case differences."
(and (memq
'company-pseudo-tooltip-unless-just-one-frontend-with-delay value)
(memq 'company-pseudo-tooltip-unless-just-one-frontend
value)))
(user-error "Pseudo tooltip frontend cannot be used more than once"))
- (and (memq 'company-preview-if-just-one-frontend value)
- (memq 'company-preview-frontend value)
+ (and (or (and (memq 'company-preview-if-just-one-frontend value)
+ (memq 'company-preview-frontend value))
+ (and (memq 'company-preview-if-just-one-frontend value)
+ (memq 'company-preview-common-frontend value))
+ (and (memq 'company-preview-frontend value)
+ (memq 'company-preview-common-frontend value))
+ )
(user-error "Preview frontend cannot be used twice"))
(and (memq 'company-echo value)
(memq 'company-echo-metadata-frontend value)
(user-error "Echo area cannot be used twice"))
;; Preview must come last.
- (dolist (f '(company-preview-if-just-one-frontend
company-preview-frontend))
+ (dolist (f '(company-preview-if-just-one-frontend company-preview-frontend
company-preview-common-frontend))
(when (cdr (memq f value))
(setq value (append (delq f value) (list f)))))
(set variable value)))
@@ -237,6 +242,8 @@ The visualized data is stored in `company-prefix',
`company-candidates',
(const :tag "preview" company-preview-frontend)
(const :tag "preview, unique only"
company-preview-if-just-one-frontend)
+ (const :tag "preview, unique and common part"
+ company-preview-common-frontend)
(function :tag "custom function" nil))))
(defcustom company-tooltip-limit 10
@@ -2912,7 +2919,7 @@ Delay is determined by `company-tooltip-idle-delay'."
(defun company-preview-show-at-point (pos)
(company-preview-hide)
- (let ((completion (nth company-selection company-candidates)))
+ (let ((completion (if (cdr company-candidates) company-common (nth
company-selection company-candidates))))
(setq completion (copy-sequence (company--pre-render completion)))
(font-lock-append-text-property 0 (length completion)
'face 'company-preview
@@ -2984,6 +2991,19 @@ Delay is determined by `company-tooltip-idle-delay'."
(when (overlayp company-pseudo-tooltip-overlay)
(not (overlay-get company-pseudo-tooltip-overlay 'invisible))))
+
+(defun company--show-common-inline-p ()
+ (and company-common
+ (or (eq (company-call-backend 'ignore-case) 'keep-prefix)
+ (string-prefix-p company-prefix company-common))))
+
+(defun company-preview-common-frontend (command)
+ "`company-preview-frontend', but only shown for single candidates."
+ (when (or (not (eq command 'post-command))
+ (company--show-common-inline-p))
+ (company-preview-frontend command)))
+
+
;;; echo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar-local company-echo-last-msg nil)
- [elpa] master updated (4f12749 -> edc5d03), Dmitry Gutov, 2017/03/28
- [elpa] master ec7a860 03/29: Merge pull request #616 from terlar/add-enh-ruby-mode-keyword-alias, Dmitry Gutov, 2017/03/28
- [elpa] master 0499c02 02/29: company-keywords-alist: add enh-ruby-mode -> ruby-mode alias, Dmitry Gutov, 2017/03/28
- [elpa] master 92b0bf7 06/29: Use pipes instead of PTYs to receive output from Clang, Dmitry Gutov, 2017/03/28
- [elpa] master 6f2ae7f 09/29: Merge pull request #621 from juergenhoetzel/use-pipes, Dmitry Gutov, 2017/03/28
- [elpa] master 21357f6 11/29: Update NEWS, Dmitry Gutov, 2017/03/28
- [elpa] master bc2ce4e 18/29: Support Tramp in company-gtags, Dmitry Gutov, 2017/03/28
- [elpa] master b1127da 16/29: Don't show (anonymous) as function annotation, or in argument expansions, Dmitry Gutov, 2017/03/28
- [elpa] master 31063e1 20/29: Fix company-auto-complete and electric-pair-mode compatibility, Dmitry Gutov, 2017/03/28
- [elpa] master cf98238 04/29: Preview the common part of completion candidates,
Dmitry Gutov <=
- [elpa] master 40e2200 07/29: Preview func take the exact common part, Dmitry Gutov, 2017/03/28
- [elpa] master a2ec806 12/29: Use tramp-aware `start-file-process' to start completion process, Dmitry Gutov, 2017/03/28
- [elpa] master a4d0421 05/29: Modified for the original frontends to work, Dmitry Gutov, 2017/03/28
- [elpa] master 1c516df 01/29: Increase the minimum Emacs version dependency, Dmitry Gutov, 2017/03/28
- [elpa] master c494fc6 17/29: Fix a failing test, Dmitry Gutov, 2017/03/28
- [elpa] master ec12e27 27/29: Merge branch 'master' of github.com:company-mode/company-mode, Dmitry Gutov, 2017/03/28
- [elpa] master f149940 28/29: Release 0.9.3, Dmitry Gutov, 2017/03/28
- [elpa] master ce42fcf 23/29: Update copyright years, Dmitry Gutov, 2017/03/28
- [elpa] master 7bd93b8 15/29: Merge pull request #629 from juergenhoetzel/tramp-aware-clang, Dmitry Gutov, 2017/03/28
- [elpa] master 51f3885 10/29: Merge pull request #618 from kkatsuyuki/preview-common, Dmitry Gutov, 2017/03/28