Skip to content

Commit a56a79d

Browse files
Ensure racket-repl hidden buffer uses racket-mode; fixes #713
racket-repl visits racket-repl-command-file (without visibly selecting the buffer) and does racket--repl-run. Unless the major-mode is racket-mode or racket-hash-lang-mode, the run will complain with an error message. Typically this won't happen because visiting a .rkt file will, in general, automatically set the buffer's major-mode to racket-mode due to us setting auto-mode-alist by default. Or maybe the user changes auto-mode-alist to use racket-hash-lang-mode. But a user's configuration could override this, intentionally or not, possibly with surprising results. There are various mechanisms for choosing the mode: https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html A user probably will want to figure out and change their configuration to set a major-mode consistently when opening .rkt files generally. Regardless/meanwhile, we can at least avoid the racket-repl error message by forcing the racket-repl-command-file buffer to use racket-mode. (Even if a user prefers racket-hash-lang-mode for editing, it shouldn't matter if we use racket-mode here.)
1 parent 47cb399 commit a56a79d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

racket-repl.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ even when the module language doesn't provide any binding for
505505
(declare-function racket-repl-buffer-name-unique "racket-repl-buffer-name" ())
506506
(autoload 'racket-repl-buffer-name-unique "racket-repl-buffer-name")
507507

508+
(declare-function racket-mode "racket-mode" ())
509+
(autoload 'racket-mode "racket-mode")
510+
508511
;;;###autoload
509512
(defun racket-repl (&optional noselect)
510513
"Show a Racket REPL buffer in some window.
@@ -532,6 +535,7 @@ require other modules, or whatever."
532535
;; Visit the file without selecting it, and run it.
533536
(let ((racket-repl-buffer-name-function #'racket-repl-buffer-name-unique))
534537
(with-current-buffer (find-file-noselect racket-repl-command-file)
538+
(racket-mode) ;ensure: see #713
535539
(racket--repl-run
536540
(list racket-repl-command-file)
537541
nil

0 commit comments

Comments
 (0)