]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/company/company-xcode.el
Sync from ioccur/master
[gnu-emacs-elpa] / packages / company / company-xcode.el
index 079ecb44a554bd456e3942f9a520d82e367d5d60..ac8d133454e8626ae49ac3cecaf560df2a583fb1 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-xcode.el --- company-mode completion back-end for Xcode projects
+;;; company-xcode.el --- company-mode completion back-end for Xcode projects
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
+
+;;; Commentary:
+;;
+
 ;;; Code:
 
 (require 'company)
 (eval-when-compile (require 'cl))
 
+(defgroup company-xcode nil
+  "Completion back-end for Xcode projects."
+  :group 'company)
+
 (defcustom company-xcode-xcodeindex-executable (executable-find "xcodeindex")
-  "*Location of xcodeindex executable"
-  :group 'company-xcode
+  "Location of xcodeindex executable."
   :type 'file)
 
 (defvar company-xcode-tags nil)
 (defcustom company-xcode-types
   '("Class" "Constant" "Enum" "Macro" "Modeled Class" "Structure"
     "Type" "Union" "Function")
-  "*The types of symbols offered by `company-xcode'
+  "The types of symbols offered by `company-xcode'.
 No context-enabled completion is available.  Types like methods will be
 offered regardless of whether the class supports them.  The defaults should be
 valid in most contexts."
   :set (lambda (variable value)
          (set variable value)
          (company-xcode-reset))
-  :group 'company-xcode
   :type '(set (const "Category") (const "Class") (const "Class Method")
               (const "Class Variable") (const "Constant") (const "Enum")
               (const "Field") (const "Instance Method")
@@ -101,17 +107,17 @@ valid in most contexts."
                         company-xcode-tags))))))
 ;;;###autoload
 (defun company-xcode (command &optional arg &rest ignored)
-  "`company-mode' completion back-end for Xcode projects."
+  "`company-mode' completion back-end for Xcode projects."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-xcode))
-    ('prefix (and company-xcode-xcodeindex-executable
+    (interactive (company-begin-backend 'company-xcode))
+    (prefix (and company-xcode-xcodeindex-executable
+                 (company-xcode-tags)
+                 (not (company-in-string-or-comment))
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (let ((completion-ignore-case nil))
                   (company-xcode-tags)
-                  (not (company-in-string-or-comment))
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates (let ((completion-ignore-case nil))
-                   (company-xcode-tags)
-                   (all-completions arg (company-xcode-tags))))))
+                  (all-completions arg (company-xcode-tags))))))
 
 
 (provide 'company-xcode)