branch: externals/company
commit a66beb534458e02dcb95cb266a4515c83e4a194f
Merge: e23eccdb37 57734334e2
Author: Dmitry Gutov <dmi...@gutov.dev>
Commit: Dmitry Gutov <dmi...@gutov.dev>

    Merge branch 'master' into async_no_cache_flicker
---
 company-dabbrev-code.el |  2 +-
 company-files.el        |  2 +-
 company-ispell.el       |  2 +-
 company-semantic.el     |  4 ++--
 company.el              | 22 +++++++++++-----------
 test/async-tests.el     |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el
index cf435f28b2..5d7bf66475 100644
--- a/company-dabbrev-code.el
+++ b/company-dabbrev-code.el
@@ -78,7 +78,7 @@ also `company-dabbrev-code-time-limit'."
 (defun company-dabbrev-code--make-regexp (prefix)
   (let ((prefix-re
          (cond
-          ((equal prefix "")
+          ((string-empty-p prefix)
            "\\([a-zA-Z]\\|\\s_\\)")
           ((not company-dabbrev-code-completion-styles)
            (regexp-quote prefix))
diff --git a/company-files.el b/company-files.el
index 6a53ada5f8..ebe3a6a28a 100644
--- a/company-files.el
+++ b/company-files.el
@@ -53,7 +53,7 @@ Set this to nil to disable that behavior."
                         (lambda (s1 s2) (string-lessp (downcase s1) (downcase 
s2))))))
         (when company-files-exclusions
           (setq comp (company-files--exclusions-filtered comp)))
-        (if (equal prefix "")
+        (if (string-empty-p prefix)
             (delete "../" (delete "./" comp))
           comp))
     (file-error nil)))
diff --git a/company-ispell.el b/company-ispell.el
index d40d8c6eb4..2699d30bed 100644
--- a/company-ispell.el
+++ b/company-ispell.el
@@ -81,7 +81,7 @@ If nil, use `ispell-complete-word-dict' or 
`ispell-alternate-dictionary'."
                                   (lambda () (ispell-lookup-words "" dict))
                                   :check-tag dict))
             (completion-ignore-case t))
-       (if (string= arg "")
+       (if (string-empty-p arg)
            ;; Small optimization.
            all-words
          (company-substitute-prefix
diff --git a/company-semantic.el b/company-semantic.el
index 53b11c0320..df20e6260e 100644
--- a/company-semantic.el
+++ b/company-semantic.el
@@ -140,7 +140,7 @@ and `c-electric-colon', for automatic completion right 
after \">\" and
                  (memq major-mode company-semantic-modes)
                  (not (company-in-string-or-comment))
                  (or (company-semantic--prefix) 'stop)))
-    (candidates (if (and (equal arg "")
+    (candidates (if (and (string-empty-p arg)
                          (not (looking-back "->\\|\\.\\|::" (- (point) 2))))
                     (company-semantic-completions-raw arg)
                   (company-semantic-completions arg)))
@@ -151,7 +151,7 @@ and `c-electric-colon', for automatic completion right 
after \">\" and
     (doc-buffer (company-semantic-doc-buffer
                  (assoc arg company-semantic--current-tags)))
     ;; Because "" is an empty context and doesn't return local variables.
-    (no-cache (equal arg ""))
+    (no-cache (string-empty-p arg))
     (duplicates t)
     (location (let ((tag (assoc arg company-semantic--current-tags)))
                 (when (buffer-live-p (semantic-tag-buffer tag))
diff --git a/company.el b/company.el
index 3f6a6e04d3..e9a542cf46 100644
--- a/company.el
+++ b/company.el
@@ -1993,7 +1993,7 @@ Keywords and function definition names are ignored."
             (cl-delete-if
              (lambda (candidate)
                (goto-char w-start)
-               (when (and (not (equal candidate ""))
+               (when (and (not (string-empty-p candidate))
                           (search-forward candidate w-end t)
                           ;; ^^^ optimize for large lists where most elements
                           ;; won't have a match.
@@ -2147,8 +2147,8 @@ For more details see `company-insertion-on-trigger' and
          (if (consp company-insertion-triggers)
              (memq (char-syntax (string-to-char input))
                    company-insertion-triggers)
-           (string-match (regexp-quote (substring input 0 1))
-                         company-insertion-triggers)))))
+           (string-match-p (regexp-quote (substring input 0 1))
+                           company-insertion-triggers)))))
 
 (defun company--incremental-p ()
   (and (> (point) company-point)
@@ -2512,9 +2512,9 @@ each one wraps a part of the input string."
 (defun company--search-update-predicate (ss)
   (let* ((re (funcall company-search-regexp-function ss))
          (company-candidates-predicate
-          (and (not (string= re ""))
+          (and (not (string-empty-p re))
                company-search-filtering
-               (lambda (candidate) (string-match re candidate))))
+               (lambda (candidate) (string-match-p re candidate))))
          (cc (company-calculate-candidates company-prefix
                                            (company-call-backend 
'ignore-case))))
     (unless cc (user-error "No match"))
@@ -2530,7 +2530,7 @@ each one wraps a part of the input string."
 
 (defun company--search-assert-input ()
   (company--search-assert-enabled)
-  (when (string= company-search-string "")
+  (when (string-empty-p company-search-string)
     (user-error "Empty search string")))
 
 (defun company-search-repeat-forward ()
@@ -2583,7 +2583,7 @@ each one wraps a part of the input string."
 (defun company-search-delete-char ()
   (interactive)
   (company--search-assert-enabled)
-  (if (string= company-search-string "")
+  (if (string-empty-p company-search-string)
       (ding)
     (let ((ss (substring company-search-string 0 -1)))
       (when company-search-filtering
@@ -3349,7 +3349,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
 
 (defun company-plainify (str)
   (let ((prefix (get-text-property 0 'line-prefix str)))
-    (when prefix ; Keep the original value unmodified, for no special reason.
+    (when (stringp prefix) ; Keep the original value unmodified, for no 
special reason.
       (setq str (concat prefix str))
       (remove-text-properties 0 (length str) '(line-prefix) str)))
   (let* ((pieces (split-string str "\t"))
@@ -3433,7 +3433,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
                                 nil line))
     (when (let ((re (funcall company-search-regexp-function
                              company-search-string)))
-            (and (not (string= re ""))
+            (and (not (string-empty-p re))
                  (string-match re value)))
       (pcase-dolist (`(,mbeg . ,mend) (company--search-chunks))
         (let ((beg (+ margin mbeg))
@@ -4117,7 +4117,7 @@ Delay is determined by `company-tooltip-idle-delay'."
                                (substring completion 1))))
 
     (and (equal pos (point))
-         (not (equal completion ""))
+         (not (string-empty-p completion))
          (add-text-properties 0 1 '(cursor 1) completion))
 
     (let* ((beg pos)
@@ -4304,7 +4304,7 @@ Delay is determined by `company-tooltip-idle-delay'."
               "}"))))
 
 (defun company-echo-hide ()
-  (unless (equal company-echo-last-msg "")
+  (unless (string-empty-p company-echo-last-msg)
     (setq company-echo-last-msg "")
     (company-echo-show)))
 
diff --git a/test/async-tests.el b/test/async-tests.el
index 1c9253944f..6e350f0204 100644
--- a/test/async-tests.el
+++ b/test/async-tests.el
@@ -48,7 +48,7 @@
   (let ((company-backend 'company-async-backend))
     (should (equal "foo" (company-call-backend-raw 'prefix)))
     (should (equal :async (car (company-call-backend-raw 'candidates "foo"))))
-    (should (equal 'closure (cadr (company-call-backend-raw 'candidates 
"foo"))))))
+    (should (functionp (cdr (company-call-backend-raw 'candidates "foo"))))))
 
 (ert-deftest company-manual-begin-forces-async-candidates-to-sync ()
   (with-temp-buffer

Reply via email to