kaz-yos / eval-in-repl

Consistent ESS-like eval interface for various REPLs
174 stars 27 forks source link

Racket-mode support uses unavailable function #48

Open jloow opened 2 years ago

jloow commented 2 years ago

eval-in-repl-racket.el uses the function racket--repl-show-and-move-to-end from racket-mode. However, this function is no longer available. I'm not sure what it has been replaced with, but the issue can be fixed by replacing the function with it's previous implementation. That is

(defalias 'eir-send-to-racket
  (apply-partially 'eir-send-to-repl
                   ;; fun-change-to-repl
                   #'(lambda ()
                       ;; Show Racket REPL (focus comes back)
                       (racket--repl-show-and-move-to-end)
                       ;; Go to the other window
                       (other-window 1))
                   ;; fun-execute
                   #'comint-send-input)
  "Send expression to *Racket REPL* and have it evaluated.")

Can be rewritten as

(defalias 'eir-send-to-racket
  (apply-partially 'eir-send-to-repl
                   ;; fun-change-to-repl
                   #'(lambda ()
                       ;; Show Racket REPL (focus comes back)
                       (display-buffer racket-repl-buffer-name)
                       (save-selected-window
              (select-window (get-buffer-window racket-repl-buffer-name))
              (comint-show-maximum-output))
                       ;; Go to the other window
                       (other-window 1))
                   ;; fun-execute
                   #'comint-send-input)
  "Send expression to *Racket REPL* and have it evaluated.")

Probably not the prettiest solution but it fixes the issue.

julian-hoch commented 5 months ago

Yeah just noticed that too... do you have a fork we can use? Or any tips on how to adjust this ourselves?

jloow commented 3 months ago

Sorry for the late reply. I just put the new alias definition in my init file after loading the package. Alternatively you could define the missing function yourself e.g.

(defun () racket--repl-show-and-move-to-end
  (display-buffer racket-repl-buffer-name)
    (save-selected-window
      (select-window (get-buffer-window racket-repl-buffer-name))
      (comint-show-maximum-output))

Note that I haven't used eval-in-repl in over a year so I'm unsure if this still works. I know one issue is that emacs complains about not being able to find the buffer the first time the function is run.