1
0
Fork 0

fix(emacs): add racket-mode functionality for single-buffer workflows

Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
Lucas Sta Maria 2024-03-17 01:08:27 -04:00
parent 0b4192c9ea
commit 5df0d653d1
No known key found for this signature in database
GPG key ID: F07FB16A826E3B47

View file

@ -3,17 +3,39 @@
;; Configuration for Racket and Racket-based languages, including Pollen.
;;; Code:
(require 'racket-mode)
(require 'racket-edit)
(add-to-list 'load-path (expand-file-name "lisp/pollen-mode" user-emacs-directory))
(autoload 'pollen-mode "pollen" "A major mode for the pollen preprocessor." t)
(defun racket-repl-switch ()
"Switch to the Racket REPL."
(interactive)
(racket-edit-switch-to-repl)
(unless (equal current-prefix-arg nil)
(delete-other-windows)))
(defun racket-edit-switch ()
"Switch to the corresponding racket buffer."
(interactive)
(racket-repl-switch-to-edit)
(unless (equal current-prefix-arg nil)
(delete-other-windows)))
;; Recognize pollen filetypes
(setq auto-mode-alist (cons '("\\.pp$" . racket-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pm$" . pollen-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pmd$" . pollen-mode) auto-mode-alist))
(defun configure-racket ()
"Configure keybinds for racket buffers."
(keymap-local-set "C-c C-z" #'racket-repl-switch))
(defun configure-racket-repl ()
"Configure keybinds for the racket repl."
(keymap-local-set "C-c C-k" #'racket-repl-clear-leaving-last-prompt))
(keymap-local-set "C-c C-k" #'racket-repl-clear-leaving-last-prompt)
(keymap-local-set "C-c C-z" #'racket-edit-switch))
(add-hook 'racket-repl-mode-hook #'configure-racket-repl)