doomemacs/modules/lang/racket/config.el
Henrik Lissner a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00

55 lines
1.7 KiB
EmacsLisp

;;; lang/racket/config.el -*- lexical-binding: t; -*-
(use-package! racket-mode
:hook (racket-repl-mode . racket-unicode-input-method-enable)
:config
(set-popup-rule! "^\\*Racket REPL" :size 10 :select t)
(set-repl-handler! 'racket-mode #'+racket/repl)
(set-lookup-handlers! 'racket-mode
:definition #'racket-visit-definition
:documentation #'racket-describe)
(set-docsets! 'racket-mode "Racket")
(set-pretty-symbols! 'racket-mode
:lambda "lambda"
:map "map"
:dot ".")
(set-rotate-patterns! 'racket-mode
:symbols '(("#true" "#false")))
(setq racket-smart-open-bracket-enable t)
(add-hook! 'racket-mode-hook
#'rainbow-delimiters-mode
#'highlight-quoted-mode)
(map! :localleader
:map racket-mode-map
"a" #'racket-align
"A" #'racket-unalign
"f" #'racket-fold-all-tests
"F" #'racket-unfold-all-tests
"h" #'racket-doc
"i" #'racket-unicode-input-method-enable
"l" #'racket-logger
"o" #'racket-profile
"p" #'racket-cycle-paren-shapes
"r" #'racket-run
"R" #'racket-run-and-switch-to-repl
"t" #'racket-test
"u" #'racket-backward-up-list
"y" #'racket-insert-lambda
(:prefix "e"
"d" #'racket-expand-definition
"l" #'racket-expand-last-sexp
"r" #'racket-expand-region
"a" #'racket-expand-again)
(:prefix "g"
"d" #'racket-visit-definition
"m" #'racket-visit-module
"r" #'racket-open-require-path
"b" #'racket-unvisit)
(:prefix "s"
"d" #'racket-send-definition
"l" #'racket-send-last-sexp
"r" #'racket-send-region)))