rust.el 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (defvar wi-rust--prettify-symbols-alist
  2. `(("fn" . ,(string-to-symbols "λ"))
  3. ("struct" . ,(string-to-symbols "define-structure"))
  4. ("enum" . ,(string-to-symbols "define-enumeration"))
  5. ("const" . ,(string-to-symbols "define-constant"))
  6. ("static" . ,(string-to-symbols "define-mutable-constant"))
  7. ("impl" . ,(string-to-symbols "implement"))
  8. ("u8" . ,(string-to-symbols "ℕ₈"))
  9. ("u16" . ,(string-to-symbols "ℕ₁₆"))
  10. ("u32" . ,(string-to-symbols "ℕ₃₂"))
  11. ("u128" . ,(string-to-symbols "ℕ₁₂₈"))
  12. ("usize" . ,(string-to-symbols "pointer-size"))
  13. ("i8" . ,(string-to-symbols "ℤ₈"))
  14. ("i16" . ,(string-to-symbols "ℤ₁₆"))
  15. ("i32" . ,(string-to-symbols "ℤ₃₂"))
  16. ("i128" . ,(string-to-symbols "ℤ₁₂₈"))
  17. ("isize" . ,(string-to-symbols "pointer-size"))
  18. ("bool" . ,(string-to-symbols "boolean"))
  19. ("derive" . ,(string-to-symbols "automatically-create-implementation"))
  20. ;; ("allow" . ,(string-to-symbols "reuse-as-fields-of-another-struct"))
  21. ("mut" . ,(string-to-symbols "mutable-bind"))
  22. ("type" . ,(string-to-symbols "alias"))
  23. ("->" . ,(string-to-symbols "→"))
  24. ;; https://stackoverflow.com/a/47641166
  25. ("&'a" . ,(string-to-symbols "the-lifetime-a"))
  26. ("'_" ,(string-to-symbols "anonymous-lifetime"))
  27. ("use" . ,(string-to-symbols "bind-full-path-to-name"))
  28. ("as" . ,(string-to-symbols "bind-import-to-a-different-name"))
  29. ("attribute" . ,(string-to-symbols "metadata-applied-to-module"))
  30. ("trait" . ,(string-to-symbols "collection-of-methods-defined-for-an-unknown-type-self"))))
  31. (add-hook 'rust-mode-hook
  32. (lambda ()
  33. (set (make-local-variable 'prettify-symbols-alist)
  34. wi-rust--prettify-symbols-alist)
  35. (rainbow-delimiters-mode 0)))