[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 141fa70 1/3: company-sort-by-occurrence: Make s
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 141fa70 1/3: company-sort-by-occurrence: Make sure to look at the closest occurrence |
Date: |
Thu, 13 May 2021 15:57:08 -0400 (EDT) |
branch: externals/company
commit 141fa70fdeee5724a9b85c7d40963d9fd1460b50
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
company-sort-by-occurrence: Make sure to look at the closest occurrence
When there are several occurrences of an identifier in the buffer.
---
company.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/company.el b/company.el
index e071098..5dbc3c5 100644
--- a/company.el
+++ b/company.el
@@ -1671,11 +1671,15 @@ Keywords and function definition names are ignored."
(cl-delete-if
(lambda (candidate)
(when (catch 'done
- (goto-char w-start)
+ (goto-char (1- start-point))
+ (while (search-backward candidate w-start t)
+ (when (save-match-data
+ (company--occurrence-predicate))
+ (throw 'done t)))
+ (goto-char start-point)
(while (search-forward candidate w-end t)
- (when (and (not (eq (point) start-point))
- (save-match-data
- (company--occurrence-predicate)))
+ (when (save-match-data
+ (company--occurrence-predicate))
(throw 'done t))))
(push
(cons candidate