]> code.delx.au - gnu-emacs-elpa/blobdiff - company-keywords.el
Add support for company-face
[gnu-emacs-elpa] / company-keywords.el
index d640932242f6c28ec1eeadb2d5e18b9ae42da19b..f0c6ca63f5ad6dc835c79c065e1f94c8c2f845fd 100644 (file)
@@ -1,24 +1,32 @@
-;;; company-keywords.el --- a company back-end for programming language keywords
-;;
-;; Copyright (C) 2009 Nikolaj Schumacher
-;;
-;; This file is part of company 0.4.3.
-;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License
-;; as published by the Free Software Foundation; either version 2
-;; of the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
+;;; company-keywords.el --- A company backend for programming language keywords
+
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
+
+;; Author: Nikolaj Schumacher
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
-;;
+
 ;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Commentary:
+;;
+
+;;; Code:
 
 (require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 
 (defun company-keywords-upper-lower (&rest lst)
   ;; Upcase order is different for _.
      "except" "exec" "finally" "for" "from" "global" "if" "import" "in" "is"
      "lambda" "not" "or" "pass" "print" "raise" "return" "try" "while" "yield")
     (ruby-mode
-     "BEGIN" "END" "alias" "and"  "begin" "break" "case" "class" "def" "defined"
+     "BEGIN" "END" "alias" "and"  "begin" "break" "case" "class" "def" "defined?"
      "do" "else" "elsif"  "end" "ensure" "false" "for" "if" "in" "module"
      "next" "nil" "not" "or" "redo" "rescue" "retry" "return" "self" "super"
      "then" "true" "undef" "unless" "until" "when" "while" "yield")
+    (scala-mode
+     "abstract" "case" "catch" "class" "def" "do" "else" "extends" "false"
+     "final" "finally" "for" "forSome" "if" "implicit" "import" "lazy" "match"
+     "new" "null" "object" "override" "package" "private" "protected"
+     "return" "sealed" "super" "this" "throw" "trait" "true" "try" "type" "val"
+     "var" "while" "with" "yield")
     ;; aliases
     (js2-mode . javascript-mode)
     (espresso-mode . javascript-mode)
+    (js-mode . javascript-mode)
     (cperl-mode . perl-mode)
     (jde-mode . java-mode))
-  "*Alist mapping major-modes to sorted keywords for `company-keywords'.")
+  "Alist mapping major-modes to sorted keywords for `company-keywords'.")
 
 ;;;###autoload
 (defun company-keywords (command &optional arg &rest ignored)
-  "A `company-mode' back-end for programming language keywords."
+  "`company-mode' backend 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
+  (cl-case command
+    (interactive (company-begin-backend 'company-keywords))
+    (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))))))
-    ('sorted t)))
+    (sorted t)))
 
 (provide 'company-keywords)
 ;;; company-keywords.el ends here
-
-