diff --git a/modules/tools/eval/autoload/eval.el b/modules/tools/eval/autoload/eval.el index 4fc951ae7..9d9183206 100644 --- a/modules/tools/eval/autoload/eval.el +++ b/modules/tools/eval/autoload/eval.el @@ -73,7 +73,9 @@ (buffer-file-name (buffer-base-buffer)))) "emacs") (alist-get 'emacs-lisp-mode +eval-runners))) - (+eval/region (point-min) (point-max)) + (if-let ((buffer-handler (plist-get (cdr (alist-get major-mode +eval-repls)) :send-buffer))) + (funcall buffer-handler) + (+eval/region (point-min) (point-max))) (quickrun)))) ;;;###autoload @@ -85,7 +87,9 @@ (ignore-errors (get-buffer-window (or (+eval--ensure-in-repl-buffer) t)))) - (+eval/send-region-to-repl beg end)) + (funcall (or (plist-get (cdr (alist-get major-mode +eval-repls)) :send-region) + #'+eval/send-region-to-repl) + beg end)) ((let ((runner (or (alist-get major-mode +eval-runners) (and (require 'quickrun nil t) diff --git a/modules/tools/eval/autoload/settings.el b/modules/tools/eval/autoload/settings.el index 90116eaba..a11cb3831 100644 --- a/modules/tools/eval/autoload/settings.el +++ b/modules/tools/eval/autoload/settings.el @@ -22,7 +22,14 @@ PLIST is a property list that map special attributes to this repl. These are recognized: :persist BOOL - If non-nil, this REPL won't be killed when its window is closed." + If non-nil, this REPL won't be killed when its window is closed. + :send-region FUNC + A function that accepts a BEG and END, and sends the contents of the region + to the REPL. Defaults to `+eval/send-region-to-repl'. + :send-buffer FUNC + A function of no arguments that sends the contents of the buffer to the REPL. + Defaults to `+eval/region', which will run the :send-region specified function + or `+eval/send-region-to-repl'." (declare (indent defun)) (dolist (mode (doom-enlist modes)) (setf (alist-get mode +eval-repls)