Skip to content

Commit 3a91956

Browse files
committed
Fix region normalization (ess-eval-region--normalise-region)
1 parent 5ec55b9 commit 3a91956

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

lisp/ess-inf.el

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,8 @@ they might throw off the debugger."
16181618
(ess-blink-region start end))
16191619
(goto-char end)
16201620
(skip-chars-backward "\n\t ")
1621-
(setq end (point))))
1621+
(setq end (point))
1622+
(cons start end)))
16221623

16231624
(defun ess-eval-region (start end vis &optional message type)
16241625
"Send the region from START to END to the inferior ESS process.
@@ -1645,15 +1646,17 @@ the lines of the rectangle separately to the inferior process."
16451646
(defun ess--eval-region (start end vis &optional message type)
16461647
"Helper function for `ess-eval-region', which see.
16471648
START, END, VIS, MESSAGE, and TYPE described there."
1648-
(ess-eval-region--normalise-region start end)
1649-
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
1650-
(message (or message "Eval region"))
1651-
(proc (ess-get-process)))
1652-
(save-excursion
1653-
(ess-send-region proc start end visibly message type)))
1654-
(when ess-eval-deactivate-mark
1655-
(ess-deactivate-mark))
1656-
(list start end))
1649+
(let* ((se (ess-eval-region--normalise-region start end))
1650+
(start (car se))
1651+
(end (cdr se)))
1652+
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
1653+
(message (or message "Eval region"))
1654+
(proc (ess-get-process)))
1655+
(save-excursion
1656+
(ess-send-region proc start end visibly message type)))
1657+
(when ess-eval-deactivate-mark
1658+
(ess-deactivate-mark))
1659+
(list start end)))
16571660

16581661
(defun ess-eval-buffer (&optional vis)
16591662
"Send the current buffer to the inferior ESS process.

lisp/ess-tracebug.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,12 @@ command conforms to VISIBLY."
328328
(defun ess-tracebug-send-region (process start end &optional visibly message type)
329329
"Send region to process adding source references as specified
330330
by `ess-inject-source' variable."
331-
(ess-eval-region--normalise-region start end)
332331
;; Disable evaluation env if we're sending a roxy region. This is
333332
;; not the ideal place to do this.
334-
(let* ((ess-r-evaluation-env (unless (ess-roxy--region-p start end)
333+
(let* ((se (ess-eval-region--normalise-region start end))
334+
(start (car se))
335+
(end (cdr se))
336+
(ess-r-evaluation-env (unless (ess-roxy--region-p start end)
335337
(ess-r-get-evaluation-env)))
336338
(inject-p (cond ((eq type 'function)
337339
ess-inject-source)

0 commit comments

Comments
 (0)