-;;; company-keywords.el --- a company back-end for programming language keywords
-;;
-;; Copyright (C) 2009 Nikolaj Schumacher
-;;
-;; This file is part of company 0.5.
-;;
-;; 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, 2016 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 _.
(defvar company-keywords-alist
;; Please contribute corrections or additions.
`((c++-mode
- "asm" "auto" "bool" "break" "case" "catch" "char" "class" "const"
- "const_cast" "continue" "default" "delete" "do" "double" "dynamic_cast"
- "else" "enum" "explicit" "export" "extern" "false" "float" "for" "friend"
- "goto" "if" "inline" "int" "long" "mutable" "namespace" "new"
- "operator" "private" "protected" "public" "register" "reinterpret_cast"
- "return" "short" "signed" "sizeof" "static" "static_cast" "struct" "switch"
- "template" "this" "throw" "true" "try" "typedef" "typeid" "typename"
+ "alignas" "alignof" "asm" "auto" "bool" "break" "case" "catch" "char"
+ "char16_t" "char32_t" "class" "const" "const_cast" "constexpr" "continue"
+ "decltype" "default" "delete" "do" "double" "dynamic_cast" "else" "enum"
+ "explicit" "export" "extern" "false" "final" "float" "for" "friend"
+ "goto" "if" "inline" "int" "long" "mutable" "namespace" "new" "noexcept"
+ "nullptr" "operator" "override"
+ "private" "protected" "public" "register" "reinterpret_cast"
+ "return" "short" "signed" "sizeof" "static" "static_assert"
+ "static_cast" "struct" "switch" "template" "this" "thread_local"
+ "throw" "true" "try" "typedef" "typeid" "typename"
"union" "unsigned" "using" "virtual" "void" "volatile" "wchar_t" "while")
(c-mode
"auto" "break" "case" "char" "const" "continue" "default" "do"
"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")
+ (julia-mode
+ "abstract" "break" "case" "catch" "const" "continue" "do" "else" "elseif"
+ "end" "eval" "export" "false" "finally" "for" "function" "global" "if"
+ "ifelse" "immutable" "import" "importall" "in" "let" "macro" "module"
+ "otherwise" "quote" "return" "switch" "throw" "true" "try" "type"
+ "typealias" "using" "while"
+ )
;; 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'.")
+ (jde-mode . java-mode)
+ (ess-julia-mode . julia-mode))
+ "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
-
-