[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/racket-mode 1069f268a2: Allow racket-smart-open-bracket-mo
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/racket-mode 1069f268a2: Allow racket-smart-open-bracket-mode in racket-hash-lang-mode; fixes #675 |
|
Date: |
Sun, 12 Nov 2023 10:00:23 -0500 (EST) |
branch: elpa/racket-mode
commit 1069f268a2d212b4fbac7dc8ac328982f0a9ee38
Author: Greg Hendershott <git@greghendershott.com>
Commit: Greg Hendershott <git@greghendershott.com>
Allow racket-smart-open-bracket-mode in racket-hash-lang-mode; fixes #675
But in the doc string do suggest enabling it conditionally in
racket-hash-lang-module-language-hook (rather than unconditionally in
racket-hash-lang-mode-hook).
---
racket-smart-open.el | 14 ++++++++------
racket-util.el | 7 +++++++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/racket-smart-open.el b/racket-smart-open.el
index a3baa4fc08..efc7134f32 100644
--- a/racket-smart-open.el
+++ b/racket-smart-open.el
@@ -49,13 +49,15 @@ 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'."
+the variable `minor-mode-map-alist'.
+
+Tip: When using this with `racket-hash-lang-mode', you may want
+to use `racket-hash-lang-module-language-hook' to enable it IFF
+the module langugage is something like \"racket\"."
:lighter " RacketSmartOpen"
- :keymap (racket--easy-keymap-define
- '(("[" racket-smart-open-bracket)))
- (unless (memq major-mode '(racket-mode racket-repl-mode))
- (setq racket-smart-open-bracket-mode nil)
- (user-error "racket-smart-open-bracket-mode only works with with Racket
Mode buffers")))
+ :keymap (racket--easy-keymap-define '(("[" racket-smart-open-bracket)))
+ (racket--assert-edit-or-repl-mode
+ (lambda () (setq racket-smart-open-bracket-mode nil))))
(defconst racket--smart-open-bracket-data
(eval-when-compile
diff --git a/racket-util.el b/racket-util.el
index e0525d9000..861b363e43 100644
--- a/racket-util.el
+++ b/racket-util.el
@@ -162,6 +162,13 @@ The \"project\" is determined by trying, in order:
(user-error "%S works only in racket-mode or racket-hash-lang-mode edit
buffers"
this-command)))
+(defun racket--assert-edit-or-repl-mode (&optional fail-thunk)
+ (unless (or (racket--edit-mode-p)
+ (derived-mode-p 'racket-repl-mode))
+ (when fail-thunk (funcall fail-thunk))
+ (user-error "%S works only in racket-mode or racket-hash-lang-mode edit
buffers, or racket-repl-mode buffers"
+ this-command)))
+
(defun racket--assert-racket-mode ()
(unless (derived-mode-p 'racket-mode)
(user-error "%S works only in racket-mode edit buffers"
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/racket-mode 1069f268a2: Allow racket-smart-open-bracket-mode in racket-hash-lang-mode; fixes #675,
ELPA Syncer <=