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

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

[nongnu] elpa/racket-mode 40ecb87f40: Ensure racket--edit-mode-p in rack


From: ELPA Syncer
Subject: [nongnu] elpa/racket-mode 40ecb87f40: Ensure racket--edit-mode-p in racket-repl hidden buffer; fixes #713
Date: Sun, 23 Jun 2024 10:00:48 -0400 (EDT)

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

    Ensure racket--edit-mode-p in racket-repl hidden buffer; 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 ensuring a suitable major-mode.
---
 racket-repl.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/racket-repl.el b/racket-repl.el
index d34b275c76..459e5d911f 100644
--- a/racket-repl.el
+++ b/racket-repl.el
@@ -505,6 +505,9 @@ even when the module language doesn't provide any binding 
for
 (declare-function racket-repl-buffer-name-unique "racket-repl-buffer-name" ())
 (autoload        'racket-repl-buffer-name-unique "racket-repl-buffer-name")
 
+(declare-function racket-mode "racket-mode" ())
+(autoload        'racket-mode "racket-mode")
+
 ;;;###autoload
 (defun racket-repl (&optional noselect)
   "Show a Racket REPL buffer in some window.
@@ -532,6 +535,8 @@ require other modules, or whatever."
   ;; Visit the file without selecting it, and run it.
   (let ((racket-repl-buffer-name-function #'racket-repl-buffer-name-unique))
     (with-current-buffer (find-file-noselect racket-repl-command-file)
+      (unless (racket--edit-mode-p)
+        (racket-mode)) ;ensure: see #713
       (racket--repl-run
        (list racket-repl-command-file)
        nil



reply via email to

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