emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 40e2200 07/29: Preview func take the exact common part


From: Dmitry Gutov
Subject: [elpa] master 40e2200 07/29: Preview func take the exact common part
Date: Tue, 28 Mar 2017 20:50:34 -0400 (EDT)

branch: master
commit 40e2200db0d8a55d4714e9ba3dd3464d35dd35e3
Author: Kiso Katsuyuki <address@hidden>
Commit: Kiso Katsuyuki <address@hidden>

    Preview func take the exact common part
    
    `company-preview-show-at-point` is modified to take the exact
    common part of candidates.
    
    Additionaly the function name `company--show-common-inline-p`
    is modified to `company-preview-common--show-p`.
    
    Exact line is deleted.
---
 company.el | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/company.el b/company.el
index d8123d7..d8b3077 100644
--- a/company.el
+++ b/company.el
@@ -2916,10 +2916,10 @@ Delay is determined by `company-tooltip-idle-delay'."
 
 (defvar-local company-preview-overlay nil)
 
-(defun company-preview-show-at-point (pos &optional common)
+(defun company-preview-show-at-point (pos &optional company-common)
   (company-preview-hide)
 
-  (let ((completion (if common company-common (nth company-selection 
company-candidates))))
+  (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
@@ -2967,11 +2967,11 @@ Delay is determined by `company-tooltip-idle-delay'."
     (delete-overlay company-preview-overlay)
     (setq company-preview-overlay nil)))
 
-(defun company-preview-frontend (command &optional common)
+(defun company-preview-frontend (command &optional company-common)
   "`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) common))
+    (`post-command (company-preview-show-at-point (point) company-common))
     (`hide (company-preview-hide))))
 
 (defun company-preview-if-just-one-frontend (command)
@@ -2991,8 +2991,7 @@ 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 ()
+(defun company-preview-common--show-p ()
   (and company-common
        (or (eq (company-call-backend 'ignore-case) 'keep-prefix)
            (string-prefix-p company-prefix company-common))))
@@ -3000,9 +2999,8 @@ Delay is determined by `company-tooltip-idle-delay'."
 (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 t)))
-
+            (company-preview-common--show-p))
+    (company-preview-frontend command company-common)))
 
 ;;; echo 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]