[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 15/30: company-files: Fix cache behavior for when we're backspaci
From: |
Dmitry Gutov |
Subject: |
[elpa] 15/30: company-files: Fix cache behavior for when we're backspacing |
Date: |
Tue, 14 Oct 2014 22:22:49 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 9d39b74346631432f4a76b9ef4f6a06e80f0e168
Author: Dmitry Gutov <address@hidden>
Date: Mon Sep 29 00:14:25 2014 +0400
company-files: Fix cache behavior for when we're backspacing
As discussed
in
https://github.com/Lompik/company-mode/commit/528cd1b4c94e1d6b0009068be618bde2b27ec583#commitcomment-7953472.
---
company-files.el | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/company-files.el b/company-files.el
index 5a77699..0e2ab4d 100644
--- a/company-files.el
+++ b/company-files.el
@@ -60,11 +60,12 @@
(defun company-files--complete (prefix)
(let* ((dir (file-name-directory prefix))
- (key (cons (expand-file-name dir)
+ (key (list (file-name-nondirectory prefix)
+ (expand-file-name dir)
(nth 5 (file-attributes dir))))
(file (file-name-nondirectory prefix))
candidates directories)
- (unless (equal key (car company-files--completion-cache))
+ (unless (company-file--keys-match-p key (car
company-files--completion-cache))
(dolist (file (company-files--directory-files dir file))
(setq file (concat dir file))
(push file candidates)
@@ -80,6 +81,10 @@
(all-completions prefix
(cdr company-files--completion-cache))))
+(defun company-file--keys-match-p (new old)
+ (and (string-prefix-p (car old) (car new))
+ (equal (cdr old) (cdr new))))
+
;;;###autoload
(defun company-files (command &optional arg &rest ignored)
"`company-mode' completion back-end existing file names.
- [elpa] 03/30: Merge pull request #191 from jorgenschaefer/master, (continued)
- [elpa] 03/30: Merge pull request #191 from jorgenschaefer/master, Dmitry Gutov, 2014/10/14
- [elpa] 02/30: Use read-kbd-macro instead of kbd as a function., Dmitry Gutov, 2014/10/14
- [elpa] 06/30: company-search-printing-char: Don't update company-search-string when no match, Dmitry Gutov, 2014/10/14
- [elpa] 05/30: company--insert-candidate: Don't use `insert-before-markers', Dmitry Gutov, 2014/10/14
- [elpa] 07/30: company-create-match-predicate: Just replace the predicate, Dmitry Gutov, 2014/10/14
- [elpa] 08/30: company-post-command: Handle being called after quitting, Dmitry Gutov, 2014/10/14
- [elpa] 09/30: company-files.el: Change regexp prefix, Dmitry Gutov, 2014/10/14
- [elpa] 10/30: Update docstring, change words, bump copyright year, Dmitry Gutov, 2014/10/14
- [elpa] 13/30: Update a comment, Dmitry Gutov, 2014/10/14
- [elpa] 11/30: company-files-complete: Include mtime in the cache key, Dmitry Gutov, 2014/10/14
- [elpa] 15/30: company-files: Fix cache behavior for when we're backspacing,
Dmitry Gutov <=
- [elpa] 16/30: company-file--keys-match-p: Handle OLD being nil, Dmitry Gutov, 2014/10/14
- [elpa] 17/30: company-begin-commands: Add `orgtbl-self-insert-command', Dmitry Gutov, 2014/10/14
- [elpa] 19/30: company-clang-arguments: Fix default element value, Dmitry Gutov, 2014/10/14
- [elpa] 21/30: company-call-backend-raw: Use `condition-case-unless-debug', too, Dmitry Gutov, 2014/10/14
- [elpa] 20/30: Handle non-printable and multiple-width chars in completions, Dmitry Gutov, 2014/10/14
- [elpa] 18/30: Use `condition-case-unless-debug' more, Dmitry Gutov, 2014/10/14
- [elpa] 22/30: company-dabbrev--search: Ignore "uninteresting" buffers, Dmitry Gutov, 2014/10/14
- [elpa] 23/30: Make new tests and interactive-only, Dmitry Gutov, 2014/10/14
- [elpa] 24/30: company-fill-propertize: Use `string-width' on `company-common', Dmitry Gutov, 2014/10/14
- [elpa] 25/30: Handle nil company-common, in order not to bind it in tests, Dmitry Gutov, 2014/10/14