emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/racket-mode 3847c5e8e3: Re-enable test disabled in commit


From: ELPA Syncer
Subject: [nongnu] elpa/racket-mode 3847c5e8e3: Re-enable test disabled in commit c24ecc3; issue #647
Date: Thu, 1 Dec 2022 18:59:18 -0500 (EST)

branch: elpa/racket-mode
commit 3847c5e8e3c0677da8002791e227ccf2320f703a
Author: Greg Hendershott <git@greghendershott.com>
Commit: Greg Hendershott <git@greghendershott.com>

    Re-enable test disabled in commit c24ecc3; issue #647
    
    Although I prevented paredit stealing RET, I neglected to re-enable
    the test.
    
    Now that I have, it fails for a new reason: I didn't fix paredit
    working with racket-smart-open-bracket-mode. Using
    minor-mode-overriding-map-alist backfires here, because it steals the
    binding of the [ key. Argh.
    
    After more thought, I don't see any ideal solution here. Instead:
    
    - Revert the overriding map stuff.
    
    - Document the work-around suggested by paredit.
    
    - Use that work-around in the test. In other words the test assumes
    users are following the documented recommended configuration.
---
 doc/racket-mode.org  |  9 +++++++++
 doc/racket-mode.texi |  9 +++++++++
 racket-repl.el       | 10 +---------
 test/racket-tests.el |  9 +++++++--
 4 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/doc/racket-mode.org b/doc/racket-mode.org
index a7914b813f..e0359654d3 100644
--- a/doc/racket-mode.org
+++ b/doc/racket-mode.org
@@ -280,6 +280,15 @@ For example, with 
[[https://melpa.org/#/use-package][~use-package~]]:
                ("M-{" . paredit-wrap-curly))))
 #+END_SRC
 
+Starting c. November 2022, paredit binds the {{{kbd(RET)}}} key to its own 
command. Unfortunately this is /not/ compatible with interactive modes --- 
including but not limited to ~racket-repl-mode~ --- which expect {{{kbd(RET)}}} 
to be bound to a command to submit your input to the REPL. In other words, if 
you type an expression and hit {{{kbd(RET)}}}, nothing will happen and the REPL 
will seem frozen. You ~M-x racket-repl-submit~ to proceed.
+
+If you want to use paredit with interactive modes, their advice is to remove 
the binding from ~paredit-mode-map~ (note that this will also disable it for 
all buffers, including editing buffers). One way you can do this for all 
related keys:
+
+#+BEGIN_SRC lisp
+(dolist (k '("RET" "C-m" "C-j"))
+  (define-key paredit-mode-map (kbd k) nil))
+#+END_SRC
+
 ** smartparens
 
 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:
diff --git a/doc/racket-mode.texi b/doc/racket-mode.texi
index b789f387b3..af7f92dae5 100644
--- a/doc/racket-mode.texi
+++ b/doc/racket-mode.texi
@@ -659,6 +659,15 @@ For example, with 
@uref{https://melpa.org/#/use-package,@code{use-package}}:
                ("M-@{" . paredit-wrap-curly))))
 @end lisp
 
+Starting c. November 2022, paredit binds the @kbd{RET}  key to its own 
command. Unfortunately this is @emph{not} compatible with interactive modes --- 
including but not limited to @code{racket-repl-mode} --- which expect @kbd{RET} 
 to be bound to a command to submit your input to the REPL. In other words, if 
you type an expression and hit @kbd{RET} , nothing will happen and the REPL 
will seem frozen. You @code{M-x racket-repl-submit} to proceed.
+
+If you want to use paredit with interactive modes, their advice is to remove 
the binding from @code{paredit-mode-map} (note that this will also disable it 
for all buffers, including editing buffers). One way you can do this for all 
related keys:
+
+@lisp
+(dolist (k '("RET" "C-m" "C-j"))
+  (define-key paredit-mode-map (kbd k) nil))
+@end lisp
+
 @node smartparens
 @section smartparens
 
diff --git a/racket-repl.el b/racket-repl.el
index 9d260870f2..f1dc8ef4ad 100644
--- a/racket-repl.el
+++ b/racket-repl.el
@@ -1294,15 +1294,7 @@ identifier bindings and modules from the REPL's 
namespace.
   (add-hook 'kill-emacs-hook #'racket--repl-save-all-histories nil t)
   (add-hook 'xref-backend-functions #'racket-repl-xref-backend-function nil t)
   (add-to-list 'semantic-symref-filepattern-alist
-               '(racket-repl-mode "*.rkt" "*.rktd" "*.rktl"))
-  ;; Handle recent versions of paredit that bind C-m and C-j; #647.
-  (when (boundp 'paredit-mode-map)
-    (let ((m (make-sparse-keymap)))
-      (set-keymap-parent m paredit-mode-map)
-      (dolist (k '("C-m" "C-j"))
-        (define-key m (kbd k) (lookup-key racket-repl-mode-map (kbd k))))
-      (push (cons 'paredit-mode m)
-            minor-mode-overriding-map-alist))))
+               '(racket-repl-mode "*.rkt" "*.rktd" "*.rktl")))
 
 (defun racket--repl-save-all-histories ()
   "Call comint-write-input-ring for all `racket-repl-mode' buffers.
diff --git a/test/racket-tests.el b/test/racket-tests.el
index 7a635a02ca..7664fe5f4e 100644
--- a/test/racket-tests.el
+++ b/test/racket-tests.el
@@ -156,7 +156,12 @@ supplied to it."
       (racket-tests/type&press "1 " "RET")
       (should (racket-tests/see-back "1\n> "))
 
-      ;; `racket-smart-open-bracket-mode'
+      ;; `racket-smart-open-bracket-mode'.
+      ;;
+      ;; For `paredit-mode' we test using the configuration we
+      ;; document in doc/racket-mode.org; see #647.
+      (dolist (k '("RET" "C-m" "C-j"))
+        (define-key paredit-mode-map (kbd k) nil))
       (let ((typing   "[cond [[values 1] #t] [else #f]]")
             (expected "(cond [(values 1) #t] [else #f])\n#t\n> "))
         (mapc (lambda (modes)
@@ -169,7 +174,7 @@ supplied to it."
                 (racket-tests/type&press typing "RET")
                 (should (racket-tests/see-back expected)))
               (list (cons t   nil)      ;just `electric-pair-mode'
-                    ;;(cons nil t)        ;just `paredit-mode'
+                    (cons nil t)        ;just `paredit-mode'
                     (cons nil nil))))   ;neither/plain
 
       ;; Exit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]