[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 09/30: company-files.el: Change regexp prefix
From: |
Dmitry Gutov |
Subject: |
[elpa] 09/30: company-files.el: Change regexp prefix |
Date: |
Tue, 14 Oct 2014 22:22:46 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 06fed5f754de74fbae24eb6445d104650a0b4c14
Author: James Browder <address@hidden>
Date: Sun Sep 21 17:52:53 2014 -0500
company-files.el: Change regexp prefix
* Fix Windows drive letters recognition.
* Complete relative paths, starting with ./ or ../.
---
company-files.el | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/company-files.el b/company-files.el
index 3dc4d86..c8fba51 100644
--- a/company-files.el
+++ b/company-files.el
@@ -35,9 +35,10 @@
(file-name-all-completions prefix dir))))
(defvar company-files-regexps
- (let ((begin (if (eq system-type 'windows-nt)
- "[a-z][A-Z]\\"
- "~?/")))
+ (let* ((begin (if (eq system-type 'windows-nt)
+ "[a-zA-Z]:/"
+ "/"))
+ (begin (concat "\\(?:\\.\\{1,2\\}/\\|~/\\|" begin "\\)")))
(list (concat "\"\\(" begin "[^\"\n]*\\)")
(concat "\'\\(" begin "[^\'\n]*\\)")
(concat "\\(?:[ \t]\\|^\\)\\(" begin "[^ \t\n]*\\)"))))
@@ -58,9 +59,10 @@
(defun company-files-complete (prefix)
(let* ((dir (file-name-directory prefix))
+ (dir-exp (expand-file-name dir))
(file (file-name-nondirectory prefix))
candidates directories)
- (unless (equal dir (car company-files-completion-cache))
+ (unless (equal dir-exp (car company-files-completion-cache))
(dolist (file (company-files-directory-files dir file))
(setq file (concat dir file))
(push file candidates)
@@ -72,13 +74,15 @@
(push (concat directory
(unless (eq (aref directory (1- (length directory)))
?/) "/")
child) candidates)))
- (setq company-files-completion-cache (cons dir (nreverse candidates))))
+ (setq company-files-completion-cache (cons dir-exp (nreverse
candidates))))
(all-completions prefix
(cdr company-files-completion-cache))))
;;;###autoload
(defun company-files (command &optional arg &rest ignored)
- "`company-mode' completion back-end existing file names."
+ "`company-mode' completion back-end existing file names.
+Completions are triggered when the text inside quotes starts with any of
+the following: ./, ../, ~/, or root drive"
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'company-files))
- [elpa] branch master updated (a7fe5bb -> 0750e13), Dmitry Gutov, 2014/10/14
- [elpa] 01/30: Fix company-yasnippet compilation without yasnippet, Dmitry Gutov, 2014/10/14
- [elpa] 04/30: company-gtags: Don't try to complete in non-file buffers, Dmitry Gutov, 2014/10/14
- [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 <=
- [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, 2014/10/14
- [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