config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

cape-keyword.el (27013B)


      1 ;;; cape-keyword.el --- Keyword completion function -*- lexical-binding: t -*-
      2 
      3 ;; Copyright (C) 2021-2024 Free Software Foundation, Inc.
      4 
      5 ;; This file is part of GNU Emacs.
      6 
      7 ;; This program is free software: you can redistribute it and/or modify
      8 ;; it under the terms of the GNU General Public License as published by
      9 ;; the Free Software Foundation, either version 3 of the License, or
     10 ;; (at your option) any later version.
     11 
     12 ;; This program is distributed in the hope that it will be useful,
     13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 ;; GNU General Public License for more details.
     16 
     17 ;; You should have received a copy of the GNU General Public License
     18 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19 
     20 ;;; Commentary:
     21 
     22 ;; This package provides the `cape-keyword' completion function.
     23 
     24 ;;; Code:
     25 
     26 (require 'cape)
     27 
     28 (defcustom cape-keyword-list
     29   ;; This variable was taken from company-keywords.el.
     30   ;; Please contribute corrections or additions to both Cape and Company.
     31   '((c++-mode ;; https://en.cppreference.com/w/cpp/keyword
     32      "alignas" "alignof" "and" "and_eq" "asm" "atomic_cancel" "atomic_commit"
     33      "atomic_noexcept" "auto" "bitand" "bitor" "bool" "break" "case" "catch"
     34      "char" "char16_t" "char32_t" "char8_t" "class" "co_await" "co_return"
     35      "co_yield" "compl" "concept" "const" "const_cast" "consteval" "constexpr"
     36      "constinit" "continue" "decltype" "default" "delete" "do" "double"
     37      "dynamic_cast" "else" "enum" "explicit" "export" "extern" "false" "final"
     38      "float" "for" "friend" "goto" "if" "import" "inline" "int" "long" "module"
     39      "mutable" "namespace" "new" "noexcept" "not" "not_eq" "nullptr" "operator"
     40      "or" "or_eq" "override" "private" "protected" "public" "reflexpr"
     41      "register" "reinterpret_cast" "requires" "return" "short" "signed" "sizeof"
     42      "static" "static_assert" "static_cast" "struct" "switch" "synchronized"
     43      "template" "this" "thread_local" "throw" "true" "try" "typedef" "typeid"
     44      "typename" "union" "unsigned" "using" "virtual" "void" "volatile" "wchar_t"
     45      "while" "xor" "xor_eq")
     46     (c-mode ;; https://en.cppreference.com/w/c/keyword
     47      "_Alignas" "_Alignof" "_Atomic" "_Bool" "_Complex" "_Decimal128"
     48      "_Decimal32" "_Decimal64" "_Generic" "_Imaginary" "_Noreturn"
     49      "_Static_assert" "_Thread_local" "__asm__" "asm" "auto" "break" "case"
     50      "char" "const" "continue" "default" "do" "double" "else" "enum" "extern"
     51      "float" "for" "goto" "if" "inline" "int" "long" "register" "restrict"
     52      "return" "short" "signed" "sizeof" "static" "struct" "switch" "typedef"
     53      "union" "unsigned" "void" "volatile" "while")
     54     (caml-mode  ;; ocaml, from https://v2.ocaml.org/manual/lex.html#sss:keywords
     55      "and" "as" "asr" "assert" "begin" "class" "constraint" "do" "done" "downto"
     56      "else" "end" "exception" "external" "false" "for" "fun" "function"
     57      "functor" "if" "in" "include" "inherit" "initializer" "land" "lazy" "let"
     58      "lor" "lsl" "lsr" "lxor" "match" "method" "mod" "module" "mutable" "new"
     59      "nonrec" "object" "of" "open" "or" "private" "rec" "sig" "struct" "then"
     60      "to" "true" "try" "type" "val" "virtual" "when" "while" "with")
     61     (crystal-mode ;; https://github.com/crystal-lang/crystal-book "abstract"
     62      "alias" "annotation" "as" "as?" "asm" "begin" "break" "case" "class" "def"
     63      "do" "else" "elsif" "end" "ensure" "enum" "extend" "false" "for" "fun" "if"
     64      "in" "include" "instance_sizeof" "is_a?" "lib" "macro" "module" "next"
     65      "nil" "nil?" "of" "offsetof" "out" "pointerof" "private" "protected"
     66      "require" "rescue" "responds_to?" "return" "select" "self" "sizeof"
     67      "struct" "super" "then" "true" "type" "typeof" "uninitialized" "union"
     68      "unless" "until" "verbatim" "when" "while" "with" "yield")
     69     (csharp-mode
     70      "abstract" "add" "alias" "as" "base" "bool" "break" "byte" "case" "catch"
     71      "char" "checked" "class" "const" "continue" "decimal" "default" "delegate"
     72      "do" "double" "else" "enum" "event" "explicit" "extern" "false" "finally"
     73      "fixed" "float" "for" "foreach" "get" "global" "goto" "if" "implicit" "in"
     74      "int" "interface" "internal" "is" "lock" "long" "namespace" "new" "null"
     75      "object" "operator" "out" "override" "params" "partial" "private"
     76      "protected" "public" "readonly" "ref" "remove" "return" "sbyte" "sealed"
     77      "set" "short" "sizeof" "stackalloc" "static" "string" "struct" "switch"
     78      "this" "throw" "true" "try" "typeof" "uint" "ulong" "unchecked" "unsafe"
     79      "ushort" "using" "value" "var" "virtual" "void" "volatile" "where" "while"
     80      "yield")
     81     (d-mode ;; https://www.digitalmars.com/d/2.0/lex.html
     82      "abstract" "alias" "align" "asm"
     83      "assert" "auto" "body" "bool" "break" "byte" "case" "cast" "catch"
     84      "cdouble" "cent" "cfloat" "char" "class" "const" "continue" "creal"
     85      "dchar" "debug" "default" "delegate" "delete" "deprecated" "do"
     86      "double" "else" "enum" "export" "extern" "false" "final" "finally"
     87      "float" "for" "foreach" "foreach_reverse" "function" "goto" "idouble"
     88      "if" "ifloat" "import" "in" "inout" "int" "interface" "invariant"
     89      "ireal" "is" "lazy" "long" "macro" "mixin" "module" "new" "nothrow"
     90      "null" "out" "override" "package" "pragma" "private" "protected"
     91      "public" "pure" "real" "ref" "return" "scope" "short" "static" "struct"
     92      "super" "switch" "synchronized" "template" "this" "throw" "true" "try"
     93      "typedef" "typeid" "typeof" "ubyte" "ucent" "uint" "ulong" "union"
     94      "unittest" "ushort" "version" "void" "volatile" "wchar" "while" "with")
     95     (elixir-mode ;; https://hexdocs.pm/elixir/Kernel.html
     96      "__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__"
     97      "__aliases__" "__block__" "abs" "alias" "alias!" "and" "apply"
     98      "binary_part" "binary_slice" "binding" "bit_size" "byte_size" "case" "ceil"
     99      "cond" "dbg" "def" "defdelegate" "defexception" "defguard" "defguardp"
    100      "defimpl" "defmacro" "defmacrop" "defmodule" "defoverridable" "defp"
    101      "defprotocol" "defstruct" "destructure" "div" "elem" "exit" "floor" "fn"
    102      "for" "function_exported?" "get_and_update_in" "get_in" "hd" "if" "import"
    103      "in" "inspect" "is_atom" "is_binary" "is_bitstring" "is_boolean"
    104      "is_exception" "is_float" "is_function" "is_integer" "is_list" "is_map"
    105      "is_map_key" "is_nil" "is_number" "is_pid" "is_port" "is_reference"
    106      "is_struct" "is_tuple" "length" "macro_exported?" "make_ref" "map_size"
    107      "match?" "max" "min" "node" "not" "or" "pop_in" "put_elem" "put_in" "quote"
    108      "raise" "receive" "rem" "require" "reraise" "round" "self" "send" "spawn"
    109      "spawn_link" "spawn_monitor" "struct" "struct!" "super" "tap" "then"
    110      "throw" "tl" "to_charlist" "to_string" "trunc" "try" "tuple_size" "unless"
    111      "unquote" "unquote_splicing" "update_in" "use" "var!" "with")
    112     (erlang-mode ;; https://www.erlang.org/docs/20/reference_manual/introduction.html
    113      "after" "and" "andalso" "band" "begin" "bnot" "bor" "bsl" "bsr" "bxor"
    114      "case" "catch" "cond" "div" "end" "fun" "if" "let" "not" "of" "or" "orelse"
    115      "receive" "rem" "try" "when" "xor")
    116     (f90-mode ;; f90.el
    117      "abs" "abstract" "achar" "acos" "adjustl" "adjustr" "aimag" "aint" "align"
    118      "all" "all_prefix" "all_scatter" "all_suffix" "allocatable" "allocate"
    119      "allocated" "and" "anint" "any" "any_prefix" "any_scatter" "any_suffix"
    120      "asin" "assign" "assignment" "associate" "associated" "asynchronous" "atan"
    121      "atan2" "backspace" "bind" "bit_size" "block" "btest" "c_alert"
    122      "c_associated" "c_backspace" "c_bool" "c_carriage_return" "c_char"
    123      "c_double" "c_double_complex" "c_f_pointer" "c_f_procpointer" "c_float"
    124      "c_float_complex" "c_form_feed" "c_funloc" "c_funptr" "c_horizontal_tab"
    125      "c_int" "c_int16_t" "c_int32_t" "c_int64_t" "c_int8_t" "c_int_fast16_t"
    126      "c_int_fast32_t" "c_int_fast64_t" "c_int_fast8_t" "c_int_least16_t"
    127      "c_int_least32_t" "c_int_least64_t" "c_int_least8_t" "c_intmax_t"
    128      "c_intptr_t" "c_loc" "c_long" "c_long_double" "c_long_double_complex"
    129      "c_long_long" "c_new_line" "c_null_char" "c_null_funptr" "c_null_ptr"
    130      "c_ptr" "c_short" "c_signed_char" "c_size_t" "c_vertical_tab" "call" "case"
    131      "ceiling" "char" "character" "character_storage_size" "class" "close"
    132      "cmplx" "command_argument_count" "common" "complex" "conjg" "contains"
    133      "continue" "copy_prefix" "copy_scatter" "copy_suffix" "cos" "cosh" "count"
    134      "count_prefix" "count_scatter" "count_suffix" "cpu_time" "cshift" "cycle"
    135      "cyclic" "data" "date_and_time" "dble" "deallocate" "deferred" "digits"
    136      "dim" "dimension" "distribute" "do" "dot_product" "double" "dprod"
    137      "dynamic" "elemental" "else" "elseif" "elsewhere" "end" "enddo" "endfile"
    138      "endif" "entry" "enum" "enumerator" "eoshift" "epsilon" "eq" "equivalence"
    139      "eqv" "error_unit" "exit" "exp" "exponent" "extends" "extends_type_of"
    140      "external" "extrinsic" "false" "file_storage_size" "final" "floor" "flush"
    141      "forall" "format" "fraction" "function" "ge" "generic" "get_command"
    142      "get_command_argument" "get_environment_variable" "goto" "grade_down"
    143      "grade_up" "gt" "hpf_alignment" "hpf_distribution" "hpf_template" "huge"
    144      "iachar" "iall" "iall_prefix" "iall_scatter" "iall_suffix" "iand" "iany"
    145      "iany_prefix" "iany_scatter" "iany_suffix" "ibclr" "ibits" "ibset" "ichar"
    146      "ieee_arithmetic" "ieee_exceptions" "ieee_features"
    147      "ieee_get_underflow_mode" "ieee_set_underflow_mode"
    148      "ieee_support_underflow_control" "ieor" "if" "ilen" "implicit" "import"
    149      "include" "independent" "index" "inherit" "input_unit" "inquire" "int"
    150      "integer" "intent" "interface" "intrinsic" "ior" "iostat_end" "iostat_eor"
    151      "iparity" "iparity_prefix" "iparity_scatter" "iparity_suffix" "ishft"
    152      "ishftc" "iso_c_binding" "iso_fortran_env" "kind" "lbound" "le" "leadz"
    153      "len" "len_trim" "lge" "lgt" "lle" "llt" "log" "log10" "logical" "lt"
    154      "matmul" "max" "maxexponent" "maxloc" "maxval" "maxval_prefix"
    155      "maxval_scatter" "maxval_suffix" "merge" "min" "minexponent" "minloc"
    156      "minval" "minval_prefix" "minval_scatter" "minval_suffix" "mod" "module"
    157      "modulo" "move_alloc" "mvbits" "namelist" "ne" "nearest" "neqv" "new"
    158      "new_line" "nint" "non_intrinsic" "non_overridable" "none" "nopass" "not"
    159      "null" "nullify" "number_of_processors" "numeric_storage_size" "only"
    160      "onto" "open" "operator" "optional" "or" "output_unit" "pack" "parameter"
    161      "parity" "parity_prefix" "parity_scatter" "parity_suffix" "pass" "pause"
    162      "pointer" "popcnt" "poppar" "precision" "present" "print" "private"
    163      "procedure" "processors" "processors_shape" "product" "product_prefix"
    164      "product_scatter" "product_suffix" "program" "protected" "public" "pure"
    165      "radix" "random_number" "random_seed" "range" "read" "real" "realign"
    166      "recursive" "redistribute" "repeat" "reshape" "result" "return" "rewind"
    167      "rrspacing" "same_type_as" "save" "scale" "scan" "select"
    168      "selected_char_kind" "selected_int_kind" "selected_real_kind" "sequence"
    169      "set_exponent" "shape" "sign" "sin" "sinh" "size" "spacing" "spread" "sqrt"
    170      "stop" "subroutine" "sum" "sum_prefix" "sum_scatter" "sum_suffix"
    171      "system_clock" "tan" "tanh" "target" "template" "then" "tiny" "transfer"
    172      "transpose" "trim" "true" "type" "ubound" "unpack" "use" "value" "verify"
    173      "volatile" "wait" "where" "while" "with" "write")
    174     (go-mode ;; https://golang.org/ref/spec#Keywords, https://golang.org/pkg/builtin/
    175      "append" "bool" "break" "byte" "cap" "case" "chan" "close" "complex"
    176      "complex128" "complex64" "const" "continue" "copy" "default" "defer"
    177      "delete" "else" "error" "fallthrough" "false" "float32" "float64" "for"
    178      "func" "go" "goto" "if" "imag" "import" "int" "int16" "int32" "int64"
    179      "int8" "interface" "len" "make" "map" "new" "nil" "package" "panic" "print"
    180      "println" "range" "real" "recover" "return" "rune" "select" "string"
    181      "struct" "switch" "true" "type" "uint" "uint16" "uint32" "uint64" "uint8"
    182      "uintptr" "var")
    183     (java-mode
    184      "abstract" "assert" "boolean" "break" "byte" "case" "catch" "char" "class"
    185      "continue" "default" "do" "double" "else" "enum" "extends" "final"
    186      "finally" "float" "for" "if" "implements" "import" "instanceof" "int"
    187      "interface" "long" "native" "new" "package" "private" "protected" "public"
    188      "return" "short" "static" "strictfp" "super" "switch" "synchronized" "this"
    189      "throw" "throws" "transient" "try" "void" "volatile" "while")
    190     (javascript-mode ;; https://tc39.github.io/ecma262/
    191      "async" "await" "break" "case" "catch" "class" "const" "continue"
    192      "debugger" "default" "delete" "do" "else" "enum" "export" "extends" "false"
    193      "finally" "for" "function" "if" "import" "in" "instanceof" "let" "new"
    194      "null" "return" "static" "super" "switch" "this" "throw" "true" "try"
    195      "typeof" "undefined" "var" "void" "while" "with" "yield")
    196     (kotlin-mode
    197      "abstract" "annotation" "as" "break" "by" "catch" "class" "companion"
    198      "const" "constructor" "continue" "data" "do" "else" "enum" "false" "final"
    199      "finally" "for" "fun" "if" "import" "in" "init" "inner" "interface"
    200      "internal" "is" "lateinit" "nested" "null" "object" "open" "out" "override"
    201      "package" "private" "protected" "public" "return" "super" "this" "throw"
    202      "trait" "true" "try" "typealias" "val" "var" "when" "while")
    203     (lua-mode ;; https://www.lua.org/manual/5.3/manual.html
    204      "and" "break" "do" "else" "elseif" "end" "false" "for" "function" "goto"
    205      "if" "in" "local" "nil" "not" "or" "repeat" "return" "then" "true" "until"
    206      "while")
    207     (nim-mode ;; https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords
    208      "addr" "and" "as" "asm" "bind" "block" "break" "case" "cast" "concept"
    209      "const" "continue" "converter" "defer" "discard" "distinct" "div" "do"
    210      "elif" "else" "end" "enum" "except" "export" "finally" "for" "from" "func"
    211      "if" "import" "in" "include" "interface" "is" "isnot" "iterator" "let"
    212      "macro" "method" "mixin" "mod" "nil" "not" "notin" "object" "of" "or" "out"
    213      "proc" "ptr" "raise" "ref" "return" "shl" "shr" "static" "template" "try"
    214      "tuple" "type" "using" "var" "when" "while" "xor" "yield")
    215     (objc-mode
    216      "@catch" "@class" "@encode" "@end" "@finally" "@implementation"
    217      "@interface" "@private" "@protected" "@protocol" "@public" "@selector"
    218      "@synchronized" "@throw" "@try" "alloc" "autorelease" "bycopy" "byref" "in"
    219      "inout" "oneway" "out" "release" "retain")
    220     (perl-mode ;; cperl.el
    221      "AUTOLOAD" "BEGIN" "CHECK" "CORE" "DESTROY" "END" "INIT" "__END__"
    222      "__FILE__" "__LINE__" "abs" "accept" "alarm" "and" "atan2" "bind" "binmode"
    223      "bless" "caller" "chdir" "chmod" "chomp" "chop" "chown" "chr" "chroot"
    224      "close" "closedir" "cmp" "connect" "continue" "cos" "crypt" "dbmclose"
    225      "dbmopen" "defined" "delete" "die" "do" "dump" "each" "else" "elsif"
    226      "endgrent" "endhostent" "endnetent" "endprotoent" "endpwent" "endservent"
    227      "eof" "eq" "eval" "exec" "exists" "exit" "exp" "fcntl" "fileno" "flock"
    228      "for" "foreach" "fork" "format" "formline" "ge" "getc" "getgrent"
    229      "getgrgid" "getgrnam" "gethostbyaddr" "gethostbyname" "gethostent"
    230      "getlogin" "getnetbyaddr" "getnetbyname" "getnetent" "getpeername"
    231      "getpgrp" "getppid" "getpriority" "getprotobyname" "getprotobynumber"
    232      "getprotoent" "getpwent" "getpwnam" "getpwuid" "getservbyname"
    233      "getservbyport" "getservent" "getsockname" "getsockopt" "glob" "gmtime"
    234      "goto" "grep" "gt" "hex" "if" "index" "int" "ioctl" "join" "keys" "kill"
    235      "last" "lc" "lcfirst" "le" "length" "link" "listen" "local" "localtime"
    236      "lock" "log" "lstat" "lt" "map" "mkdir" "msgctl" "msgget" "msgrcv" "msgsnd"
    237      "my" "ne" "next" "no" "not" "oct" "open" "opendir" "or" "ord" "our" "pack"
    238      "package" "pipe" "pop" "pos" "print" "printf" "push" "q" "qq" "quotemeta"
    239      "qw" "qx" "rand" "read" "readdir" "readline" "readlink" "readpipe" "recv"
    240      "redo" "ref" "rename" "require" "reset" "return" "reverse" "rewinddir"
    241      "rindex" "rmdir" "scalar" "seek" "seekdir" "select" "semctl" "semget"
    242      "semop" "send" "setgrent" "sethostent" "setnetent" "setpgrp" "setpriority"
    243      "setprotoent" "setpwent" "setservent" "setsockopt" "shift" "shmctl"
    244      "shmget" "shmread" "shmwrite" "shutdown" "sin" "sleep" "socket"
    245      "socketpair" "sort" "splice" "split" "sprintf" "sqrt" "srand" "stat"
    246      "study" "sub" "substr" "symlink" "syscall" "sysopen" "sysread" "system"
    247      "syswrite" "tell" "telldir" "tie" "time" "times" "tr" "truncate" "uc"
    248      "ucfirst" "umask" "undef" "unless" "unlink" "unpack" "unshift" "untie"
    249      "until" "use" "utime" "values" "vec" "wait" "waitpid" "wantarray" "warn"
    250      "while" "write" "x" "xor" "y")
    251     (php-mode ;; https://www.php.net/manual/reserved.php
    252      "Closure" "Error" "Exception" "Generator" "Throwable" "__CLASS__" "__DIR__"
    253      "__FILE__" "__FUNCTION__" "__LINE__" "__METHOD__" "__NAMESPACE__"
    254      "__TRAIT__" "abstract" "and" "array" "as" "bool" "break" "callable" "case"
    255      "catch" "class" "clone" "const" "continue" "declare" "default" "die" "do"
    256      "echo" "else" "elseif" "empty" "enddeclare" "endfor" "endforeach" "endif"
    257      "endswitch" "endwhile" "enum" "eval" "exit" "extends" "false" "final"
    258      "finally" "float" "fn" "for" "foreach" "function" "global" "goto" "if"
    259      "implements" "include" "include_once" "instanceof" "insteadof" "interface"
    260      "isset" "iterable" "list" "match" "namespace" "new" "null" "object" "or"
    261      "print" "private" "protected" "public" "readonly" "require" "require_once"
    262      "return" "self" "static" "string" "switch" "this" "throw" "trait" "true"
    263      "try" "unset" "use" "var" "void" "while" "xor" "yield" "yield from")
    264     (purescript-mode ;; purescript-font-lock.el
    265      "ado" "case" "class" "data" "default" "deriving" "do" "else" "if" "import"
    266      "in" "infix" "infixl" "infixr" "instance" "let" "module" "newtype" "of"
    267      "then" "type" "where")
    268     (python-mode ;; https://docs.python.org/3/reference/lexical_analysis.html#keywords
    269      "False" "None" "True" "and" "as" "assert" "break" "case" "class" "continue"
    270      "def" "del" "elif" "else" "except" "exec" "finally" "for" "from" "global"
    271      "if" "import" "in" "is" "lambda" "match" "nonlocal" "not" "or" "pass"
    272      "print" "raise" "return" "try" "while" "with" "yield")
    273     (ruby-mode
    274      "BEGIN" "END" "alias" "and" "begin" "break" "case" "class" "def" "defined?"
    275      "do" "else" "elsif" "end" "ensure" "false" "for" "if" "in" "module" "next"
    276      "nil" "not" "or" "redo" "rescue" "retry" "return" "self" "super" "then"
    277      "true" "undef" "unless" "until" "when" "while" "yield")
    278     (rust-mode ;; https://doc.rust-lang.org/grammar.html#keywords
    279      "Self" "as" "box" "break" "const" "continue" "crate" "else" "enum" "extern"
    280      "false" "fn" "for" "if" "impl" "in" "let" "loop" "macro" "match" "mod"
    281      "move" "mut" "pub" "ref" "return" "self" "static" "struct" "super" "trait"
    282      "true" "type" "unsafe" "use" "where" "while")
    283     (scala-mode
    284      "abstract" "case" "catch" "class" "def" "do" "else" "extends" "false"
    285      "final" "finally" "for" "forSome" "if" "implicit" "import" "lazy" "match"
    286      "new" "null" "object" "override" "package" "private" "protected" "return"
    287      "sealed" "super" "this" "throw" "trait" "true" "try" "type" "val" "var"
    288      "while" "with" "yield")
    289     (scheme-mode ;; R7RS-small: https://small.r7rs.org/
    290      "abs" "acos" "angle" "append" "apply" "asin" "assoc" "assq" "assv" "atan"
    291      "binary-port?" "body" "boolean=?" "boolean?" "bytevector"
    292      "bytevector-append" "bytevector-copy" "bytevector-copy!"
    293      "bytevector-length" "bytevector-u8-ref" "bytevector-u8-set!" "bytevector?"
    294      "caaaar" "caaadr" "caaar" "caadar" "caaddr" "caadr" "caar" "cadaar"
    295      "cadadr" "cadar" "caddar" "cadddr" "caddr" "cadr" "call-with-port"
    296      "call-with-values" "car" "car-internal" "cdaaar" "cdaadr" "cdaar" "cdadar"
    297      "cdaddr" "cdadr" "cdar" "cddaar" "cddadr" "cddar" "cdddar" "cddddr" "cdddr"
    298      "cddr" "cdr" "ceiling" "char->integer" "char-alphabetic?" "char-ci<=?"
    299      "char-ci<?" "char-ci=?" "char-ci>=?" "char-ci>?" "char-downcase"
    300      "char-foldcase" "char-lower-case?" "char-numeric?" "char-ready?"
    301      "char-upcase" "char-upper-case?" "char-whitespace?" "char<=?" "char<?"
    302      "char=?" "char>=?" "char>?" "char?" "close-input-port" "close-output-port"
    303      "close-port" "command-line" "complex?" "cons" "cos" "current-error-port"
    304      "current-input-port" "current-jiffy" "current-output-port" "current-second"
    305      "delete-file" "denominator" "digit-value" "display" "dynamic-wind"
    306      "emergency-exit" "environment" "eof-object" "eof-object?" "eq?" "equal?"
    307      "eqv?" "error" "error-object-irritants" "error-object-message"
    308      "error-object?" "eval" "even?" "exact" "exact-integer-sqrt"
    309      "exact-integer?" "exact?" "exit" "exp" "expt" "features" "file-error?"
    310      "file-exists?" "finite?" "floor" "floor-quotient" "floor-remainder"
    311      "floor/" "flush-output-port" "gcd" "get-environment-variable"
    312      "get-environment-variables" "get-output-bytevector" "get-output-string"
    313      "imag-part" "inexact" "inexact?" "infinite?" "input-port-open?"
    314      "input-port?" "integer->char" "integer?" "interaction-environment"
    315      "jiffies-per-second" "lcm" "length" "list" "list->string" "list->vector"
    316      "list-copy" "list-ref" "list-set!" "list-tail" "list?" "load" "log"
    317      "magnitude" "make-bytevector" "make-list" "make-parameter" "make-polar"
    318      "make-promise" "make-rectangular" "make-string" "make-vector" "max"
    319      "member" "memq" "memv" "min" "modulo" "nan?" "negative?" "newline" "nil"
    320      "not" "null-environment" "null?" "number->string" "number?" "numerator"
    321      "odd?" "open-binary-input-file" "open-binary-output-file"
    322      "open-input-bytevector" "open-input-file" "open-input-string"
    323      "open-output-bytevector" "open-output-file" "open-output-string"
    324      "output-port-open?" "output-port?" "pair?" "peek-char" "peek-u8" "port?"
    325      "positive?" "procedure?" "promise?" "quasiquote" "quote" "quotient" "raise"
    326      "raise-continuable" "rational?" "rationalize" "read" "read-bytevector"
    327      "read-bytevector!" "read-char" "read-error?" "read-line" "read-string"
    328      "read-u8" "real-part" "real?" "remainder" "reverse" "round"
    329      "scheme-report-environment" "set!" "set-car!" "set-cdr!" "setcar" "sin"
    330      "sqrt" "square" "string" "string->list" "string->number" "string->symbol"
    331      "string->utf" "string->vector" "string-append" "string-ci<=?" "string-ci<?"
    332      "string-ci=?" "string-ci>=?" "string-ci>?" "string-copy" "string-copy!"
    333      "string-downcase" "string-fill!" "string-foldcase" "string-for-each"
    334      "string-length" "string-map" "string-ref" "string-set!" "string-upcase"
    335      "string<=?" "string<?" "string=?" "string>=?" "string>?" "string?"
    336      "substring" "symbol->string" "symbol=?" "symbol?" "tan" "textual-port?"
    337      "truncate" "truncate-quotient" "truncate-remainder" "truncate/" "u8-ready?"
    338      "unquote" "unquote-splicing" "utf->string" "values" "vector" "vector->list"
    339      "vector->string" "vector-append" "vector-copy" "vector-copy!"
    340      "vector-fill!" "vector-for-each" "vector-length" "vector-map" "vector-ref"
    341      "vector-set!" "vector?" "with-exception-handler" "with-input-from-file"
    342      "with-output-to-file" "write" "write-bytevector" "write-char"
    343      "write-shared" "write-simple" "write-string" "write-u8" "zero?")
    344     (swift-mode
    345      "Protocol" "Self" "Type" "and" "as" "assignment" "associatedtype"
    346      "associativity" "available" "break" "case" "catch" "class" "column"
    347      "continue" "convenience" "default" "defer" "deinit" "didSet" "do" "dynamic"
    348      "dynamicType" "else" "elseif" "endif" "enum" "extension" "fallthrough"
    349      "false" "file" "fileprivate" "final" "for" "func" "function" "get" "guard"
    350      "higherThan" "if" "import" "in" "indirect" "infix" "init" "inout"
    351      "internal" "is" "lazy" "left" "let" "line" "lowerThan" "mutating" "nil"
    352      "none" "nonmutating" "open" "operator" "optional" "override" "postfix"
    353      "precedence" "precedencegroup" "prefix" "private" "protocol" "public"
    354      "repeat" "required" "rethrows" "return" "right" "selector" "self" "set"
    355      "static" "struct" "subscript" "super" "switch" "throw" "throws" "true"
    356      "try" "typealias" "unowned" "var" "weak" "where" "while" "willSet")
    357     (julia-mode
    358      "abstract" "break" "case" "catch" "const" "continue" "do" "else" "elseif"
    359      "end" "eval" "export" "false" "finally" "for" "function" "global" "if"
    360      "ifelse" "immutable" "import" "importall" "in" "let" "macro" "module"
    361      "otherwise" "quote" "return" "switch" "throw" "true" "try" "type"
    362      "typealias" "using" "while")
    363     (thrift-mode ;; https://github.com/apache/thrift/blob/master/contrib/thrift.el
    364      "binary" "bool" "byte" "const" "double" "enum" "exception" "extends" "i16"
    365      "i32" "i64" "include" "list" "map" "oneway" "optional" "required" "service"
    366      "set" "string" "struct" "throws" "typedef" "void")
    367     ;; Aliases
    368     (cperl-mode perl-mode)
    369     (enh-ruby-mode ruby-mode)
    370     (espresso-mode javascript-mode)
    371     (ess-julia-mode julia-mode)
    372     (jde-mode java-mode)
    373     (js-jsx-mode javascript-mode)
    374     (js-mode javascript-mode)
    375     (js2-jsx-mode javascript-mode)
    376     (js2-mode javascript-mode)
    377     (php-ts-mode php-mode)
    378     (phps-mode php-mode)
    379     (rjsx-mode javascript-mode)
    380     (tuareg-mode caml-mode)
    381     ;; Emacs 29 treesitter modes
    382     (c++-ts-mode c++-mode)
    383     (c-ts-mode c-mode)
    384     (csharp-ts-mode csharp-mode)
    385     (css-ts-mode css-mode)
    386     (elixir-ts-mode elixir-mode)
    387     (go-ts-mode go-mode)
    388     (java-ts-mode java-mode)
    389     (js-ts-mode javascript-mode)
    390     (python-ts-mode python-mode)
    391     (ruby-ts-mode ruby-mode)
    392     (rust-ts-mode rust-mode))
    393   "Alist of major modes and keywords."
    394   :type 'alist
    395   :group 'cape)
    396 
    397 (defun cape--keyword-list ()
    398   "Return keywords for current major mode."
    399   (when-let (kw (alist-get major-mode cape-keyword-list))
    400     (if (symbolp (car kw)) (alist-get (car kw) cape-keyword-list) kw)))
    401 
    402 (defvar cape--keyword-properties
    403   (list :annotation-function (lambda (_) " Keyword")
    404         :company-kind (lambda (_) 'keyword)
    405         :exclusive 'no)
    406   "Completion extra properties for `cape-keyword'.")
    407 
    408 ;;;###autoload
    409 (defun cape-keyword (&optional interactive)
    410   "Complete programming language keyword at point.
    411 See the variable `cape-keyword-list'.
    412 If INTERACTIVE is nil the function acts like a capf."
    413   (interactive (list t))
    414   (if interactive
    415       (cape-interactive #'cape-keyword)
    416     (when-let (keywords (cape--keyword-list))
    417       (let ((bounds (cape--bounds 'symbol)))
    418         `(,(car bounds) ,(cdr bounds)
    419           ,(cape--properties-table keywords :category 'cape-keyword)
    420           ,@cape--keyword-properties)))))
    421 
    422 (provide 'cape-keyword)
    423 ;;; cape-keyword.el ends here