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

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

[elpa] master e93b3dc 30/38: [company-files] Make post-completion comman


From: Dmitry Gutov
Subject: [elpa] master e93b3dc 30/38: [company-files] Make post-completion command a dedicated function
Date: Sat, 25 Jul 2020 19:51:16 -0400 (EDT)

branch: master
commit e93b3dc27b7746048363299081e250c6215d1467
Author: Huy Duong <huy.duong@employmenthero.com>
Commit: Huy Duong <huy.duong@employmenthero.com>

    [company-files] Make post-completion command a dedicated function
    
    Make post-completion command a dedicated function so that it can be
    advised easier (e.g: delete file extension on completion).
    
    Signed-off-by: Huy Duong <huy.duong@employmenthero.com>
---
 company-files.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/company-files.el b/company-files.el
index 91de1c6..8859266 100644
--- a/company-files.el
+++ b/company-files.el
@@ -127,6 +127,10 @@ The values should use the same format as 
`completion-ignored-extensions'."
   (and (equal (cdr old) (cdr new))
        (string-prefix-p (car old) (car new))))
 
+(defun company-files--post-completion (arg)
+  (when (company-files--trailing-slash-p arg)
+    (delete-char -1)))
+
 ;;;###autoload
 (defun company-files (command &optional arg &rest ignored)
   "`company-mode' completion backend existing file names.
@@ -139,8 +143,7 @@ File paths with spaces are only supported inside strings."
     (candidates (company-files--complete arg))
     (location (cons (dired-noselect
                      (file-name-directory (directory-file-name arg))) 1))
-    (post-completion (when (company-files--trailing-slash-p arg)
-                       (delete-char -1)))
+    (post-completion (company-files--post-completion arg))
     (sorted t)
     (no-cache t)))
 



reply via email to

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