Skip to content

Commit

Permalink
Improve documentation about delimiter modes
Browse files Browse the repository at this point in the history
Improve on previous commit for issue #676.

Such as any of paredit, smartparens, electric-pair, etc.
  • Loading branch information
greghendershott committed Nov 28, 2023
1 parent cee96e2 commit fc3f83c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
6 changes: 5 additions & 1 deletion doc/racket-mode.org
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ Indentation can be customized in a way similar to lisp-mode and scheme-mode: {{{
** paredit

#+BEGIN_QUOTE
Note: If you use {{{ref(racket-hash-lang-mode)}}}, you can use ~racket-hash-lang-mode-hook~ to enable/disable paredit based on the specific #lang.
Note: If you use {{{ref(racket-hash-lang-mode)}}}, see {{{ref(racket-hash-lang-module-language-hook)}}} for how to enable/disable paredit based on the specific #lang.
#+END_QUOTE

If you use [[https://melpa.org/#/paredit][paredit]], you might want to add keybindings to ~paredit-mode-map~:
Expand Down Expand Up @@ -327,6 +327,10 @@ If you want to use paredit with interactive modes, their advice is to remove the

** smartparens

#+BEGIN_QUOTE
Note: If you use {{{ref(racket-hash-lang-mode)}}}, see {{{ref(racket-hash-lang-module-language-hook)}}} for how to enable/disable smartparens based on the specific #lang.
#+END_QUOTE

If instead of paredit you prefer [[https://melpa.org/#/smartparens][smartparens]], you can use the default configuration it provides for Lisp modes generally and for Racket Mode specifically:

#+BEGIN_SRC lisp
Expand Down
21 changes: 18 additions & 3 deletions doc/racket-mode.texi
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ Indentation can be customized in a way similar to lisp-mode and scheme-mode: @re
@section paredit

@quotation
Note: If you use @ref{racket-hash-lang-mode}, you can use @code{racket-hash-lang-mode-hook} to enable/disable paredit based on the specific #lang.
Note: If you use @ref{racket-hash-lang-mode}, see @ref{racket-hash-lang-module-language-hook} for how to enable/disable paredit based on the specific #lang.
@end quotation

Expand Down Expand Up @@ -762,6 +762,11 @@ If you want to use paredit with interactive modes, their advice is to remove the
@node smartparens
@section smartparens

@quotation
Note: If you use @ref{racket-hash-lang-mode}, see @ref{racket-hash-lang-module-language-hook} for how to enable/disable smartparens based on the specific #lang.
@end quotation

If instead of paredit you prefer @uref{https://melpa.org/#/smartparens, smartparens}, you can use the default configuration it provides for Lisp modes generally and for Racket Mode specifically:

@lisp
Expand Down Expand Up @@ -3255,6 +3260,16 @@ suitable for the module language:
(add-hook 'racket-hash-lang-module-language-hook #'my-hook)
@end lisp

A similar tactic can be used for @code{smartparens} or
@code{electric-pair-mode}. In general, none of these
delimiter-matching modes is likely to work well unless the
hash-lang uses racket for drracket:grouping-position, in which
case @ref{racket-hash-lang-mode} uses the classic @ref{racket-mode}
syntax-table for the buffer. Otherwise you should not enable one
of these modes, and isntead just use the simple delimiter
matching built into @ref{racket-hash-lang-mode}; see
@ref{racket-hash-lang-pairs}.

As another example, if you prefer richer font-lock than just
tokens, choices include:

Expand All @@ -3271,8 +3286,8 @@ the module language hook locally set

@itemize
@item
Or, use some of @ref{racket-mode}s regexp search-based
fontification for some module languages:
Or, use some of the regexp search-based fontification from
classic @ref{racket-mode} for rackety module languages:
@end itemize

@lisp
Expand Down
14 changes: 12 additions & 2 deletions racket-hash-lang.el
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ suitable for the module language:
(add-hook \\='racket-hash-lang-module-language-hook #\\='my-hook)
#+END_SRC
A similar tactic can be used for `smartparens' or
`electric-pair-mode'. In general, none of these
delimiter-matching modes is likely to work well unless the
hash-lang uses racket for drracket:grouping-position, in which
case `racket-hash-lang-mode' uses the classic `racket-mode'
syntax-table for the buffer. Otherwise you should not enable one
of these modes, and instead just use the simple delimiter
matching built into `racket-hash-lang-mode'; see
`racket-hash-lang-pairs'.
As another example, if you prefer richer font-lock than just
tokens, choices include:
Expand All @@ -148,8 +158,8 @@ tokens, choices include:
(setq-local racket-xp-add-binding-faces t)
#+END_SRC
- Or, use some of `racket-mode's regexp search-based
fontification for some module languages:
- Or, use some of the regexp search-based fontification from
classic `racket-mode' for rackety module languages:
#+BEGIN_SRC elisp
(require \\='racket-font-lock)
Expand Down

0 comments on commit fc3f83c

Please sign in to comment.