org-table: Fix computation with backwards ranges

* lisp/org-table.el (org-table-get-range): Use correct values to extract
  range.  This is important when range is defined backwards (e.g.,
  @-I..@-II).

Reported-by: Sebastien Vauban
<http://permalink.gmane.org/gmane.emacs.orgmode/99430>
This commit is contained in:
Nicolas Goaziou 2015-08-03 22:56:22 +02:00
parent a3b2b7473e
commit a70604eb63
1 changed files with 5 additions and 5 deletions

View File

@ -2939,16 +2939,16 @@ and column2 are table column numbers."
(last-column (max c1 c2)))
(if corners-only (list first-row first-column last-row last-column)
;; Copy the range values into a list.
(forward-line (- r1 thisline))
(forward-line (- first-row thisline))
(while (not (looking-at org-table-dataline-regexp))
(forward-line)
(incf r1))
(org-table-goto-column c1)
(incf first-row))
(org-table-goto-column first-column)
(let ((beg (point)))
(forward-line (- r2 r1))
(forward-line (- last-row first-row))
(while (not (looking-at org-table-dataline-regexp))
(forward-line -1))
(org-table-goto-column c2)
(org-table-goto-column last-column)
(let ((end (point)))
(when highlight
(org-table-highlight-rectangle