[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5e49ddf 08/29: Take the exact candidate as an nonoptional
From: |
Dmitry Gutov |
Subject: |
[elpa] master 5e49ddf 08/29: Take the exact candidate as an nonoptional arg |
Date: |
Tue, 28 Mar 2017 20:50:34 -0400 (EDT) |
branch: master
commit 5e49ddf3d2fe8baf1eff12383df2c6dc5ead9ef7
Author: Kiso Katsuyuki <address@hidden>
Commit: Kiso Katsuyuki <address@hidden>
Take the exact candidate as an nonoptional arg
By this change `company-preview-show-at-point`
takes the exact completion candidate
as an nonoptional arg. So the candidate was added as
the arg where this function is called.
At the previous change `company-preview-frontend` was modified to
take the new argument, but it was returned at this time.
Made `company-preview-common-frontend` not to call
`company-preview-frontend`, and instead it called
`company-preview-show-at-point` directly.
---
company.el | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/company.el b/company.el
index d8b3077..d219b7d 100644
--- a/company.el
+++ b/company.el
@@ -2916,14 +2916,13 @@ Delay is determined by `company-tooltip-idle-delay'."
(defvar-local company-preview-overlay nil)
-(defun company-preview-show-at-point (pos &optional company-common)
+(defun company-preview-show-at-point (pos completion)
(company-preview-hide)
- (let ((completion (or 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
- completion)
+ (setq completion (copy-sequence (company--pre-render completion)))
+ (font-lock-append-text-property 0 (length completion)
+ 'face 'company-preview
+ completion)
(font-lock-prepend-text-property 0 (length company-common)
'face 'company-preview-common
completion)
@@ -2960,18 +2959,19 @@ Delay is determined by `company-tooltip-idle-delay'."
(let ((ov company-preview-overlay))
(overlay-put ov (if ptf-workaround 'display 'after-string)
completion)
- (overlay-put ov 'window (selected-window))))))
+ (overlay-put ov 'window (selected-window)))))
(defun company-preview-hide ()
(when company-preview-overlay
(delete-overlay company-preview-overlay)
(setq company-preview-overlay nil)))
-(defun company-preview-frontend (command &optional company-common)
+(defun company-preview-frontend (command)
"`company-mode' frontend showing the selection as if it had been inserted."
(pcase command
(`pre-command (company-preview-hide))
- (`post-command (company-preview-show-at-point (point) company-common))
+ (`post-command (company-preview-show-at-point (point)
+ (nth company-selection
company-candidates)))
(`hide (company-preview-hide))))
(defun company-preview-if-just-one-frontend (command)
@@ -2992,15 +2992,19 @@ Delay is determined by `company-tooltip-idle-delay'."
(not (overlay-get company-pseudo-tooltip-overlay 'invisible))))
(defun company-preview-common--show-p ()
+ "Returns whether the preview of common can be showed or not"
(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."
+ "`company-mode' frontend preview the common part of candidates."
(when (or (not (eq command 'post-command))
(company-preview-common--show-p))
- (company-preview-frontend command company-common)))
+ (pcase command
+ (`pre-command (company-preview-hide))
+ (`post-command (company-preview-show-at-point (point) company-common))
+ (`hide (company-preview-hide)))))
;;; echo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- [elpa] master ce42fcf 23/29: Update copyright years, (continued)
- [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
- [elpa] master b74f329 22/29: Track the changes in window width, Dmitry Gutov, 2017/03/28
- [elpa] master 0affd93 21/29: Fix the new test to work in Emacs 24, Dmitry Gutov, 2017/03/28
- [elpa] master f0ff54e 13/29: company-diag: Also show completions if prefix is a cons, Dmitry Gutov, 2017/03/28
- [elpa] master e19e53e 19/29: Remote the overriding-terminal-local-map check, Dmitry Gutov, 2017/03/28
- [elpa] master 90123e7 26/29: Don't use the trailing slash in .elpaignore, Dmitry Gutov, 2017/03/28
- [elpa] master f9c9e85 24/29: Bind message-truncate-lines around call to message in company-echo-show, Dmitry Gutov, 2017/03/28
- [elpa] master edc5d03 29/29: Merge commit 'f1499404163d8148e7a6303a8598f9c0f696d1cb' from company, Dmitry Gutov, 2017/03/28
- [elpa] master 5e49ddf 08/29: Take the exact candidate as an nonoptional arg,
Dmitry Gutov <=
- [elpa] master 906deab 14/29: Merge pull request #625 from juergenhoetzel/company-diag-consp, Dmitry Gutov, 2017/03/28
- [elpa] master f932619 25/29: Merge pull request #656 from cpitclaudel/651-truncate-echo, Dmitry Gutov, 2017/03/28