[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/drepl 8f96ca981a 07/10: Add commands to evaluate a regi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/drepl 8f96ca981a 07/10: Add commands to evaluate a region and a buffer |
Date: |
Tue, 7 Nov 2023 03:58:04 -0500 (EST) |
branch: externals/drepl
commit 8f96ca981ac8e55cdc2bc6a4dbd8d493a7fac25b
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>
Add commands to evaluate a region and a buffer
---
drepl.el | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drepl.el b/drepl.el
index 6b9b1325eb..e6f7a408d0 100644
--- a/drepl.el
+++ b/drepl.el
@@ -215,7 +215,27 @@ STRING to the process."
(defun drepl-eval (code)
"Evaluate CODE string in the current buffer's REPL."
(interactive (list (read-from-minibuffer "Evaluate: ")))
- (drepl--eval (drepl--get-repl) code))
+ (drepl--eval (or (drepl--get-repl)
+ (user-error (substitute-command-keys "\
+No REPL (use \\[drepl-associate] to associate one)")))
+ code))
+
+(defun drepl-eval-region (start end)
+ "Evaluate region in the current buffer's REPL.
+START and END are the region bounds."
+ (interactive "r")
+ (drepl-eval (buffer-substring-no-properties start end)))
+
+(defun drepl-eval-buffer (&optional buffer)
+ "Evaluate BUFFER in the REPL associated to the current buffer.
+By default, BUFFER is the current buffer. Interactively, select a
+buffer first if a prefix argument is given or the current buffer
+is a dREPL buffer."
+ (interactive (list (when (or current-prefix-arg
+ (derived-mode-p 'drepl-mode))
+ (read-buffer "Evaluate buffer: "))))
+ (with-current-buffer (or buffer (current-buffer))
+ (drepl-eval-region (point-min) (point-max))))
(defun drepl-send-input-maybe (&optional force) ;Change this to `newline',
with opposite logic
"Like `comint-send-input', but first check if input is complete.
@@ -368,6 +388,8 @@ hard reset."
:parent comint-mode-map
"<remap> <comint-send-input>" #'drepl-send-input-maybe
"<remap> <display-local-help>" #'drepl-describe-thing-at-point
+ "C-c M-:" #'drepl-eval
+ "C-c C-b" #'drepl-eval-buffer
"C-c C-n" #'drepl-restart)
(define-derived-mode drepl-mode comint-mode "dREPL"
- [elpa] branch externals/drepl created (now aeba86f820), ELPA Syncer, 2023/11/07
- [elpa] externals/drepl 5650fef65d 08/10: Buffer association logic, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl eaced7db3b 01/10: Initial commit, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl 936bbe1c27 03/10: Add OSC to comint-output-filter-functions, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl f0e87367b3 02/10: Make prompt faces inherit from default, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl b30295f6f9 04/10: Use defclass instead of defstruct, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl b6d3bd9183 05/10: Add setoptions method and getoptions notification, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl b79b71d39b 06/10: Refactoring and documentation, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl 8f96ca981a 07/10: Add commands to evaluate a region and a buffer,
ELPA Syncer <=
- [elpa] externals/drepl 61d907e463 09/10: Use Eldoc to display documentation, ELPA Syncer, 2023/11/07
- [elpa] externals/drepl aeba86f820 10/10: Add readme and commentary, ELPA Syncer, 2023/11/07