]> code.delx.au - gnu-emacs-elpa/commitdiff
* company/*.el: Fix case misunderstanding. Use checkdoc.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 1 Aug 2011 16:16:07 +0000 (12:16 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 1 Aug 2011 16:16:07 +0000 (12:16 -0400)
* company/company.el (company-capf): First cut at making Company use
completion-at-point-functions.

20 files changed:
packages/company/company-abbrev.el
packages/company/company-clang.el
packages/company/company-css.el
packages/company/company-dabbrev-code.el
packages/company/company-dabbrev.el
packages/company/company-eclim.el
packages/company/company-elisp.el
packages/company/company-etags.el
packages/company/company-files.el
packages/company/company-gtags.el
packages/company/company-ispell.el
packages/company/company-keywords.el
packages/company/company-nxml.el
packages/company/company-oddmuse.el
packages/company/company-pysmell.el
packages/company/company-ropemacs.el
packages/company/company-semantic.el
packages/company/company-tempo.el
packages/company/company-xcode.el
packages/company/company.el

index 21dcd2e4588e7c9d68a255eb2f347c5420be39ee..0c19e96879bcc44c6d72122d85736ed276c7f326 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-abbrev.el --- a company-mode completion back-end for abbrev
+;;; company-abbrev.el --- A company-mode completion back-end for abbrev
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
   "A `company-mode' completion back-end for abbrev."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for abbrev."
   (interactive (list 'interactive))
   (case command
-        ('interactive (company-begin-backend 'company-abbrev
-                                             'company-abbrev-insert))
-        ('prefix (company-grab-symbol))
-        ('candidates (nconc
-                      (delete "" (all-completions arg global-abbrev-table))
-                      (delete "" (all-completions arg local-abbrev-table))))
-        ('meta (abbrev-expansion arg))
-        ('require-match t)))
+    (interactive (company-begin-backend 'company-abbrev
+                                        'company-abbrev-insert))
+    (prefix (company-grab-symbol))
+    (candidates (nconc
+                 (delete "" (all-completions arg global-abbrev-table))
+                 (delete "" (all-completions arg local-abbrev-table))))
+    (meta (abbrev-expansion arg))
+    (require-match t)))
 
 (provide 'company-abbrev)
 ;;; company-abbrev.el ends here
 
 (provide 'company-abbrev)
 ;;; company-abbrev.el ends here
index c005f2ca11a0563b18ce5a606f8b855a36dedb21..51eb78fbd196b765a55798d8acf8d3a735d9309f 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-clang.el --- a company-mode completion back-end for clang
+;;; company-clang.el --- A company-mode completion back-end for clang
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -26,7 +30,7 @@
 
 (defcustom company-clang-executable
   (executable-find "clang")
 
 (defcustom company-clang-executable
   (executable-find "clang")
-  "*Location of clang executable"
+  "*Location of clang executable."
   :group 'company-clang
   :type 'file)
 
   :group 'company-clang
   :type 'file)
 
@@ -207,21 +211,21 @@ Completions only work correctly when the buffer has been saved.
 `company-clang-auto-save' determines whether to do this automatically."
   (interactive (list 'interactive))
   (case command
 `company-clang-auto-save' determines whether to do this automatically."
   (interactive (list 'interactive))
   (case command
-        ('interactive (company-begin-backend 'company-clang))
-        ('init (unless company-clang-executable
-                 (error "Company found no clang executable"))
-               (when (version< (company-clang-version)
-                               company-clang-required-version)
-                 (error "Company requires clang version 1.1")))
-        ('prefix (and (memq major-mode company-clang-modes)
-                      buffer-file-name
-                      company-clang-executable
-                      (not (company-in-string-or-comment))
-                      (or (company-grab-symbol) 'stop)))
-        ('candidates (company-clang--candidates arg))
-        ('post-completion (and (derived-mode-p 'objc-mode)
-                               (string-match ":" arg)
-                               (company-clang-objc-templatify arg)))))
+    (interactive (company-begin-backend 'company-clang))
+    (init (unless company-clang-executable
+            (error "Company found no clang executable"))
+          (when (version< (company-clang-version)
+                          company-clang-required-version)
+            (error "Company requires clang version 1.1")))
+    (prefix (and (memq major-mode company-clang-modes)
+                 buffer-file-name
+                 company-clang-executable
+                 (not (company-in-string-or-comment))
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (company-clang--candidates arg))
+    (post-completion (and (derived-mode-p 'objc-mode)
+                          (string-match ":" arg)
+                          (company-clang-objc-templatify arg)))))
 
 (provide 'company-clang)
 ;;; company-clang.el ends here
 
 (provide 'company-clang)
 ;;; company-clang.el ends here
index d1b3e028c837ea038591e502a93f767cfaa286fa..5642c363cbe7880c2307ec6b2fe1783b5e0f1732 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-css.el --- a company-mode completion back-end for css-mode
+;;; company-css.el --- A company-mode completion back-end for css-mode
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; Author: Nikolaj Schumacher
 
@@ -19,6 +19,8 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
           "\\)*"
           "\\(\\(?:#\\|\\_<[[:alpha:]]\\)\\(?:[[:alnum:]-#]*\\_>\\)?\\_>\\|\\)"
           "\\=")
           "\\)*"
           "\\(\\(?:#\\|\\_<[[:alpha:]]\\)\\(?:[[:alnum:]-#]*\\_>\\)?\\_>\\|\\)"
           "\\=")
-  "A regular expression matching CSS tags")
+  "A regular expression matching CSS tags.")
 
 ;;; pseudo id
 (defconst company-css-pseudo-regexp
 
 ;;; pseudo id
 (defconst company-css-pseudo-regexp
           "\\)*"
           "\\(?:\\(?:\\#\\|\\_<[[:alpha:]]\\)[[:alnum:]-#]*\\):"
           "\\([[:alpha:]-]+\\_>\\|\\)\\_>\\=")
           "\\)*"
           "\\(?:\\(?:\\#\\|\\_<[[:alpha:]]\\)[[:alnum:]-#]*\\):"
           "\\([[:alpha:]-]+\\_>\\|\\)\\_>\\=")
-  "A regular expression matching CSS pseudo classes")
+  "A regular expression matching CSS pseudo classes.")
 
 ;;; properties
 
 
 ;;; properties
 
@@ -272,20 +274,20 @@ Returns \"\" if no property found, but feasible at this position."
 ;;; values
 (defconst company-css-property-value-regexp
   "\\_<\\([[:alpha:]-]+\\):\\(?:[^};]*[[:space:]]+\\)?\\([^};]*\\_>\\|\\)\\="
 ;;; values
 (defconst company-css-property-value-regexp
   "\\_<\\([[:alpha:]-]+\\):\\(?:[^};]*[[:space:]]+\\)?\\([^};]*\\_>\\|\\)\\="
-  "A regular expression matching CSS tags")
+  "A regular expression matching CSS tags.")
 
 ;;;###autoload
 (defun company-css (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `css-mode'."
   (interactive (list 'interactive))
   (case command
 
 ;;;###autoload
 (defun company-css (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `css-mode'."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-css))
-    ('prefix (and (derived-mode-p 'css-mode)
+    (interactive (company-begin-backend 'company-css))
+    (prefix (and (derived-mode-p 'css-mode)
                   (or (company-grab company-css-tag-regexp 1)
                       (company-grab company-css-pseudo-regexp 1)
                       (company-grab company-css-property-value-regexp 2)
                       (company-css-grab-property))))
                   (or (company-grab company-css-tag-regexp 1)
                       (company-grab company-css-pseudo-regexp 1)
                       (company-grab company-css-property-value-regexp 2)
                       (company-css-grab-property))))
-    ('candidates
+    (candidates
      (cond
       ((company-grab company-css-tag-regexp 1)
        (all-completions arg company-css-html-tags))
      (cond
       ((company-grab company-css-tag-regexp 1)
        (all-completions arg company-css-html-tags))
@@ -297,7 +299,7 @@ Returns \"\" if no property found, but feasible at this position."
                          (company-grab company-css-property-value-regexp 1))))
       ((company-css-grab-property)
        (all-completions arg company-css-property-alist))))
                          (company-grab company-css-property-value-regexp 1))))
       ((company-css-grab-property)
        (all-completions arg company-css-property-alist))))
-    ('sorted t)))
+    (sorted t)))
 
 (provide 'company-css)
 ;;; company-css.el ends here
 
 (provide 'company-css)
 ;;; company-css.el ends here
index 0a531b2d897c3f965a81a11cb6a630860c1c61cf..9be5bdbdc699f036c2f75ecd2dfa701a680d2bf5 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-dabbrev-code.el --- a dabbrev-like company-mode back-end for code
+;;; company-dabbrev-code.el --- A dabbrev-like company-mode back-end for code
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -34,7 +38,7 @@
   "*Modes that use `company-dabbrev-code'.
 In all these modes `company-dabbrev-code' will complete only symbols, not text
 in comments or strings.  In other modes `company-dabbrev-code' will pass control
   "*Modes that use `company-dabbrev-code'.
 In all these modes `company-dabbrev-code' will complete only symbols, not text
 in comments or strings.  In other modes `company-dabbrev-code' will pass control
-to other back-ends \(e.g. `company-dabbrev'\).
+to other back-ends \(e.g.  `company-dabbrev'\).
 Value t means complete in all modes."
   :group 'company
   :type '(choice (repeat (symbol :tag "Major mode"))
 Value t means complete in all modes."
   :group 'company
   :type '(choice (repeat (symbol :tag "Major mode"))
@@ -42,8 +46,8 @@ Value t means complete in all modes."
 
 (defcustom company-dabbrev-code-other-buffers t
   "*Determines whether `company-dabbrev-code' should search other buffers.
 
 (defcustom company-dabbrev-code-other-buffers t
   "*Determines whether `company-dabbrev-code' should search other buffers.
-If 'all, search all other buffers.  If t, search buffers with the same
-major-mode.
+If `all', search all other buffers.  If t, search buffers with the same
+major mode.
 See also `company-dabbrev-code-time-limit'."
   :group 'company
   :type '(choice (const :tag "Off" nil)
 See also `company-dabbrev-code-time-limit'."
   :group 'company
   :type '(choice (const :tag "Off" nil)
@@ -69,17 +73,17 @@ The back-end looks for all symbols in the current buffer that aren't in
 comments or strings."
   (interactive (list 'interactive))
   (case command
 comments or strings."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-dabbrev-code))
-    ('prefix (and (or (eq t company-dabbrev-code-modes)
-                      (apply 'derived-mode-p company-dabbrev-code-modes))
-                  (not (company-in-string-or-comment))
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates (let ((completion-ignore-case nil))
-                   (company-dabbrev--search
-                    (company-dabbrev-code--make-regexp arg)
-                    company-dabbrev-code-time-limit
-                    company-dabbrev-code-other-buffers t)))
-    ('duplicates t)))
+    (interactive (company-begin-backend 'company-dabbrev-code))
+    (prefix (and (or (eq t company-dabbrev-code-modes)
+                     (apply 'derived-mode-p company-dabbrev-code-modes))
+                 (not (company-in-string-or-comment))
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (let ((completion-ignore-case nil))
+                  (company-dabbrev--search
+                   (company-dabbrev-code--make-regexp arg)
+                   company-dabbrev-code-time-limit
+                   company-dabbrev-code-other-buffers t)))
+    (duplicates t)))
 
 (provide 'company-dabbrev-code)
 ;;; company-dabbrev-code.el ends here
 
 (provide 'company-dabbrev-code)
 ;;; company-dabbrev-code.el ends here
index 2480f798219cfe6380967df5a194e40d562ef552..80d2e5f47d8e1cf3ed264d1a9b0e9a494d02a374 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-dabbrev.el --- a dabbrev-like company-mode completion back-end
+;;; company-dabbrev.el --- A dabbrev-like company-mode completion back-end
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -26,8 +30,8 @@
 
 (defcustom company-dabbrev-other-buffers 'all
   "*Determines whether `company-dabbrev' should search other buffers.
 
 (defcustom company-dabbrev-other-buffers 'all
   "*Determines whether `company-dabbrev' should search other buffers.
-If 'all, search all other buffers.  If t, search buffers with the same
-major-mode.
+If `all', search all other buffers.  If t, search buffers with the same
+major mode.
 See also `company-dabbrev-time-limit'."
   :group 'company
   :type '(choice (const :tag "Off" nil)
 See also `company-dabbrev-time-limit'."
   :group 'company
   :type '(choice (const :tag "Off" nil)
@@ -108,15 +112,15 @@ See also `company-dabbrev-time-limit'."
   "A dabbrev-like `company-mode' completion back-end."
   (interactive (list 'interactive))
   (case command
   "A dabbrev-like `company-mode' completion back-end."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-dabbrev))
-    ('prefix (company-grab-word))
-    ('candidates
+    (interactive (company-begin-backend 'company-dabbrev))
+    (prefix (company-grab-word))
+    (candidates
      (mapcar 'downcase
              (company-dabbrev--search (company-dabbrev--make-regexp arg)
                                       company-dabbrev-time-limit
                                       company-dabbrev-other-buffers)))
      (mapcar 'downcase
              (company-dabbrev--search (company-dabbrev--make-regexp arg)
                                       company-dabbrev-time-limit
                                       company-dabbrev-other-buffers)))
-    ('ignore-case t)
-    ('duplicates t)))
+    (ignore-case t)
+    (duplicates t)))
 
 (provide 'company-dabbrev)
 ;;; company-dabbrev.el ends here
 
 (provide 'company-dabbrev)
 ;;; company-dabbrev.el ends here
index c4f8be88a421218854cbdf2a7125753104f98742..2bbe99e46f935721642324d9326ce89af8000da6 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-eclim.el --- a company-mode completion back-end for eclim.
+;;; company-eclim.el --- A company-mode completion back-end for eclim.
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -35,7 +39,7 @@
 
 (defcustom company-eclim-executable
   (or (executable-find "eclim") (company-eclim-executable-find))
 
 (defcustom company-eclim-executable
   (or (executable-find "eclim") (company-eclim-executable-find))
-  "*Location of eclim executable"
+  "*Location of eclim executable."
   :group 'company
   :type 'file)
 
   :group 'company
   :type 'file)
 
@@ -127,17 +131,17 @@ Completions only work correctly when the buffer has been saved.
 `company-eclim-auto-save' determines whether to do this automatically."
   (interactive (list 'interactive))
   (case command
 `company-eclim-auto-save' determines whether to do this automatically."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-eclim))
-    ('prefix (and (derived-mode-p 'java-mode 'jde-mode)
-                  buffer-file-name
-                  company-eclim-executable
-                  (company-eclim--project-name)
-                  (not (company-in-string-or-comment))
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates (company-eclim--candidates arg))
-    ('meta (cadr (assoc arg company-eclim--doc)))
+    (interactive (company-begin-backend 'company-eclim))
+    (prefix (and (derived-mode-p 'java-mode 'jde-mode)
+                 buffer-file-name
+                 company-eclim-executable
+                 (company-eclim--project-name)
+                 (not (company-in-string-or-comment))
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (company-eclim--candidates arg))
+    (meta (cadr (assoc arg company-eclim--doc)))
     ;; because "" doesn't return everything
     ;; because "" doesn't return everything
-    ('no-cache (equal arg ""))))
+    (no-cache (equal arg ""))))
 
 (provide 'company-eclim)
 ;;; company-eclim.el ends here
 
 (provide 'company-eclim)
 ;;; company-eclim.el ends here
index 5d71ddfe023a42304e53b0facab3b1a25cfa6991..b4a3aa36ecbd6b0492a41ca8376c07c150b8a6ca 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-elisp.el --- a company-mode completion back-end for emacs-lisp-mode
+;;; company-elisp.el --- A company-mode completion back-end for emacs-lisp-mode
 
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -26,7 +30,7 @@
 (require 'help-mode)
 
 (defcustom company-elisp-detect-function-context t
 (require 'help-mode)
 
 (defcustom company-elisp-detect-function-context t
-  "*If enabled, offer lisp functions only in appropriate contexts.
+  "*If enabled, offer Lisp functions only in appropriate contexts.
 Functions are offered for completion only after ' and \(."
   :group 'company
   :type '(choice (const :tag "Off" nil)
 Functions are offered for completion only after ' and \(."
   :group 'company
   :type '(choice (const :tag "Off" nil)
@@ -113,20 +117,20 @@ Functions are offered for completion only after ' and \(."
   "A `company-mode' completion back-end for `emacs-lisp-mode'."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for `emacs-lisp-mode'."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-elisp))
-    ('prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
-                  (company-grab-lisp-symbol)))
-    ('candidates (company-elisp-candidates arg))
-    ('meta (company-elisp-doc arg))
-    ('doc-buffer (let ((symbol (intern arg)))
-                   (save-window-excursion
-                     (when (or (ignore-errors (describe-function symbol))
-                               (ignore-errors (describe-variable symbol)))
-                       (help-buffer)))))
-    ('location (let ((sym (intern arg)))
-                 (or (ignore-errors (find-definition-noselect sym nil))
-                     (ignore-errors (find-definition-noselect sym 'defvar))
-                     (ignore-errors (find-definition-noselect sym t)))))))
+    (interactive (company-begin-backend 'company-elisp))
+    (prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
+                 (company-grab-lisp-symbol)))
+    (candidates (company-elisp-candidates arg))
+    (meta (company-elisp-doc arg))
+    (doc-buffer (let ((symbol (intern arg)))
+                  (save-window-excursion
+                    (when (or (ignore-errors (describe-function symbol))
+                              (ignore-errors (describe-variable symbol)))
+                      (help-buffer)))))
+    (location (let ((sym (intern arg)))
+                (or (ignore-errors (find-definition-noselect sym nil))
+                    (ignore-errors (find-definition-noselect sym 'defvar))
+                    (ignore-errors (find-definition-noselect sym t)))))))
 
 (provide 'company-elisp)
 ;;; company-elisp.el ends here
 
 (provide 'company-elisp)
 ;;; company-elisp.el ends here
index ce28eca62cbc3ba77832a96e2ac0ea1a793bfa6b..6153b3ba29a4257538e1360f6c5d678b501e5a66 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-etags.el --- a company-mode completion back-end for etags
+;;; company-etags.el --- A company-mode completion back-end for etags
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -57,24 +61,24 @@ buffer automatically."
   "A `company-mode' completion back-end for etags."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for etags."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-etags))
-    ('prefix (and (memq major-mode company-etags-modes)
-                  (not (company-in-string-or-comment))
-                  (require 'etags nil t)
-                  (company-etags-buffer-table)
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates (let ((tags-table-list (company-etags-buffer-table))
-                       (completion-ignore-case nil))
-                   (and (or tags-file-name tags-table-list)
-                        (fboundp 'tags-completion-table)
-                        tags-table-list
-                        (all-completions arg (tags-completion-table)))))
-    ('location (let ((tags-table-list (company-etags-buffer-table)))
-                 (when (fboundp 'find-tag-noselect)
-                   (save-excursion
-                     (let ((buffer (find-tag-noselect arg)))
-                       (cons buffer (with-current-buffer buffer (point))))))))
-    ('sorted t)))
+    (interactive (company-begin-backend 'company-etags))
+    (prefix (and (memq major-mode company-etags-modes)
+                 (not (company-in-string-or-comment))
+                 (require 'etags nil t)
+                 (company-etags-buffer-table)
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (let ((tags-table-list (company-etags-buffer-table))
+                      (completion-ignore-case nil))
+                  (and (or tags-file-name tags-table-list)
+                       (fboundp 'tags-completion-table)
+                       tags-table-list
+                       (all-completions arg (tags-completion-table)))))
+    (location (let ((tags-table-list (company-etags-buffer-table)))
+                (when (fboundp 'find-tag-noselect)
+                  (save-excursion
+                    (let ((buffer (find-tag-noselect arg)))
+                      (cons buffer (with-current-buffer buffer (point))))))))
+    (sorted t)))
 
 (provide 'company-etags)
 ;;; company-etags.el ends here
 
 (provide 'company-etags)
 ;;; company-etags.el ends here
index 26a611e743e7a3b47fa7678f8f9523c64ec0f10e..fdc88ab407e9810060625b9f45bd92f0526ee8a6 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-files.el --- a company-mode completion back-end for file names
+;;; company-files.el --- A company-mode completion back-end for file names
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
 
 ;;;###autoload
 (defun company-files (command &optional arg &rest ignored)
 
 ;;;###autoload
 (defun company-files (command &optional arg &rest ignored)
-  "a `company-mode' completion back-end existing file names."
+  "A `company-mode' completion back-end existing file names."
   (interactive (list 'interactive))
   (case command
   (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
-                      (file-name-directory (directory-file-name arg))) 1))
-    ('sorted t)
-    ('no-cache t)))
+    (interactive (company-begin-backend 'company-files))
+    (prefix (company-files-grab-existing-name))
+    (candidates (company-files-complete arg))
+    (location (cons (dired-noselect
+                     (file-name-directory (directory-file-name arg))) 1))
+    (sorted t)
+    (no-cache t)))
 
 (provide 'company-files)
 ;;; company-files.el ends here
 
 (provide 'company-files)
 ;;; company-files.el ends here
index d98b04f44a23da4df5bdd5301f8e7da06dd44b22..9163e2d4a016e7b2bdea2b2ab26e19b754798409 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-gtags.el --- a company-mode completion back-end for GNU Global
+;;; company-gtags.el --- A company-mode completion back-end for GNU Global
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -26,7 +30,7 @@
 
 (defcustom company-gtags-executable
   (executable-find "global")
 
 (defcustom company-gtags-executable
   (executable-find "global")
-  "*Location of GNU global executable"
+  "*Location of GNU global executable."
   :type 'string
   :group 'company)
 
   :type 'string
   :group 'company)
 
   "A `company-mode' completion back-end for GNU Global."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for GNU Global."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-gtags))
-    ('prefix (and company-gtags-executable
-                  (memq major-mode company-gtags-modes)
-                  (not (company-in-string-or-comment))
-                  (company-gtags--tags-available-p)
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates (company-gtags-fetch-tags arg))
-    ('sorted t)
-    ('location (company-gtags-location arg))))
+    (interactive (company-begin-backend 'company-gtags))
+    (prefix (and company-gtags-executable
+                 (memq major-mode company-gtags-modes)
+                 (not (company-in-string-or-comment))
+                 (company-gtags--tags-available-p)
+                 (or (company-grab-symbol) 'stop)))
+    (candidates (company-gtags-fetch-tags arg))
+    (sorted t)
+    (location (company-gtags-location arg))))
 
 (provide 'company-gtags)
 ;;; company-gtags.el ends here
 
 (provide 'company-gtags)
 ;;; company-gtags.el ends here
index 0b83515336ff9ac64cec5f4353e3c740e2a53ace..0d29dd966ebeb49ca4e2795f64c69fc7997a6f3f 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-ispell.el --- a company-mode completion back-end using ispell
+;;; company-ispell.el --- A company-mode completion back-end using ispell
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -50,13 +54,13 @@ If nil, use `ispell-complete-word-dict'."
   "A `company-mode' completion back-end using ispell."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end using ispell."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-ispell))
-    ('prefix (when (company-ispell-available)
-               (company-grab-word)))
-    ('candidates (lookup-words arg (or company-ispell-dictionary
-                                       ispell-complete-word-dict)))
-    ('sorted t)
-    ('ignore-case t)))
+    (interactive (company-begin-backend 'company-ispell))
+    (prefix (when (company-ispell-available)
+              (company-grab-word)))
+    (candidates (lookup-words arg (or company-ispell-dictionary
+                                      ispell-complete-word-dict)))
+    (sorted t)
+    (ignore-case t)))
 
 (provide 'company-ispell)
 ;;; company-ispell.el ends here
 
 (provide 'company-ispell)
 ;;; company-ispell.el ends here
index 0fb3dc5f3352339cc0ac141a8caf8ed231b5c396..9f76a6b93dd2af133b69779aa425ce728562a2fc 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-keywords.el --- a company back-end for programming language keywords
+;;; company-keywords.el --- A company back-end for programming language keywords
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
   "A `company-mode' back-end for programming language keywords."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' back-end for programming language keywords."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-))
-    ('prefix (and (assq major-mode company-keywords-alist)
-                  (not (company-in-string-or-comment))
-                  (or (company-grab-symbol) 'stop)))
-    ('candidates
+    (interactive (company-begin-backend 'company-))
+    (prefix (and (assq major-mode company-keywords-alist)
+                 (not (company-in-string-or-comment))
+                 (or (company-grab-symbol) 'stop)))
+    (candidates
      (let ((completion-ignore-case nil)
            (symbols (cdr (assq major-mode company-keywords-alist))))
        (all-completions arg (if (consp symbols)
                                 symbols
                               (cdr (assq symbols company-keywords-alist))))))
      (let ((completion-ignore-case nil)
            (symbols (cdr (assq major-mode company-keywords-alist))))
        (all-completions arg (if (consp symbols)
                                 symbols
                               (cdr (assq symbols company-keywords-alist))))))
-    ('sorted t)))
+    (sorted t)))
 
 (provide 'company-keywords)
 ;;; company-keywords.el ends here
 
 (provide 'company-keywords)
 ;;; company-keywords.el ends here
index 5602e50227521b53cd23c532c2e23b01e3d5c5e1..9a235310de96feb63ef9ffb94be8edd21b0d8668 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-nxml.el --- a company-mode completion back-end for nxml-mode
+;;; company-nxml.el --- A company-mode completion back-end for nxml-mode
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -33,8 +37,8 @@
   (replace-regexp-in-string "w" company-nxml-token-regexp
    "<w\\(?::w\\)?\
 \\(?:[ \t\r\n]+w\\(?::w\\)?[ \t\r\n]*=\
   (replace-regexp-in-string "w" company-nxml-token-regexp
    "<w\\(?::w\\)?\
 \\(?:[ \t\r\n]+w\\(?::w\\)?[ \t\r\n]*=\
-[ \t\r\n]*\\(?:\"[^\"]*\"\\|'[^']*'\\)\\)*\
-[ \t\r\n]+\\(w\\(:w\\)?\\)[ \t\r\n]*=[ \t\r\n]*\
+\[ \t\r\n]*\\(?:\"[^\"]*\"\\|'[^']*'\\)\\)*\
+\[ \t\r\n]+\\(w\\(:w\\)?\\)[ \t\r\n]*=[ \t\r\n]*\
 \\(\"\\([^\"]*\\>\\)\\|'\\([^']*\\>\\)\\)\\="
    t t))
 
 \\(\"\\([^\"]*\\>\\)\\|'\\([^']*\\>\\)\\)\\="
    t t))
 
 
 (defun company-nxml-tag (command &optional arg &rest ignored)
   (case command
 
 (defun company-nxml-tag (command &optional arg &rest ignored)
   (case command
-    ('prefix (and (derived-mode-p 'nxml-mode)
-                  rng-validate-mode
-                  (company-grab company-nxml-in-tag-name-regexp 1)))
-    ('candidates (company-nxml-prepared
-                   (company-nxml-all-completions arg
-                    (rng-match-possible-start-tag-names))))
-    ('sorted t)))
+    (prefix (and (derived-mode-p 'nxml-mode)
+                 rng-validate-mode
+                 (company-grab company-nxml-in-tag-name-regexp 1)))
+    (candidates (company-nxml-prepared
+                  (company-nxml-all-completions arg
+                   (rng-match-possible-start-tag-names))))
+    (sorted t)))
 
 (defun company-nxml-attribute (command &optional arg &rest ignored)
   (case command
 
 (defun company-nxml-attribute (command &optional arg &rest ignored)
   (case command
-    ('prefix (and (derived-mode-p 'nxml-mode)
+    (prefix (and (derived-mode-p 'nxml-mode)
                   rng-validate-mode
                   (memq (char-after) '(?\  ?\t ?\n)) ;; outside word
                   (company-grab rng-in-attribute-regex 1)))
                   rng-validate-mode
                   (memq (char-after) '(?\  ?\t ?\n)) ;; outside word
                   (company-grab rng-in-attribute-regex 1)))
-    ('candidates (company-nxml-prepared
-                   (and (rng-adjust-state-for-attribute
-                         lt-pos (- (point) (length arg)))
-                        (company-nxml-all-completions arg
-                         (rng-match-possible-attribute-names)))))
-    ('sorted t)))
+    (candidates (company-nxml-prepared
+                  (and (rng-adjust-state-for-attribute
+                        lt-pos (- (point) (length arg)))
+                       (company-nxml-all-completions arg
+                        (rng-match-possible-attribute-names)))))
+    (sorted t)))
 
 (defun company-nxml-attribute-value (command &optional arg &rest ignored)
   (case command
 
 (defun company-nxml-attribute-value (command &optional arg &rest ignored)
   (case command
-    ('prefix (and (derived-mode-p 'nxml-mode)
-                  rng-validate-mode
-                  (and (memq (char-after) '(?' ?\" ?\  ?\t ?\n)) ;; outside word
-                       (looking-back company-nxml-in-attribute-value-regexp)
-                       (or (match-string-no-properties 4)
-                           (match-string-no-properties 5)
-                           ""))))
-    ('candidates (company-nxml-prepared
-                   (let (attr-start attr-end colon)
-                     (and (looking-back rng-in-attribute-value-regex lt-pos)
-                          (setq colon (match-beginning 2)
-                                attr-start (match-beginning 1)
-                                attr-end (match-end 1))
-                          (rng-adjust-state-for-attribute lt-pos attr-start)
-                          (rng-adjust-state-for-attribute-value
-                           attr-start colon attr-end)
-                          (all-completions arg
-                           (rng-match-possible-value-strings))))))))
+    (prefix (and (derived-mode-p 'nxml-mode)
+                 rng-validate-mode
+                 (and (memq (char-after) '(?' ?\" ?\  ?\t ?\n)) ;; outside word
+                      (looking-back company-nxml-in-attribute-value-regexp)
+                      (or (match-string-no-properties 4)
+                          (match-string-no-properties 5)
+                          ""))))
+    (candidates (company-nxml-prepared
+                  (let (attr-start attr-end colon)
+                    (and (looking-back rng-in-attribute-value-regex lt-pos)
+                         (setq colon (match-beginning 2)
+                               attr-start (match-beginning 1)
+                               attr-end (match-end 1))
+                         (rng-adjust-state-for-attribute lt-pos attr-start)
+                         (rng-adjust-state-for-attribute-value
+                          attr-start colon attr-end)
+                         (all-completions arg
+                          (rng-match-possible-value-strings))))))))
 
 ;;;###autoload
 (defun company-nxml (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `nxml-mode'."
   (interactive (list 'interactive))
   (case command
 
 ;;;###autoload
 (defun company-nxml (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `nxml-mode'."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-nxml))
-    ('prefix (or (company-nxml-tag 'prefix)
-                 (company-nxml-attribute 'prefix)
-                 (company-nxml-attribute-value 'prefix)))
-    ('candidates (cond
-                  ((company-nxml-tag 'prefix)
-                   (company-nxml-tag 'candidates arg))
-                  ((company-nxml-attribute 'prefix)
-                   (company-nxml-attribute 'candidates arg))
-                  ((company-nxml-attribute-value 'prefix)
-                   (sort (company-nxml-attribute-value 'candidates arg)
-                         'string<))))
-    ('sorted t)))
+    (interactive (company-begin-backend 'company-nxml))
+    (prefix (or (company-nxml-tag 'prefix)
+                (company-nxml-attribute 'prefix)
+                (company-nxml-attribute-value 'prefix)))
+    (candidates (cond
+                 ((company-nxml-tag 'prefix)
+                  (company-nxml-tag 'candidates arg))
+                 ((company-nxml-attribute 'prefix)
+                  (company-nxml-attribute 'candidates arg))
+                 ((company-nxml-attribute-value 'prefix)
+                  (sort (company-nxml-attribute-value 'candidates arg)
+                        'string<))))
+    (sorted t)))
 
 (provide 'company-nxml)
 ;;; company-nxml.el ends here
 
 (provide 'company-nxml)
 ;;; company-nxml.el ends here
index 36891e325b1a4762cc76450a7c0746403d158920..a121bbd02c311dda7fa85fd8aadd02eeefb8036e 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-oddmuse.el --- a company-mode completion back-end for oddmuse-mode
+;;; company-oddmuse.el --- A company-mode completion back-end for oddmuse-mode
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
 
 (defun company-oddmuse-get-page-table ()
   (case major-mode
 
 (defun company-oddmuse-get-page-table ()
   (case major-mode
-    ('yaoddmuse-mode (with-no-warnings
-                       (yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
-    ('oddmuse-mode (with-no-warnings
-                     (oddmuse-make-completion-table oddmuse-wiki)))))
+    (yaoddmuse-mode (with-no-warnings
+                      (yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
+    (oddmuse-mode (with-no-warnings
+                    (oddmuse-make-completion-table oddmuse-wiki)))))
 
 ;;;###autoload
 (defun company-oddmuse (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `oddmuse-mode'."
   (interactive (list 'interactive))
   (case command
 
 ;;;###autoload
 (defun company-oddmuse (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `oddmuse-mode'."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-oddmuse))
-    ('prefix (let ((case-fold-search nil))
-               (and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
-                    (looking-back company-oddmuse-link-regexp (point-at-bol))
-                    (or (match-string 1)
-                        (match-string 2)))))
-    ('candidates (all-completions arg (company-oddmuse-get-page-table)))))
+    (interactive (company-begin-backend 'company-oddmuse))
+    (prefix (let ((case-fold-search nil))
+              (and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
+                   (looking-back company-oddmuse-link-regexp (point-at-bol))
+                   (or (match-string 1)
+                       (match-string 2)))))
+    (candidates (all-completions arg (company-oddmuse-get-page-table)))))
 
 (provide 'company-oddmuse)
 ;;; company-oddmuse.el ends here
 
 (provide 'company-oddmuse)
 ;;; company-oddmuse.el ends here
index 8a5dcbe5cabab986649bbcc8e7861c41e6bd42fd..88a4c38ad8003d355b0b4d1de5d866d8b6c41058 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-pysmell.el --- a company-mode completion back-end for pysmell.el
+;;; company-pysmell.el --- A company-mode completion back-end for pysmell.el
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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:
 
 (eval-when-compile (require 'cl))
 ;;; Code:
 
 (eval-when-compile (require 'cl))
 This requires pysmell.el and pymacs.el."
   (interactive (list 'interactive))
   (case command
 This requires pysmell.el and pymacs.el."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-pysmell))
-    ('prefix (and (derived-mode-p 'python-mode)
-                  buffer-file-name
-                  (not (company-in-string-or-comment))
-                  (company-pysmell--available-p)
-                  (company-pysmell--grab-symbol)))
-    ('candidates (delete "" (pysmell-get-all-completions)))))
+    (interactive (company-begin-backend 'company-pysmell))
+    (prefix (and (derived-mode-p 'python-mode)
+                 buffer-file-name
+                 (not (company-in-string-or-comment))
+                 (company-pysmell--available-p)
+                 (company-pysmell--grab-symbol)))
+    (candidates (delete "" (pysmell-get-all-completions)))))
 
 (provide 'company-pysmell)
 ;;; company-pysmell.el ends here
 
 (provide 'company-pysmell)
 ;;; company-pysmell.el ends here
index f92d5ce6bf696a96e0e1022127412673d7be4dc2..008630cf926cd241a68ede7c582ffc524defa463 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-ropemacs.el --- a company-mode completion back-end for pysmell.el
+;;; company-ropemacs.el --- A company-mode completion back-end for pysmell.el
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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:
 
 (eval-when-compile (require 'cl))
 ;;; Code:
 
 (eval-when-compile (require 'cl))
   "A `company-mode' completion back-end for ropemacs."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for ropemacs."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-ropemacs))
-    ('prefix (and (derived-mode-p 'python-mode)
-                  (not (company-in-string-or-comment))
-                  (company-ropemacs--grab-symbol)))
-    ('candidates (mapcar (lambda (element) (concat arg element))
-                         (rope-completions)))
-    ('doc-buffer (company-ropemacs-doc-buffer arg))
-    ('location (company-ropemacs-location arg))))
+    (interactive (company-begin-backend 'company-ropemacs))
+    (prefix (and (derived-mode-p 'python-mode)
+                 (not (company-in-string-or-comment))
+                 (company-ropemacs--grab-symbol)))
+    (candidates (mapcar (lambda (element) (concat arg element))
+                        (rope-completions)))
+    (doc-buffer (company-ropemacs-doc-buffer arg))
+    (location (company-ropemacs-location arg))))
 
 (provide 'company-ropemacs)
 ;;; company-ropemacs.el ends here
 
 (provide 'company-ropemacs)
 ;;; company-ropemacs.el ends here
index da0a5d3d8907d9948e94c148671ff9a06ab80d6d..bc097fbacf96c0fdacd9ad8dbc402b5335aabd45 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-semantic.el --- a company-mode back-end using CEDET Semantic
+;;; company-semantic.el --- A company-mode back-end using CEDET Semantic
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
@@ -34,7 +38,7 @@
 (defvar company-semantic-modes '(c-mode c++-mode jde-mode java-mode))
 
 (defvar company-semantic--current-tags nil
 (defvar company-semantic-modes '(c-mode c++-mode jde-mode java-mode))
 
 (defvar company-semantic--current-tags nil
-  "Tags for the current context")
+  "Tags for the current context.")
 
 (defun company-semantic-doc-or-summary (tag)
   (or (semantic-documentation-for-tag tag)
 
 (defun company-semantic-doc-or-summary (tag)
   (or (semantic-documentation-for-tag tag)
@@ -101,25 +105,25 @@ Symbols are chained by \".\" or \"->\"."
   "A `company-mode' completion back-end using CEDET Semantic."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end using CEDET Semantic."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-semantic))
-    ('prefix (and (memq major-mode company-semantic-modes)
-                  (semantic-active-p)
-                  (not (company-in-string-or-comment))
-                  (or (company-semantic--grab) 'stop)))
-    ('candidates (if (and (equal arg "")
-                          (not (looking-back "->\\|\\.")))
-                     (company-semantic-completions-raw arg)
-                   (company-semantic-completions arg)))
-    ('meta (funcall company-semantic-metadata-function
-                    (assoc arg company-semantic--current-tags)))
-    ('doc-buffer (company-semantic-doc-buffer
-                  (assoc arg company-semantic--current-tags)))
-    ;; because "" is an empty context and doesn't return local variables
-    ('no-cache (equal arg ""))
-    ('location (let ((tag (assoc arg company-semantic--current-tags)))
-                 (when (buffer-live-p (semantic-tag-buffer tag))
-                   (cons (semantic-tag-buffer tag)
-                         (semantic-tag-start tag)))))))
+    (interactive (company-begin-backend 'company-semantic))
+    (prefix (and (memq major-mode company-semantic-modes)
+                 (semantic-active-p)
+                 (not (company-in-string-or-comment))
+                 (or (company-semantic--grab) 'stop)))
+    (candidates (if (and (equal arg "")
+                         (not (looking-back "->\\|\\.")))
+                    (company-semantic-completions-raw arg)
+                  (company-semantic-completions arg)))
+    (meta (funcall company-semantic-metadata-function
+                   (assoc arg company-semantic--current-tags)))
+    (doc-buffer (company-semantic-doc-buffer
+                 (assoc arg company-semantic--current-tags)))
+    ;; Because "" is an empty context and doesn't return local variables.
+    (no-cache (equal arg ""))
+    (location (let ((tag (assoc arg company-semantic--current-tags)))
+                (when (buffer-live-p (semantic-tag-buffer tag))
+                  (cons (semantic-tag-buffer tag)
+                        (semantic-tag-start tag)))))))
 
 (provide 'company-semantic)
 ;;; company-semantic.el ends here
 
 (provide 'company-semantic)
 ;;; company-semantic.el ends here
index d1fe8ed83acfddc4dd0789147304349ea254ad47..bc3408935ca103e06d0f45110980a53b8d8b5e43 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-tempo.el --- a company-mode completion back-end for tempo
+;;; company-tempo.el --- A company-mode completion back-end for tempo
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 
 
 ;; 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/>.
 
 ;; 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)
 ;;; Code:
 
 (require 'company)
   "A `company-mode' completion back-end for tempo."
   (interactive (list 'interactive))
   (case command
   "A `company-mode' completion back-end for tempo."
   (interactive (list 'interactive))
   (case command
-    ('interactive (company-begin-backend 'company-tempo
-                                         'company-tempo-insert))
-    ('prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
-    ('candidates (all-completions arg (tempo-build-collection)))
-    ('meta (company-tempo-meta arg))
-    ('require-match t)
-    ('sorted t)))
+    (interactive (company-begin-backend 'company-tempo
+                                        'company-tempo-insert))
+    (prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
+    (candidates (all-completions arg (tempo-build-collection)))
+    (meta (company-tempo-meta arg))
+    (require-match t)
+    (sorted t)))
 
 (provide 'company-tempo)
 ;;; company-tempo.el ends here
 
 (provide 'company-tempo)
 ;;; company-tempo.el ends here
index 079ecb44a554bd456e3942f9a520d82e367d5d60..1c6576453b7894d3bb02f7243c849581d483e3ea 100644 (file)
@@ -1,6 +1,6 @@
-;;; company-xcode.el --- a company-mode completion back-end for Xcode projects
+;;; company-xcode.el --- A 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
 
 
 ;; 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/>.
 
 ;; 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))
 
 (defcustom company-xcode-xcodeindex-executable (executable-find "xcodeindex")
 ;;; Code:
 
 (require 'company)
 (eval-when-compile (require 'cl))
 
 (defcustom company-xcode-xcodeindex-executable (executable-find "xcodeindex")
-  "*Location of xcodeindex executable"
+  "*Location of xcodeindex executable."
   :group 'company-xcode
   :type 'file)
 
   :group 'company-xcode
   :type 'file)
 
@@ -39,7 +43,7 @@
 (defcustom company-xcode-types
   '("Class" "Constant" "Enum" "Macro" "Modeled Class" "Structure"
     "Type" "Union" "Function")
 (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."
 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."
@@ -104,14 +108,14 @@ valid in most contexts."
   "A `company-mode' completion back-end for Xcode projects."
   (interactive (list 'interactive))
   (case command
   "A `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)
                   (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)
 
 
 (provide 'company-xcode)
index 8249525132c9dead5cec5e817ab0c5457627f0ae..5314ef601ec9ba67ef40ea1dfd2f85d0687f9f7e 100644 (file)
@@ -1,11 +1,11 @@
-;;; company.el --- extensible inline text completion mechanism
+;;; company.el --- Extensible inline text completion mechanism
 
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
 ;; Author: Nikolaj Schumacher
 ;; Version: 0.5
 ;; Keywords: abbrev, convenience, matching
 
 ;; Author: Nikolaj Schumacher
 ;; Version: 0.5
 ;; Keywords: abbrev, convenience, matching
-;; URL: http://nschum.de/src/emacs/company/
+;; URL: http://nschum.de/src/emacs/company-mode/
 ;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
 
 ;; This file is part of GNU Emacs.
 ;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
 
 ;; This file is part of GNU Emacs.
 ;;
 ;; (defun company-my-backend (command &optional arg &rest ignored)
 ;;   (case command
 ;;
 ;; (defun company-my-backend (command &optional arg &rest ignored)
 ;;   (case command
-;;     ('prefix (when (looking-back "foo\\>")
+;;     (prefix (when (looking-back "foo\\>")
 ;;                (match-string 0)))
 ;;                (match-string 0)))
-;;     ('candidates (list "foobar" "foobaz" "foobarbaz"))
-;;     ('meta (format "This value is named %s" arg))))
+;;     (candidates (list "foobar" "foobaz" "foobarbaz"))
+;;     (meta (format "This value is named %s" arg))))
 ;;
 ;; Sometimes it is a good idea to mix two back-ends together, for example to
 ;; enrich gtags with dabbrev-code results (to emulate local variables):
 ;;
 ;; Sometimes it is a good idea to mix two back-ends together, for example to
 ;; enrich gtags with dabbrev-code results (to emulate local variables):
@@ -307,7 +307,29 @@ If this many lines are not available, prefer to display the tooltip above."
                         (assq backend company-safe-backends))
                 (return t))))))
 
                         (assq backend company-safe-backends))
                 (return t))))))
 
-(defcustom company-backends '(company-elisp company-nxml company-css
+(defun company-capf (command &optional arg &rest args)
+  "Adapter for Company completion to use `completion-at-point-functions'."
+  (interactive (list 'interactive))
+  (case command
+    (interactive (company-begin-backend 'company-capf))
+    (prefix
+     (let ((res (run-hook-wrapped 'completion-at-point-functions
+                                  ;; Ignore misbehaving functions.
+                                  #'completion--capf-wrapper 'optimist)))
+       (when (consp res)
+         (if (> (nth 1 res) (point))
+             'stop
+           (buffer-substring-no-properties (nth 0 res) (point))))))
+    (candidates
+     (let ((res (run-hook-wrapped 'completion-at-point-functions
+                                  ;; Ignore misbehaving functions.
+                                  #'completion--capf-wrapper 'optimist)))
+       (when (consp res)
+         (all-completions arg (nth 2 res)
+                          (plist-get (nthcdr 3 res) :predicate)))))))
+
+(defcustom company-backends '(;; company-capf ;FIXME: Untested!
+                              company-elisp company-nxml company-css
                               company-eclim company-semantic company-clang
                               company-xcode company-ropemacs
                               (company-gtags company-etags company-dabbrev-code
                               company-eclim company-semantic company-clang
                               company-xcode company-ropemacs
                               (company-gtags company-etags company-dabbrev-code
@@ -325,7 +347,7 @@ Each back-end is a function that takes a variable number of arguments.
 The first argument is the command requested from the back-end.  It is one
 of the following:
 
 The first argument is the command requested from the back-end.  It is one
 of the following:
 
-'prefix: The back-end should return the text to be completed.  It must be
+`prefix': The back-end should return the text to be completed.  It must be
 text immediately before `point'.  Returning nil passes control to the next
 back-end.  The function should return 'stop if it should complete but cannot
 \(e.g. if it is in the middle of a string\).  If the returned value is only
 text immediately before `point'.  Returning nil passes control to the next
 back-end.  The function should return 'stop if it should complete but cannot
 \(e.g. if it is in the middle of a string\).  If the returned value is only
@@ -333,33 +355,33 @@ part of the prefix (e.g. the part after \"->\" in C), the back-end may return a
 cons of prefix and prefix length, which is then used in the
 `company-minimum-prefix-length' test.
 
 cons of prefix and prefix length, which is then used in the
 `company-minimum-prefix-length' test.
 
-'candidates: The second argument is the prefix to be completed.  The
+`candidates': The second argument is the prefix to be completed.  The
 return value should be a list of candidates that start with the prefix.
 
 Optional commands:
 
 return value should be a list of candidates that start with the prefix.
 
 Optional commands:
 
-'sorted: The back-end may return t here to indicate that the candidates
+`sorted': The back-end may return t here to indicate that the candidates
 are sorted and will not need to be sorted again.
 
 are sorted and will not need to be sorted again.
 
-'duplicates: If non-nil, company will take care of removing duplicates
+`duplicates': If non-nil, company will take care of removing duplicates
 from the list.
 
 from the list.
 
-'no-cache: Usually company doesn't ask for candidates again as completion
+`no-cache': Usually company doesn't ask for candidates again as completion
 progresses, unless the back-end returns t for this command.  The second
 argument is the latest prefix.
 
 progresses, unless the back-end returns t for this command.  The second
 argument is the latest prefix.
 
-'meta: The second argument is a completion candidate.  The back-end should
+`meta': The second argument is a completion candidate.  The back-end should
 return a (short) documentation string for it.
 
 return a (short) documentation string for it.
 
-'doc-buffer: The second argument is a completion candidate.  The back-end should
-create a buffer (preferably with `company-doc-buffer'), fill it with
-documentation and return it.
+`doc-buffer': The second argument is a completion candidate.
+The back-end should create a buffer (preferably with `company-doc-buffer'),
+fill it with documentation and return it.
 
 
-'location: The second argument is a completion candidate.  The back-end can
+`location': The second argument is a completion candidate.  The back-end can
 return the cons of buffer and buffer location, or of file and line
 number where the completion candidate was defined.
 
 return the cons of buffer and buffer location, or of file and line
 number where the completion candidate was defined.
 
-'require-match: If this value is t, the user is not allowed to enter anything
+`require-match': If this value is t, the user is not allowed to enter anything
 not offering as a candidate.  Use with care!  The default value nil gives the
 user that choice with `company-require-match'.  Return value 'never overrides
 that option the other way around.
 not offering as a candidate.  Use with care!  The default value nil gives the
 user that choice with `company-require-match'.  Return value 'never overrides
 that option the other way around.
@@ -694,11 +716,11 @@ keymap during active completions (`company-active-map'):
 
 (defun company--multi-backend-adapter (backends command &rest args)
   (case command
 
 (defun company--multi-backend-adapter (backends command &rest args)
   (case command
-    ('candidates
+    (candidates
      (apply 'append (mapcar (lambda (backend) (apply backend command args))
                             backends)))
      (apply 'append (mapcar (lambda (backend) (apply backend command args))
                             backends)))
-    ('sorted nil)
-    ('duplicates t)
+    (sorted nil)
+    (duplicates t)
     (otherwise
      (let (value)
        (dolist (backend backends)
     (otherwise
      (let (value)
        (dolist (backend backends)
@@ -1800,8 +1822,8 @@ Returns a negative number if the tooltip should be displayed above point."
 (defun company-pseudo-tooltip-frontend (command)
   "A `company-mode' front-end similar to a tool-tip but based on overlays."
   (case command
 (defun company-pseudo-tooltip-frontend (command)
   "A `company-mode' front-end similar to a tool-tip but based on overlays."
   (case command
-    ('pre-command (company-pseudo-tooltip-hide-temporarily))
-    ('post-command
+    (pre-command (company-pseudo-tooltip-hide-temporarily))
+    (post-command
      (let ((old-height (if (overlayp company-pseudo-tooltip-overlay)
                            (overlay-get company-pseudo-tooltip-overlay
                                         'company-height)
      (let ((old-height (if (overlayp company-pseudo-tooltip-overlay)
                            (overlay-get company-pseudo-tooltip-overlay
                                         'company-height)
@@ -1813,9 +1835,9 @@ Returns a negative number if the tooltip should be displayed above point."
          (company-pseudo-tooltip-show-at-point (- (point)
                                                   (length company-prefix)))))
      (company-pseudo-tooltip-unhide))
          (company-pseudo-tooltip-show-at-point (- (point)
                                                   (length company-prefix)))))
      (company-pseudo-tooltip-unhide))
-    ('hide (company-pseudo-tooltip-hide)
+    (hide (company-pseudo-tooltip-hide)
            (setq company-tooltip-offset 0))
            (setq company-tooltip-offset 0))
-    ('update (when (overlayp company-pseudo-tooltip-overlay)
+    (update (when (overlayp company-pseudo-tooltip-overlay)
                (company-pseudo-tooltip-edit company-candidates
                                             company-selection)))))
 
                (company-pseudo-tooltip-edit company-candidates
                                             company-selection)))))
 
@@ -1865,9 +1887,9 @@ Returns a negative number if the tooltip should be displayed above point."
 (defun company-preview-frontend (command)
   "A `company-mode' front-end showing the selection as if it had been inserted."
   (case command
 (defun company-preview-frontend (command)
   "A `company-mode' front-end showing the selection as if it had been inserted."
   (case command
-    ('pre-command (company-preview-hide))
-    ('post-command (company-preview-show-at-point (point)))
-    ('hide (company-preview-hide))))
+    (pre-command (company-preview-hide))
+    (post-command (company-preview-show-at-point (point)))
+    (hide (company-preview-hide))))
 
 (defun company-preview-if-just-one-frontend (command)
   "`company-preview-frontend', but only shown for single candidates."
 
 (defun company-preview-if-just-one-frontend (command)
   "`company-preview-frontend', but only shown for single candidates."
@@ -1963,23 +1985,23 @@ Returns a negative number if the tooltip should be displayed above point."
 (defun company-echo-frontend (command)
   "A `company-mode' front-end showing the candidates in the echo area."
   (case command
 (defun company-echo-frontend (command)
   "A `company-mode' front-end showing the candidates in the echo area."
   (case command
-    ('pre-command (company-echo-show-soon))
-    ('post-command (company-echo-show-soon 'company-echo-format))
-    ('hide (company-echo-hide))))
+    (pre-command (company-echo-show-soon))
+    (post-command (company-echo-show-soon 'company-echo-format))
+    (hide (company-echo-hide))))
 
 (defun company-echo-strip-common-frontend (command)
   "A `company-mode' front-end showing the candidates in the echo area."
   (case command
 
 (defun company-echo-strip-common-frontend (command)
   "A `company-mode' front-end showing the candidates in the echo area."
   (case command
-    ('pre-command (company-echo-show-soon))
-    ('post-command (company-echo-show-soon 'company-echo-strip-common-format))
-    ('hide (company-echo-hide))))
+    (pre-command (company-echo-show-soon))
+    (post-command (company-echo-show-soon 'company-echo-strip-common-format))
+    (hide (company-echo-hide))))
 
 (defun company-echo-metadata-frontend (command)
   "A `company-mode' front-end showing the documentation in the echo area."
   (case command
 
 (defun company-echo-metadata-frontend (command)
   "A `company-mode' front-end showing the documentation in the echo area."
   (case command
-    ('pre-command (company-echo-show-soon))
-    ('post-command (company-echo-show-soon 'company-fetch-metadata))
-    ('hide (company-echo-hide))))
+    (pre-command (company-echo-show-soon))
+    (post-command (company-echo-show-soon 'company-fetch-metadata))
+    (hide (company-echo-hide))))
 
 ;; templates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
 ;; templates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;