;;
;; Copyright (C) 2009 Nikolaj Schumacher
;;
-;; This file is part of company.
+;; This file is part of company 0.4.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
(defun company-files-grab-existing-name ()
;; Grab file names with spaces, only when they include quotes.
- (let ((file (or (company-grab "\"\\(~?/[^\"\n]*\\)" 1)
- (company-grab "\'\\(~?/[^\'\n]*\\)" 1)
- (company-grab "[ \t\n]\\(~?/[^ \t\n]*\\)" 1)))
+ (let ((file (or (company-grab-line "\"\\(~?/[^\"\n]*\\)" 1)
+ (company-grab-line "\'\\(~?/[^\'\n]*\\)" 1)
+ (company-grab-line "[ \t\n]\\(~?/[^ \t\n]*\\)" 1)))
dir)
(and file
(setq dir (file-name-directory file))
(setq company-files-completion-cache (cons dir (nreverse candidates))))
(cdr company-files-completion-cache)))
+;;;###autoload
(defun company-files (command &optional arg &rest ignored)
"a `company-mode' completion back-end existing file names."
+ (interactive (list 'interactive))
(case command
+ ('interactive (company-begin-backend 'company-files))
('prefix (company-files-grab-existing-name))
('candidates (company-files-complete arg))
('location (cons (dired-noselect