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

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

[elpa] master a4d0421 05/29: Modified for the original frontends to work


From: Dmitry Gutov
Subject: [elpa] master a4d0421 05/29: Modified for the original frontends to work
Date: Tue, 28 Mar 2017 20:50:34 -0400 (EDT)

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

    Modified for the original frontends to work
    
    The preview function company-preview-show-at-point
    can take the argument of 'common' flag.
    By this change, the following frontends work well.
     - company-preview-frontend
     - company-preview-if-just-one-frontend (default)
     - company-preview-common-frontend (newly added)
    
    In the configuration of customized variable company-frontends
    the docstring of company-preview-common-frontend was also modified.
---
 company.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/company.el b/company.el
index ac96146..d8123d7 100644
--- a/company.el
+++ b/company.el
@@ -242,7 +242,7 @@ 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"
+                         (const :tag "preview, common"
                                 company-preview-common-frontend)
                          (function :tag "custom function" nil))))
 
@@ -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)
+(defun company-preview-show-at-point (pos &optional common)
   (company-preview-hide)
 
-  (let ((completion (if (cdr company-candidates) company-common (nth 
company-selection company-candidates))))
+  (let ((completion (if common 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)
+(defun company-preview-frontend (command &optional 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)))
+    (`post-command (company-preview-show-at-point (point) common))
     (`hide (company-preview-hide))))
 
 (defun company-preview-if-just-one-frontend (command)
@@ -3001,7 +3001,7 @@ Delay is determined by `company-tooltip-idle-delay'."
   "`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)))
+    (company-preview-frontend command t)))
 
 
 ;;; echo 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



reply via email to

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