Racket Mode

Table of Contents

Racket Mode


The Racket Mode package consists of a variety of Emacs major and minor modes, including:

For code, issues, and pull requests, see the Git repo.

To fund this work, see GitHub Sponsors or PayPal.


The recommended way to use Racket Mode is to install the package from MELPA.

Configure Emacs to use MELPA

To use MELPA:

(require 'package)
(add-to-list 'package-archives
	      '("melpa" . "https://melpa.org/packages/")

Install Racket Mode

When Emacs is configured to use MELPA, simply type M-x package-install RET racket-mode RET .

Minimal Racket

If you have installed the minimal Racket distribution (for example by using the homebrew formula) Racket Mode needs some additional packages (like errortrace and macro-debugger). A simple way to get all these packages is to install the drracket Racket package. In a command shell:

raco pkg install drracket


To uninstall Racket Mode, simply type M-x package-delete RET racket-mode RET .

You should probably also exit and restart Emacs.


Be aware that updating an Emacs package doesn’t necessarily fully update Emacs’ state. (One example symptom: an “invalid function” error message.)

After updating the package, you might need to restart Emacs.

In some cases, you might even need to:

  1. Uninstall Racket Mode.
  2. Exit and restart Emacs.
  3. Install Racket Mode.


Although Racket Mode can be customized with many Variables, there is only one that you might need to set: racket-program. This is the name or pathname of the Racket executable. It defaults to Racket.exe on Windows else racket.

On Windows or Linux, this default will probably work for you.

On macOS, downloading Racket doesn’t add its bin directory to your PATH. Even after you add it, GUI Emacs doesn’t automatically use your path (unless you use the handy exec-path-from-shell package). Therefore you might want to set racket-program to a full pathname like /usr/racket/bin/racket.

You can setq this directly in your Emacs init file (~/.emacs or ~/.emacs.d/init.el), or, use M-x customize, as you prefer.

Key bindings

To customize things like key bindings, you can use racket-mode-hook in your Emacs init file to modify racket-mode-map. For example, although C-c C-c is bound by default to the racket-run command, let’s say you wanted F5 to be an additional binding:

(add-hook 'racket-mode-hook
	  (lambda ()
	    (define-key racket-mode-map (kbd "<f5>") 'racket-run)))

Likewise for racket-repl-mode-hook and racket-repl-mode-map.

Font-lock (syntax highlighting)

Font-lock (as Emacs calls syntax highlighting) can be controlled using the variable font-lock-maximum-decoration, which defaults to t (maximum). You can set it to a number, where 0 is the lowest level. You can even supply an association list to specify different values for different major modes.

Historically you might choose a lower level for speed. These days you might do so because you prefer a simpler appearance.

Racket Mode supports four, increasing levels of font-lock:


In Emacs, a major mode may supply a “completion-at-point function”. This function is used by manual completion commands like complete-symbol (bound by default to C-M-i ), as well as by auto-completion packages like company-mode.

Racket Mode supplies such a function, which draws on all identifiers currently defined in the Racket namespace.

Of course that means there must exist some Racket namespace. When you first visit a .rkt file, you need to C-c C-c to racket-run. That makes the namespace match the file, and makes its identifiers available to Racket Mode. (Otherwise, as a fallback, Racket Mode uses the same list of identifiers for which it has defined Font-lock (syntax highlighting).)

Similarly, after you change the file, including its require forms, you’ll need to C-c C-c again to make the resulting set of identifiers available for completion.

To have TAB do completion as well as indent, add the following to your Emacs init file:

(setq tab-always-indent 'complete)

This changes the behavior of Emacs’ standard indent-for-tab-command, to which TAB is bound by default in racket-mode and racket-repl-mode.


If you use paredit, you might want to add keybindings to paredit-mode-map:

For example, with use-package:

(use-package paredit
  :ensure t
  (dolist (m '(emacs-lisp-mode-hook
    (add-hook m #'paredit-mode))
  (bind-keys :map paredit-mode-map
	     ("{"   . paredit-open-curly)
	     ("}"   . paredit-close-curly))
  (unless terminal-frame
    (bind-keys :map paredit-mode-map
	       ("M-[" . paredit-wrap-square)
	       ("M-{" . paredit-wrap-curly))))


If instead of paredit you prefer smartparens, you can use the default configuration it provides for Lisp modes generally and for Racket Mode specifically:

(require 'smartparens-config)


By default Racket Mode sets eldoc-documentation-function to nil — no eldoc-mode support. You may set it to racket-eldoc-function in a racket-mode-hook if you really want to use eldoc-mode with Racket. But it is not a very satisfying experience because Racket is not a very “eldoc-friendly” language. Although Racket Mode attempts to discover argument lists, contracts, or types this doesn’t work in many common cases:

A more satisfying experience is to use racket-describe or racket-doc.

Start faster

You can use racket-mode-start-faster to make the Racket REPL start faster.

Unicode input method

An optional Emacs input method, racket-unicode, lets you easily type various Unicode symbols that might be useful when writing Racket code.

To automatically enable the racket-unicode input method in racket-mode and racket-repl-mode buffers, put the following code in your Emacs init file:

(add-hook 'racket-mode-hook      #'racket-unicode-input-method-enable)
(add-hook 'racket-repl-mode-hook #'racket-unicode-input-method-enable)

See racket-unicode-input-method-enable.

See racket-insert-lambda.


The following sections are generated from the doc strings for each command, variable, or face. (As a result, some of the formatting might not be quite as nice or correct as the previous sections.)

You can also view these by using the normal Emacs help mechanism:




C-c C-k or C-c C-c

Save and evaluate the buffer in REPL.

With one C-u prefix, uses errortrace for improved stack traces. Otherwise follows the racket-error-context setting.

With two C-u prefixes, instruments code for step debugging. See racket-debug-mode and the variable racket-debuggable-files.

If point is within a Racket module form, the REPL “enters” that submodule (uses its language info and namespace).

When you run again, the file is evaluated from scratch — the custodian releases resources like threads and the evaluation environment is reset to the contents of the file. In other words, like DrRacket, this provides the predictability of a “static” baseline, plus the ability to explore interactively using the REPL.

See also racket-run-and-switch-to-repl, which is even more like DrRacket’s Run because it selects the REPL window (gives it the focus), too.

When racket-retry-as-skeleton is true, if your source file has an error, a “skeleton” of your file is evaluated to get identifiers from module languages, require forms, and definitions. That way, things like completion and racket-describe are more likely to work while you edit the file to fix the error. If not even the “skeleton” evaluation succeeds, you’ll have only identifiers provided by racket/base, until you fix the error and run again.

Output in the Racket REPL buffer that describes a file and position is automatically “linkified”. Examples of such text include:

To visit these locations, move point there and press RET or mouse click. Or, use the standard next-error and previous-error commands.


C-c C-z

Show the Racket REPL buffer in some window.

If NOSELECT is not nil, does not also select the REPL window.


The main, intended use of Racket Mode’s REPL is that you find-file some specific .rkt file, then racket-run it. The REPL will then match that file. Also, various Racket Mode features will work, such as completion, visiting definitions, and so on.

If the REPL isn’t running, and you want to start it for no file in particular? Then you could use this command. But the resulting REPL will have a minimal “#lang racket/base” namespace. You could enter "(require racket)" if you want the equivalent of “#lang racket”. You could also "(require racket/enter)" if you want things like “enter!”. But in some sense you’d be “using it wrong”. If you really don’t want to use Racket Mode’s REPL as intended, then you might as well use a plain Emacs shell buffer to run command-line Racket.



Do “racket <file>” in a shell buffer.


C-c C-o

Runs with profiling instrumentation and shows results.

Results are presented in a racket-profile-mode buffer, which also lets you quickly view the source code.

You may evaluate expressions in the REPL. They are also profiled. Use racket--profile-refresh to see the updated results. (In other words a possible workflow is: racket-profile a .rkt file, call one its functions in the REPL, and refresh the profile results.)

Caveat: Only source files are instrumented. You may need to delete compiled/*.zo files.


M-x racket-profile-mode RET

Major mode for results of racket-profile.


In addition to any hooks its parent mode special-mode might have run, this mode runs the hook racket-profile-mode-hook, as the final step during initialization.


C-c C-l

Create the racket-logger-mode buffer and connect to logger output.

If the racket-repl-mode buffer is displayed in a window, split that window and put the logger in the bottom window. Otherwise, use pop-to-buffer.


M-x racket-logger-mode RET

Major mode for Racket logger output.

The customization variable racket-logger-config determines the levels for topics. During a session you may change topic levels using racket-logger-topic-level.

For more information see: https://docs.racket-lang.org/reference/logging.html

C-c C-zracket-repl

In addition to any hooks its parent mode special-mode might have run, this mode runs the hook racket-logger-mode-hook, as the final step during initialization.


M-x racket-debug-mode RET

Minor mode for debug breaks.

This feature is EXPERIMENTAL!!! It is likely to have significant limitations and bugs. You are welcome to open an issue to provide feedback. Please understand that this feature might never be improved – it might even be removed someday if it turns out to have too little value and/or too much cost.

How to debug:

  1. “Instrument” code for step debugging. You can instrument entire files, and also individual functions.

    a. Entire Files

    Choose racket-run with two prefixes – C-u C-u C-c C-c. The file will be instrumented for step debugging before it is run. Also instrumented are files determined by the variable racket-debuggable-files.

    The run will break at the first breakable position.

    Tip: After you run to completion and return to a normal REPL prompt, the code remains instrumented. You may enter expressions that evaluate instrumented code and it will break so you can step debug again.

    b. Function Definitions

    Put point in a function define form and C-u C-M-x to “instrument” the function for step debugging. Then in the REPL, enter an expression that causes the instrumented function to be run, directly or indirectly.

    You can instrument any number of functions.

    You can even instrument while stopped at a break. For example, to instrument a function you are about to call, so you can “step into” it:

    Limitation: Instrumenting a function ~require~d from another module won’t redefine that function. Instead, it attempts to define an instrumented function of the same name, in the module the REPL is inside. The define will fail if it needs definitions visible only in that other module. In that case you’ll probably need to use entire-file instrumentation as described above.

  2. When a break occurs, the racket-repl-mode prompt changes. In this debug REPL, local variables are available for you to use and even to set!.

    Also, in the racket-mode buffer where the break is located, racket-debug-mode is enabled. This minor mode makes the buffer read-only, provides visual feedback – about the break position, local variable values, and result values – and provides shortcut keys:




<C-f5> or C-c C-t

Run the “test” submodule.

With prefix, runs with coverage instrumentation and highlights uncovered code.

Put your tests in a “test” submodule. For example:

(module+ test
  (require rackunit)
  (check-true #t))

Any rackunit test failure messages show the location. You may use next-error to jump to the location of each failing test.

See also:


M-x racket-raco-test RET

Do “raco test -x <file>” in a shell buffer to run the “test” submodule.



C-c C-r

Send the current region (if any) to the Racket REPL.



Send the current definition to the Racket REPL.


C-x C-e

Send the previous sexp to the Racket REPL.

When the previous sexp is a sexp comment the sexp itself is sent, without the #; prefix.




Visit definition of identifier at point.

If there is no identifier at point, prompt for it.

With a prefix, always prompt for the identifier.

Use racket-unvisit to return.

Please keep in mind the following limitations:



Visit definition of module at point, e.g. net/url or “file.rkt”.

If there is no module at point, prompt for it.

With a prefix, always prompt for the module.

Use racket-unvisit to return.

See also: racket-find-collection.



Return from previous racket-visit-definition or racket-visit-module.


C-c C-x C-f

Like Dr Racket’s Open Require Path.

Type (or delete) characters that are part of a module path name. “Fuzzy” matches appear. For example try typing “t/t/r”.

Choices are displayed in a vertical list. The current choice is at the top, marked with “->”.

Note: This requires Racket or newer. Otherwise it won’t error, it will just never return any matches.


M-x racket-find-collection RET

Given a collection name, try to find its directory and files.

Takes a collection name from point (or, with a prefix, prompts you).

If only one directory is found, ido-find-file-in-dir lets you pick a file there.

If more than one directory is found, ido-completing-read lets you pick one, then ido-find-file-in-dir lets you pick a file there.

Note: This requires the raco-find-collection package to be installed. To install it, in shell enter:

raco pkg install raco-find-collection

Tip: This works best with ido-enable-flex-matching set to t. Also handy is the flx-ido package from MELPA.

See also: racket-visit-module and racket-open-require-path.



C-c C-.

Describe the identifier at point in a *Racket Describe* buffer.

The intent is to give a quick reminder or introduction to something, regardless of whether it has installed documentation – and to do so within Emacs, without switching to a web browser.

This buffer is also displayed when you use company-mode and press F1 or C-h in its pop up completion list.

You can quit the buffer by pressing q. Also, at the bottom of the buffer are Emacs buttons – which you may navigate among using TAB, and activate using RET – for racket-visit-definition and racket-doc.


C-c C-d

View documentation of the identifier or string at point.

Uses the default external web browser.

If point is an identifier required in the current namespace that has help, opens the web browser directly at that help topic. (i.e. Uses the identifier variant of racket/help.)

Otherwise, opens the ‘search for a term’ page, where you can choose among multiple possibilities. (i.e. Uses the string variant of racket/help.)

With a C-u prefix, prompts for the identifier or quoted string, instead of looking at point.




Insert λ.

To insert Unicode symbols generally, see racket-unicode-input-method-enable.


C-c C-f

Fold (hide) all test submodules.


C-c C-u

Unfold (show) all test submodules.


M-x racket-tidy-requires RET

Make a single top-level “require” form, modules sorted, one per line.

All top-level require forms are combined into a single form. Within that form:

At most one module is listed per line.

Note: This only works for requires at the top level of a source file using #lang. It does NOT work for require forms inside module forms.

See also: racket-trim-requires and racket-base-requires.


M-x racket-trim-requires RET

Like racket-tidy-requires but also deletes unnecessary requires.

Note: This only works when the source file can be evaluated with no errors.

Note: This only works for requires at the top level of a source file using #lang. It does NOT work for require forms inside module forms. Furthermore, it is not smart about module+ or module* forms – it might delete top level requires that are actually needed by such submodules.

See also: racket-base-requires.


M-x racket-base-requires RET

Change from “#lang racket” to “#lang racket/base”.

Adds explicit requires for imports that are provided by “racket” but not by “racket/base”.

This is a recommended optimization for Racket applications. Avoiding loading all of “racket” can reduce load time and memory footprint.

Also, as does racket-trim-requires, this removes unneeded modules and tidies everything into a single, sorted require form.

Note: This only works when the source file can be evaluated with no errors.

Note: This only works for requires at the top level of a source file using #lang. It does NOT work for require forms inside module forms. Furthermore, it is not smart about module+ or module* forms – it might delete top level requires that are actually needed by such submodules.

Note: Currently this only helps change “#lang racket” to “#lang racket/base”. It does not help with other similar conversions, such as changing “#lang typed/racket” to “#lang typed/racket/base”.


M-x racket-indent-line RET

Indent current line as Racket code.

This behaves like lisp-indent-line, except that whole-line comments are treated the same regardless of whether they start with single or double semicolons.

To extend, use your Emacs init file to

(put SYMBOL ‘racket-indent-function INDENT)

where SYMBOL is the name of the Racket form (e.g. ~’test-case~) and INDENT is an integer or the symbol ~’defun~. When INDENT is an integer, the meaning is the same as for lisp-indent-function and scheme-indent-function: Indent the first n arguments specially and then indent any further arguments like a body.

For example in your .emacs file you could use:

(put ‘test-case ‘racket-indent-function 1)

to change the indent of test-case from this:

(test-case foo blah blah)

to this:

(test-case foo blah blah)

If racket-indent-function has no property for a symbol, scheme-indent-function is also considered (although the with-x indents defined by scheme-mode are ignored). This is only to help people who may have extensive scheme-indent-function settings, particularly in the form of file or dir local variables. Otherwise prefer racket-indent-function.


M-x racket-smart-open-bracket-mode RET

Minor mode to let you always type [’ to insert ( or [ automatically.

Behaves like the “Automatically adjust opening square brackets” feature in Dr. Racket.

By default, inserts a (. Inserts a [ in the following cases:

When the previous s-expression in a sequence is a compound expression, uses the same kind of delimiter.

To force insert [, use quoted-insert.

Combined with racket-insert-closing this means that you can press the unshifted [ and ] keys to get whatever delimiters follow the Racket conventions for these forms. When something like electric-pair-mode or paredit-mode is active, you need not even press ].

Tip: When also using paredit-mode, enable that first so that the binding for the [’ key in the map for racket-smart-open-bracket-mode has higher priority. See also the variable minor-mode-map-alist.


] or )

Insert a matching closing delimiter.

With a prefix, insert the typed character as-is.

This is handy if you’re not yet using something like paredit-mode, smartparens-mode, parinfer-mode, or simply electric-pair-mode added in Emacs 24.5.


C-c C-p

Cycle the sexpr among () [] {}.



Like backward-up-list but works when point is in a string or comment.

Typically you should not use this command in Emacs Lisp – especially not repeatedly. Instead, initially use racket--escape-string-or-comment to move to the start of a string or comment, if any, then use normal backward-up-list repeatedly.


M-x racket-check-syntax-mode RET

Analyze the buffer and annotate with information.

The buffer becomes read-only until you exit this minor mode. However you may navigate the usual ways. When point is on a definition or use, related items are highlighted and information is displayed in the echo area. You may also use special commands to navigate among the definition and its uses.



M-x racket-unicode-input-method-enable RET

Set input method to racket-unicode.

The racket-unicode input method lets you easily type various Unicode symbols that might be useful when writing Racket code.

To automatically enable the racket-unicode input method in racket-mode and racket-repl-mode buffers, put the following code in your Emacs init file:

(add-hook 'racket-mode-hook #'racket-unicode-input-method-enable)
(add-hook 'racket-repl-mode-hook #'racket-unicode-input-method-enable)

To temporarily enable this input method for a single buffer you can use “M-x racket-unicode-input-method-enable”.

Use the standard Emacs key C-\ to toggle the input method.

When the racket-unicode input method is active, you can for example type “All” and it is immediately replaced with “∀”. A few other examples:

test–>>Etest–>>∃ (racket/redex)

To see a table of all key sequences use “M-x describe-input-method <RET> racket-unicode”.

If you want to add your own mappings to the “racket-unicode” input method, you may add code like the following example in your Emacs init file:

;; Either (require 'racket-mode) here, or, if you use
;; use-package, put the code below in the :config section.
  (set-input-method "racket-unicode")
  (let ((quail-current-package (assoc "racket-unicode"
    (quail-define-rules ((append . t))
			("^o" ["ᵒ"]))))

If you don’t like the highlighting of partially matching tokens you can turn it off by setting input-method-highlight-flag to nil.


M-x racket-align RET

Align values in the same column.

Useful for binding forms like “let” and “parameterize”, conditionals like “cond” and “match”, association lists, and any series of couples like the arguments to “hash”.

Before choosing this command, put point on the first of a series of “couples”. A couple is:

Each “val” moves to the same column and is prog-indent-sexp-ed (in case it is a multi-line form).

For example with point on the "[" before “a”:

Before             After

(let ([a 12]       (let ([a   12]
      [bar 23])          [bar 23])
  ....)              ....)

'([a . 12]         '([a   . 12]
  [bar . 23])        [bar . 23])

(cond [a? #t]      (cond [a?   #t]
      [b? (f x           [b?   (f x
	     y)]                  y)]
      [else #f])         [else #f])

Or with point on the quote before “a”:

(list 'a 12        (list 'a   12
      'bar 23)           'bar 23)

If more than one couple is on the same line, none are aligned, because it is unclear where the value column should be. For example the following form will not change; racket-align will display an error message:

(let ([a 0][b 1]
      [c 2])       error; unchanged

When a couple’s sexprs start on different lines, that couple is ignored. Other, single-line couples in the series are aligned as usual. For example:

(let ([foo         (let ([foo
       0]                 0]
      [bar 1]            [bar 1]
      [x 2])             [x   2])
  ....)              ....)

See also: racket-unalign.


M-x racket-unalign RET

The opposite of racket-align.

Effectively does M-x just-one-space and prog-indent-sexp for each couple’s value.


Default value for the variable completion-at-point-functions.

Completion candidates are drawn from the namespace symbols resulting from the most recent racket-run of each .rkt file. If a file has never been run, candidates default to values also used for font-lock – an assortment of symbols from common Racket modules such as racket, typed/racket, and syntax/parse.

Returns extra :company-doc-buffer and :company-location properties for use by the company-mode backend company-capf – but not :company-docsig, because it is frequently impossible to supply this quickly enough or at all.

Macro expand


M-x racket-stepper-mode RET

Major mode for Racket stepper output.

Used by the commands racket-expand-file, racket-expand-definition, racket-expand-region, and racket-expand-last-sexp.


In addition to any hooks its parent mode special-mode might have run, this mode runs the hook racket-stepper-mode-hook, as the final step during initialization.


C-c C-e f

Expand the racket-mode buffer’s file in racket-stepper-mode.

Uses the macro-debugger package to do the expansion.

You do need to racket-run the file first; the namespace active in the REPL is not used.

If the file is non-trivial and/or is not compiled to a .zo bytecode file, then it might take many seconds before the original form is displayed and you can start stepping.

With a prefix, also expands syntax from racket/base – which can result in very many expansion steps.


C-c C-e r

Expand the active region using racket-stepper-mode.

Uses Racket’s expand-once in the namespace from the most recent racket-run.


C-c C-e x

Expand the definition around point using racket-stepper-mode.

Uses Racket’s expand-once in the namespace from the most recent racket-run.


C-c C-e e

Expand the sexp before point using racket-stepper-mode.

Uses Racket’s expand-once in the namespace from the most recent racket-run.



M-x racket-mode-start-faster RET

Compile Racket Mode’s .rkt files for faster startup.

Racket Mode is implemented as an Emacs Lisp “front end” that talks to a Racket process “back end”. Because Racket Mode is delivered as an Emacs package instead of a Racket package, installing it does not do the raco setup that is normally done for Racket packages.

This command will do a raco make of Racket Mode’s .rkt files, creating bytecode files in compiled/ subdirectories. As a result, when a racket-run or racket-repl command must start the Racket process, it will start faster.

If you run this command, ever, you should run it again after:


General variables


Pathname of the racket executable.


Port number for Racket REPL command server.


What to do when the REPL and command server aren’t available to send a command.


How many seconds to wait for Racket REPL command server responses.


Terminate the Racket process if memory use exceeds this value in MB. Changes to this value take effect upon the next racket-run. A value of 0 means no limit.

Caveat: This uses Racket’s custodian-limit-memory, which does not enforce the limit exactly. Instead, the program will be terminated upon the first garbage collection where memory exceeds the limit (maybe by a significant amount).


The level of context used for racket-run error stack traces.

Each level improves stack trace information, but causes your program to run more slowly.

Tip: Regardless of this setting, you can enable ‘high errortrace for a specific racket-run using a C-u prefix. This lets you normally run with a faster setting, and temporarily re-run to get a more-helpful error message.


Retry a “skeleton” of files with errors, for identifier names?

When true: If your source file has an error, a “skeleton” of your file is evaluated to get identifiers from module languages, require forms, and definitions. That way, things like completion and racket-describe are more likely to work while you edit the file to fix the error.

Otherwise, you’ll have only identifiers provided by racket/base, until you fix the error and run again.

You might want to disable this if you work with files that take a very long time to expand — because this feature needs to expand again when there is an error.


List of command-line arguments to supply to your Racket program.

Accessible in your Racket program in the usual way — the parameter current-command-line-arguments and friends.

This is an Emacs buffer-local variable — convenient to set as a file local variable. For example at the end of your .rkt file:

;; Local Variables:
;; racket-user-command-line-arguments: ("-f" "bar")
;; End:

Set this way, the value must be an unquoted list of strings. For example:

("-f" "bar")

The following values will not work:

'("-f" "bar")
(list "-f" "bar")


A function used to transform Emacs Lisp pathnames before supplying to the Racket back end.

If you run Emacs on Windows Subsystem for Linux, and want to run Racket programs using Windows Racket.exe rather than Linux racket, you can set this to racket-wsl-to-windows. In that case you probably also want to customize the “reverse”: racket-path-from-racket-to-emacs-function.


A function used to transform pathnames supplied by the Racket back end before using them in Emacs.

The default on Windows replaces back with forward slashes. The default elsewhere is identity.

If you run Emacs on Windows Subsystem for Linux, and want to run Racket programs using Windows Racket.exe rather than Linux racket, you can set this to racket-windows-to-wsl. In that case you probably also want to customize the “reverse”: racket-path-from-emacs-to-racket-function.

REPL variables


Input matching this regexp are not saved on the history list. Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.


Whether to display inline images in the REPL.


How many images to keep in the image cache.


Which system image viewer program to invoke upon M-x racket-view-last-image.


Use pretty-print instead of print in REPL.

Other variables


Indent {} with items aligned with the head item? This is indirectly disabled if racket-indent-sequence-depth is 0. This is safe to set as a file-local variable.


To what depth should racket-indent-line search. This affects the indentation of forms like ’() ‘() #() – and {} if racket-indent-curly-as-sequence is t — but not #’() #‘() ,() ,@(). A zero value disables, giving the normal indent behavior of DrRacket or Emacs lisp-mode derived modes like scheme-mode. Setting this to a high value can make indentation noticeably slower. This is safe to set as a file-local variable.


Display lambda keywords using λ. This is DEPRECATED. Instead use prettify-symbols-mode in newer verisons of Emacs, or, use racket-insert-lambda to insert actual λ characters.


This variable is obsolete and has no effect.

Instead of using this variable, you may bind the [ key to the racket-smart-open-bracket command in the racket-mode-map and/or racket-repl-mode-map keymaps.


Configuration of racket-logger-mode topics and levels

The topic ‘* respresents the default level used for topics not assigned a level. Otherwise, the topic symbols are the same as used by Racket’s define-logger.

The levels are those used by Racket’s logging system: ‘debug, ‘info, ‘warning, ‘error, ‘fatal.

For more information see: https://docs.racket-lang.org/reference/logging.html

The default value sets some known “noisy” topics to be one level quieter. That way you can set the ‘* topic to a level like ‘debug and not get overhwelmed by these noisy topics.

Experimental debugger variables


Used to tell racket-run what files may be instrumented for debugging. Must be a list of strings that are pathnames, such as from racket--buffer-file-name, -or-, a function that returns such a list given the pathname of the file being run. If any path strings are relative, they are made absolute using expand-file-name with the directory of the file being run. The symbol ‘run-file may be supplied in the list; it will be replaced with the pathname of the file being run. Safe to set as a file-local variable.




Face for #:keyword arguments.


Face for self-evaluating expressions like numbers, symbols, strings.


Face for here strings.


Face racket-check-syntax-mode uses to highlight definitions.


Face racket-check-syntax-mode uses to highlight uses.


Face for racket-logger-mode configuration.


Face for racket-logger-mode topics.


Face for racket-logger-mode fatal level.


Face for racket-logger-mode error level.


Face for racket-logger-mode warning level.


Face for racket-logger-mode info level.


Face for racket-logger-mode debug level.



Racket Mode’s Racket code is also delivered as part of the Emacs package — not as a Racket package. Delivering both Emacs and Racket code in one Emacs package simplifies installation and updates. The main drawback is that the Racket code is not automatically byte-compiled, as would normally be done by raco pkg install. To address this: See racket-mode-start-faster.