diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ecomplete.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el index c39c6c2ff9c..d5f3fc77560 100644 --- a/lisp/ecomplete.el +++ b/lisp/ecomplete.el @@ -103,7 +103,11 @@ string that was matched." (unless elems (push (setq elems (list type)) ecomplete-database)) (if (setq entry (assoc key (cdr elems))) - (setcdr entry (list (1+ (cadr entry)) now text)) + (pcase-let ((`(,_key ,count ,_time ,oldtext) entry)) + (setcdr entry (list (1+ count) now + ;; Preserve the "more complete" text. + (if (>= (length text) (length oldtext)) + text oldtext)))) (nconc elems (list (list key 1 now text)))))) (defun ecomplete-get-item (type key) |