1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
;;; racket-unicode-input-method.el -*- lexical-binding: t; -*-
;; Copyright (c) 2015-2020 by Greg Hendershott
;; Portions Copyright (c) 2010-2011 by Roel van Dijk
;; Author: Greg Hendershott
;; URL: https://github.com/greghendershott/racket-mode
;; License:
;; This 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, or (at your option)
;; any later version. This 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. See
;; http://www.gnu.org/licenses/ for details.
;; Following the example of haskell-unicode-input-method.el
(require 'quail)
;;;###autoload
(defun racket-unicode-input-method-enable ()
"Set input method to racket-unicode.
The racket-unicode input method lets you easily type various
Unicode symbols that might be useful when writing Racket code.
To automatically enable the racket-unicode input method in
racket-mode and racket-repl-mode buffers, put the following code
in your Emacs init file:
#+BEGIN_SRC elisp
(add-hook 'racket-mode-hook #'racket-unicode-input-method-enable)
(add-hook 'racket-repl-mode-hook #'racket-unicode-input-method-enable)
#+END_SRC
To temporarily enable this input method for a single buffer you
can use \"M-x racket-unicode-input-method-enable\".
Use the standard Emacs key C-\\ to toggle the input method.
When the racket-unicode input method is active, you can for
example type \"All\" and it is immediately replaced with \"โ\". A
few other examples:
| omega | ฯ |
| x_1 | xโ |
| x^1 | xยน |
| A | ๐ธ |
| test-->>E | test-->>โ (racket/redex) |
| vdash | โข |
To see a table of all key sequences use \"M-x
describe-input-method <RET> racket-unicode\".
If you want to add your own mappings to the \"racket-unicode\"
input method, you may add code like the following example in your
Emacs init file:
#+BEGIN_SRC elisp
;; Either (require 'racket-mode) here, or, if you use
;; use-package, put the code below in the :config section.
(with-temp-buffer
(racket-unicode-input-method-enable)
(set-input-method \"racket-unicode\")
(let ((quail-current-package (assoc \"racket-unicode\"
quail-package-alist)))
(quail-define-rules ((append . t))
(\"^o\" [\"แต\"]))))
#+END_SRC
If you donโt like the highlighting of partially matching tokens you
can turn it off by setting `input-method-highlight-flag' to nil."
(interactive)
(set-input-method "racket-unicode"))
(quail-define-package
"racket-unicode" ;name
"UTF-8" ;language
"ฮป" ;title (in mode line)
t ;guidance
"Racket Unicode input method." ;docstring
nil ;translation-keys
nil ;forget-last-selection
nil ;deterministic
nil ;kbd-translate
nil ;show-layout
nil ;create-decode-map
nil ;maximum-shortest
nil ;overlay-plist
nil ;update-translation-function
nil ;conversion-keys
t) ;simple
(quail-define-rules
;; Typed Racket
("All " ["โ"])
("Union " ["U"])
("Intersection " ["โฉ"])
;; Redex
("test-->>E " ["test-->>โ"])
;; Turnstile
("vdash " ["โข"])
("gg " ["โซ"])
("rightarrow " ["โ"])
("Rightarrow " ["โ"])
("Leftarrow " ["โ"])
("succ " ["โป"])
;; Other type rule symbols
;; (added: common math chars currently unsupported)
("times " ["ร"])
("Uparrow " ["โ"])
("Downarrow " ["โ"])
("Leftrightarrow " ["โ"])
("rightarrow " ["โ"])
("leftarrow " ["โ"])
("Rightarrow " ["โ"])
("Leftarrow " ["โ"])
("nwarrow " ["โ"])
("nearrow " ["โ"])
("uparrow " ["โ"])
("downarrow " ["โ"])
("searrow " ["โ"])
("swarrow " ["โ"])
("leftrightarrow " ["โ"])
("updownarrow " ["โ"])
("aleph " ["ื"])
("emptyset " ["โ
"])
("nabla " ["โ"])
("surd " ["โ"])
("negation " ["ยฌ"])
("infinity " ["โ"])
("prod " ["โ"])
("coprod" ["โ"])
("integrate " ["โซ"])
("oint " ["โฎ"])
("vee " ["โจ"])
("wedge " ["โง"])
("follows " ["โ"])
("in " ["โ"])
("ni " ["โ"])
("notin " ["โ"])
("sqsubset " ["โ"])
("sqsupset " ["โ"])
("sqsubseteq " ["โ"])
("sqsupseteq " ["โ"])
("subset " ["โ"])
("superset " ["โ"])
("subseteq " ["โ"])
("supseteq " ["โ"])
("approx " ["โ"])
("cong " ["โ"])
("neq " ["โ "])
("sqcap " ["โ"])
("sqcup " ["โ"])
("models " ["โง"])
;; Greek letters
("alpha " ["ฮฑ"])
("Alpha " ["ฮ"])
("beta " ["ฮฒ"])
("Beta " ["ฮ"])
("gamma " ["ฮณ"])
("Gamma " ["ฮ"])
("delta " ["ฮด"])
("Delta " ["ฮ"])
("epsilon " ["ฮต"])
("Epsilon " ["ฮ"])
("zeta " ["ฮถ"])
("Zeta " ["ฮ"])
("eta " ["ฮท"])
("Eta " ["ฮ"])
("theta " ["ฮธ"])
("Theta " ["ฮ"])
("iota " ["ฮน"])
("Iota " ["ฮ"])
("kappa " ["ฮบ"])
("Kappa " ["ฮ"])
("lambda " ["ฮป"])
("Lambda " ["ฮ"])
("lamda " ["ฮป"])
("Lamda " ["ฮ"])
("mu " ["ฮผ"])
("Mu " ["ฮ"])
("nu " ["ฮฝ"])
("Nu " ["ฮ"])
("xi " ["ฮพ"])
("Xi " ["ฮ"])
("omicron " ["ฮฟ"])
("Omicron " ["ฮ"])
("pi " ["ฯ"])
("Pi " ["ฮ "])
("rho " ["ฯ"])
("Rho " ["ฮก"])
("sigma " ["ฯ"])
("Sigma " ["ฮฃ"])
("tau " ["ฯ"])
("Tau " ["ฮค"])
("upsilon " ["ฯ
"])
("Upsilon " ["ฮฅ"])
("phi " ["ฯ"])
("Phi " ["ฮฆ"])
("chi " ["ฯ"])
("Chi " ["ฮง"])
("psi " ["ฯ"])
("Psi " ["ฮจ"])
("omega " ["ฯ"])
("Omega " ["ฮฉ"])
("digamma " ["ฯ"])
("Digamma " ["ฯ"])
("san " ["ฯป"])
("San " ["ฯบ"])
("qoppa " ["ฯ"])
("Qoppa " ["ฯ"])
("sampi " ["ฯก"])
("Sampi " ["ฯ "])
("stigma " ["ฯ"])
("Stigma " ["ฯ"])
("heta " ["อฑ"])
("Heta " ["อฐ"])
("sho " ["ฯธ"])
("Sho " ["ฯท"])
;; Double-struck letters
("|A|" ["๐ธ"])
("|B|" ["๐น"])
("|C|" ["โ"])
("|D|" ["๐ป"])
("|E|" ["๐ผ"])
("|F|" ["๐ฝ"])
("|G|" ["๐พ"])
("|H|" ["โ"])
("|I|" ["๐"])
("|J|" ["๐"])
("|K|" ["๐"])
("|L|" ["๐"])
("|M|" ["๐"])
("|N|" ["โ"])
("|O|" ["๐"])
("|P|" ["โ"])
("|Q|" ["โ"])
("|R|" ["โ"])
("|S|" ["๐"])
("|T|" ["๐"])
("|U|" ["๐"])
("|V|" ["๐"])
("|W|" ["๐"])
("|X|" ["๐"])
("|Y|" ["๐"])
("|Z|" ["โค"])
("|gamma|" ["โฝ"])
("|Gamma|" ["โพ"])
("|pi|" ["โผ"])
("|Pi|" ["โฟ"])
;; Quantifiers
("forall " ["โ"])
("exists " ["โ"])
;; Numeric subscripts
("_0 " ["โ"])
("_1 " ["โ"])
("_2 " ["โ"])
("_3 " ["โ"])
("_4 " ["โ"])
("_5 " ["โ
"])
("_6 " ["โ"])
("_7 " ["โ"])
("_8 " ["โ"])
("_9 " ["โ"])
;; Numeric superscripts
("^0 " ["โฐ"])
("^1 " ["ยน"])
("^2 " ["ยฒ"])
("^3 " ["ยณ"])
("^4 " ["โด"])
("^5 " ["โต"])
("^6 " ["โถ"])
("^7 " ["โท"])
("^8 " ["โธ"])
("^9 " ["โน"]))
(provide 'racket-unicode-input-method)
;;; racket-unicode-input-method.el ends here
|