]> rtime.felk.cvut.cz Git - sojka/company-mode.git/blobdiff - company-files.el
Bumped version to 0.4.
[sojka/company-mode.git] / company-files.el
index f08479c9c610645d79162b6facffe81ddaaf576c..9f5fb1df6838051601c21e22891934317d296f0a 100644 (file)
@@ -2,7 +2,7 @@
 ;;
 ;; 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
@@ -28,9 +28,9 @@
 
 (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