branch: externals/company commit 06e9a9782a5ab0d3ea15fcf07d8330594b8bbd64 Author: Konstantin Kharlamov <hi-an...@yandex.ru> Commit: Konstantin Kharlamov <hi-an...@yandex.ru>
treewide: replace (equal= … "") comparisons with (string-empty-p …) Due to `equal` accepting an arg of different type than a string, each replacement was manually examined to make sure the parameter is expected to be a string. --- company-dabbrev-code.el | 2 +- company-files.el | 2 +- company-semantic.el | 4 ++-- company.el | 6 +++--- 4 files changed, 7 insertions(+), 7 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-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 3c5bcea94e..2f3a24f55f 100644 --- a/company.el +++ b/company.el @@ -1991,7 +1991,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. @@ -4111,7 +4111,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) @@ -4298,7 +4298,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)))