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

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

[elpa] externals/company 3432f9e 2/2: Merge pull request #1280 from yuga


From: ELPA Syncer
Subject: [elpa] externals/company 3432f9e 2/2: Merge pull request #1280 from yugaego/files-exclude
Date: Wed, 22 Dec 2021 06:57:11 -0500 (EST)

branch: externals/company
commit 3432f9e397092433b886a2ba5adfe27d1e5bc08f
Merge: ab334b5 f6c1655
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: GitHub <noreply@github.com>

    Merge pull request #1280 from yugaego/files-exclude
    
    Fix company-files-exclusions docstring and application
---
 company-files.el    | 6 +++---
 test/files-tests.el | 9 +++++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/company-files.el b/company-files.el
index 902ea5e..69d6793 100644
--- a/company-files.el
+++ b/company-files.el
@@ -33,9 +33,9 @@
   :group 'company)
 
 (defcustom company-files-exclusions nil
-  "File name extensions and directory names to ignore.
+  "A list of file name extensions and directory names to ignore.
 The values should use the same format as `completion-ignored-extensions'."
-  :type '(const string)
+  :type '(repeat (string :tag "File extension or directory name"))
   :package-version '(company . "0.9.1"))
 
 (defcustom company-files-chop-trailing-slash t
@@ -59,7 +59,7 @@ Set this to nil to disable that behavior."
     (file-error nil)))
 
 (defun company-files--exclusions-filtered (completions)
-  (let* ((dir-exclusions (cl-delete-if-not #'company-files--trailing-slash-p
+  (let* ((dir-exclusions (cl-remove-if-not #'company-files--trailing-slash-p
                                            company-files-exclusions))
          (file-exclusions (cl-set-difference company-files-exclusions
                                              dir-exclusions)))
diff --git a/test/files-tests.el b/test/files-tests.el
index b5dd484..095f4b7 100644
--- a/test/files-tests.el
+++ b/test/files-tests.el
@@ -46,3 +46,12 @@
     (should-not (member (expand-file-name "company.el" company-dir)
                         (company-files 'candidates
                                        company-dir)))))
+
+(ert-deftest company-files-candidates-excluding-dir-and-files ()
+  (let* ((company-files-exclusions '("test/" ".el"))
+         company-files--completion-cache
+         (files-candidates (company-files 'candidates company-dir)))
+    (should-not (member (expand-file-name "test/" company-dir)
+                        files-candidates))
+    (should-not (member (expand-file-name "company.el" company-dir)
+                        files-candidates))))



reply via email to

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