c.el 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. (defconst wi-c--prettify-symbols-alist
  2. `((" % " . (? (Br . Bl) ?m
  3. (Br . Bl) ?o
  4. (Br . Bl) ?d
  5. (Br . Bl) ? ))
  6. (" * " . (? (Br . Bl) ?·
  7. (Br . Bl) ? ))
  8. (" / " . (? (Br . Bl) ?÷
  9. (Br . Bl) ? ))
  10. ("!" . ?¬)
  11. ("!=" . ?≢)
  12. ("&&" . ?∧)
  13. ("->" . (? (Br . Bl) ?→
  14. (Br . Bl) ? ))
  15. ("<=" . ?≤)
  16. ("==" . ?≡)
  17. (">=" . ?≥)
  18. ("NULL" . ?N)
  19. ("false" . ?F)
  20. ("float" . ?ℚ)
  21. ("int" . ?ℤ)
  22. ("rand" . ?𝔼)
  23. ("true" . ?T)
  24. ("uint32_t" . (?ℕ (Br . Bl) ?₃
  25. (Br . Bl) ?₂))
  26. ("uint8_t" . (?ℕ (Br . Bl) ?₈))
  27. ("Uint32" . ,(string-to-symbols "ℕ₃₂"))
  28. ("Uint8" . ,(string-to-symbols "ℕ₈"))
  29. ("union" . ?∪)
  30. ("void" . ?Ø)
  31. ("x_1" . (?x (Br . Bl) ?₁))
  32. ("x_2" . (?x (Br . Bl) ?₂))
  33. ("y_1" . (?y (Br . Bl) ?₁))
  34. ("y_2" . (?y (Br . Bl) ?₂))
  35. ("||" . ?∨)))
  36. (add-hook 'c-mode-hook 'prettify-symbols-mode)
  37. (add-hook 'c-mode-hook
  38. (lambda ()
  39. (set (make-local-variable 'prettify-symbols-alist)
  40. wi-c--prettify-symbols-alist)))
  41. (with-eval-after-load 'c-mode
  42. (let ((map c-mode-map))
  43. (define-key map (kbd "M-.") 'dumb-jump-go)))
  44. (with-eval-after-load 'cc-vars
  45. (setq-default c-cleanup-list '(scope-operator)))
  46. (with-eval-after-load 'semantic
  47. (global-semantic-decoration-mode t))
  48. (defconst wi-asm-mode--prettify-symbols-alist
  49. `(("%eax" . ,(string-to-symbols "%eax (ℕ₃₂)"))
  50. ("%edi" . ,(string-to-symbols "%edi (ℕ₃₂)"))
  51. ("%rbp" . ,(string-to-symbols "%rbp (base→)"))
  52. ("%rsp" . ,(string-to-symbols "%rsp (stack→)"))
  53. ("$0x0" . (?0))))
  54. (add-hook 'asm-mode-hook 'prettify-symbols-mode)
  55. (add-hook 'asm-mode-hook
  56. (lambda ()
  57. (set (make-local-variable 'prettify-symbols-alist)
  58. wi-asm-mode--prettify-symbols-alist)))
  59. (setq disaster-cc "gcc")