From 519517a65f25c9bf0dd637eedce79d7cbb34f4b9 Mon Sep 17 00:00:00 2001 From: flakeuser <2792697+Jdogzz@users.noreply.github.com> Date: Sat, 19 Apr 2025 07:02:26 -0700 Subject: [PATCH] fix(racket): allow toggling smart bracket mode Adds a custom variable to allow disabling smart bracket mode. Fix: #1452 --- modules/lang/racket/README.org | 6 ++--- modules/lang/racket/config.el | 49 ++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/modules/lang/racket/README.org b/modules/lang/racket/README.org index 3d2354a59..73e8b5259 100644 --- a/modules/lang/racket/README.org +++ b/modules/lang/racket/README.org @@ -70,6 +70,7 @@ Formatting is handled using the [[doom-module::editor format]] module via [[http (add-hook 'racket-mode-hook #'racket-smart-open-bracket-mode)) #+end_src +You can manually turn off smart bracket mode by setting the variable ~+racket-enable-smart-brackets~ to nil. ** Unicode Input The optional ~racket-unicode~ input method lets you type unicode characters such as λ or π. To enable unicode input for a single buffer, run @@ -91,6 +92,5 @@ Once enabled, unicode input can be toggled by pressing C-\ or running /This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]] * TODO Appendix -#+begin_quote - 󱌣 This module has no appendix yet. [[doom-contrib-module:][Write one?]] -#+end_quote +** Variables +- ~+racket-enable-smart-brackets~: Enable smart bracket mode unless parinfer or lispy are enabled. Default is true. diff --git a/modules/lang/racket/config.el b/modules/lang/racket/config.el index 5bb524f8a..44b4f49c4 100644 --- a/modules/lang/racket/config.el +++ b/modules/lang/racket/config.el @@ -4,6 +4,8 @@ (after! projectile (add-to-list 'projectile-project-root-files "info.rkt")) +(defvar +racket-enable-smart-brackets t + "If non-nil, without parinfer and lispy, enable racket smart bracket mode.") ;; ;;; Packages @@ -59,14 +61,15 @@ (cl-pushnew 'racket flycheck-disabled-checkers))))) (unless (or (modulep! :editor parinfer) - (modulep! :editor lispy)) + (modulep! :editor lispy) + (not +racket-enable-smart-brackets)) (add-hook mode-hook #'racket-smart-open-bracket-mode)) (map! (:map racket-xp-mode-map - [remap racket-doc] #'racket-xp-documentation - [remap racket-visit-definition] #'racket-xp-visit-definition - [remap next-error] #'racket-xp-next-error - [remap previous-error] #'racket-xp-previous-error) + [remap racket-doc] #'racket-xp-documentation + [remap racket-visit-definition] #'racket-xp-visit-definition + [remap next-error] #'racket-xp-next-error + [remap previous-error] #'racket-xp-previous-error) (:localleader :map ,mode-map "a" #'racket-align @@ -84,30 +87,30 @@ "u" #'racket-backward-up-list "y" #'racket-insert-lambda (:prefix ("m" . "macros") - "d" #'racket-expand-definition - "e" #'racket-expand-last-sexp - "r" #'racket-expand-region - "a" #'racket-expand-again) + "d" #'racket-expand-definition + "e" #'racket-expand-last-sexp + "r" #'racket-expand-region + "a" #'racket-expand-again) (:prefix ("g" . "goto") - "b" #'racket-unvisit - "d" #'racket-visit-definition - "m" #'racket-visit-module - "r" #'racket-open-require-path) + "b" #'racket-unvisit + "d" #'racket-visit-definition + "m" #'racket-visit-module + "r" #'racket-open-require-path) (:prefix ("s" . "send") - "d" #'racket-send-definition - "e" #'racket-send-last-sexp - "r" #'racket-send-region) + "d" #'racket-send-definition + "e" #'racket-send-last-sexp + "r" #'racket-send-region) :map racket-repl-mode-map "l" #'racket-logger "h" #'racket-repl-documentation "y" #'racket-insert-lambda "u" #'racket-backward-up-list (:prefix ("m" . "macros") - "d" #'racket-expand-definition - "e" #'racket-expand-last-sexp - "f" #'racket-expand-file - "r" #'racket-expand-region) + "d" #'racket-expand-definition + "e" #'racket-expand-last-sexp + "f" #'racket-expand-file + "r" #'racket-expand-region) (:prefix ("g" . "goto") - "b" #'racket-unvisit - "m" #'racket-visit-module - "d" #'racket-repl-visit-definition))))) + "b" #'racket-unvisit + "m" #'racket-visit-module + "d" #'racket-repl-visit-definition)))))