[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/tuareg 8152aee 2/6: Repair `tuareg-eval-region`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/tuareg 8152aee 2/6: Repair `tuareg-eval-region` |
Date: |
Fri, 10 Sep 2021 15:57:48 -0400 (EDT) |
branch: elpa/tuareg
commit 8152aee976d786da589e827f8e103f6f55f3b8b3
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>
Repair `tuareg-eval-region`
Set `tuareg-interactive-last-phrase-pos-in-source` to the actual start
of the region sent to the REPL. Previously, the incorrect position
caused error locations to be off, causing
`tuareg-interactive-next-error-source` to fail (see #273, #231).
Rewrite to follow the spirit of the original code: extend the region
to contain all phrases it intersects.
---
tuareg.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/tuareg.el b/tuareg.el
index 52c9896..2d35dbc 100644
--- a/tuareg.el
+++ b/tuareg.el
@@ -3683,15 +3683,16 @@ It is assumed that the range START-END delimit valid
OCaml phrases."
(defun tuareg-eval-region (start end)
"Eval the current region in the OCaml REPL."
(interactive "r")
+ ;; Use the smallest region containing the phrase(s) at either endpoint.
+ (dolist (pos (list start end))
+ (save-excursion
+ (goto-char pos)
+ (let ((phrase (tuareg-discover-phrase)))
+ (when phrase
+ (setq start (min start (car phrase)))
+ (setq end (max end (cadr phrase)))))))
(setq tuareg-interactive-last-phrase-pos-in-source start)
- (save-excursion
- (goto-char start)
- (tuareg-backward-beginning-of-defun)
- (setq start (point))
- (setq end (cdr (tuareg-region-of-defun end)))
- (if end
- (tuareg-interactive--send-region start end)
- (message "The expression after the point is not well braced."))))
+ (tuareg-interactive--send-region start end))
(define-obsolete-function-alias 'tuareg-narrow-to-phrase #'narrow-to-defun
"Apr 10, 2019")
- [nongnu] elpa/tuareg updated (85d626f -> c33222d), ELPA Syncer, 2021/09/10
- [nongnu] elpa/tuareg c33222d 6/6: Adapt to the new ocamldebug code pointer format, ELPA Syncer, 2021/09/10
- [nongnu] elpa/tuareg 1d63ceb 5/6: Remove unnecessary point adjustment (already performed), ELPA Syncer, 2021/09/10
- [nongnu] elpa/tuareg 07cfa2b 4/6: Deactivate the region to avoid extending it when moving point, ELPA Syncer, 2021/09/10
- [nongnu] elpa/tuareg 8152aee 2/6: Repair `tuareg-eval-region`,
ELPA Syncer <=
- [nongnu] elpa/tuareg bc06d27 3/6: Move `tuareg-eval-region` phrase intersection to `tuareg-eval-phrase`, ELPA Syncer, 2021/09/10
- [nongnu] elpa/tuareg 2e87104 1/6: Update `tuareg-interactive-error-range-regexp`, ELPA Syncer, 2021/09/10