2019-04-21 19:59:44 -04:00
|
|
|
;; tools/eval/autoload/evil.el -*- lexical-binding: t; -*-
|
|
|
|
;;;###if (featurep! :editor evil)
|
2017-02-19 18:40:52 -05:00
|
|
|
|
2019-04-21 19:59:44 -04:00
|
|
|
;;;###autoload (autoload '+eval:region "tools/eval/autoload/evil" nil t)
|
2017-03-04 18:28:51 -05:00
|
|
|
(evil-define-operator +eval:region (beg end)
|
2019-10-24 16:55:25 -04:00
|
|
|
"Evaluate selection or sends it to the open REPL, if available."
|
2017-02-20 00:44:38 -05:00
|
|
|
:move-point nil
|
2017-02-19 18:40:52 -05:00
|
|
|
(interactive "<r>")
|
2019-10-24 16:55:25 -04:00
|
|
|
(if (and (fboundp '+eval--ensure-in-repl-buffer)
|
|
|
|
(+eval--ensure-in-repl-buffer))
|
2019-11-12 20:22:38 -05:00
|
|
|
(+eval/send-region-to-repl beg end)
|
2019-10-24 16:55:25 -04:00
|
|
|
(+eval/region beg end)))
|
2017-02-19 18:40:52 -05:00
|
|
|
|
2019-04-21 19:59:44 -04:00
|
|
|
;;;###autoload (autoload '+eval:replace-region "tools/eval/autoload/evil" nil t)
|
2017-03-04 18:28:51 -05:00
|
|
|
(evil-define-operator +eval:replace-region (beg end)
|
2019-10-24 16:55:25 -04:00
|
|
|
"Evaluate selection and replace it with its result."
|
2017-02-20 00:44:38 -05:00
|
|
|
:move-point nil
|
2017-02-19 18:40:52 -05:00
|
|
|
(interactive "<r>")
|
2017-03-04 18:28:51 -05:00
|
|
|
(+eval/region-and-replace beg end))
|
2017-05-12 14:18:00 +02:00
|
|
|
|
2019-04-21 19:59:44 -04:00
|
|
|
;;;###autoload (autoload '+eval:repl "tools/eval/autoload/evil" nil t)
|
2017-05-12 14:18:00 +02:00
|
|
|
(evil-define-operator +eval:repl (beg end &optional bang)
|
2019-10-24 16:55:25 -04:00
|
|
|
"Open REPL and send the current selection to it."
|
2017-05-12 14:18:00 +02:00
|
|
|
:move-point nil
|
|
|
|
(interactive "<r><!>")
|
2019-10-24 16:55:25 -04:00
|
|
|
(+eval/open-repl-other-window))
|