org-plot: Fix calling at start of #+plot line

* lisp/org-plot.el (org-plot/gnuplot): When called with point at the
start of the #+plot: line, the behaviour of `org-table-begin' (called in
`org-table-to-lisp') caused no table to be detected.  To work around
this, when the point is at the zeroth column, it is temporarily shifted
one character to the right.
This commit is contained in:
TEC 2021-05-09 18:11:49 +08:00
parent 7dd667af67
commit 2ae308342a
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 5 additions and 1 deletions

View File

@ -650,7 +650,11 @@ line directly before or after the table."
(setf params (org-plot/collect-options params))))
;; collect table and table information
(let* ((data-file (make-temp-file "org-plot"))
(table (let ((tbl (org-table-to-lisp)))
(table (let ((tbl (save-excursion
;; needed due to particularities of `org-table-begin'
(when (= (current-column) 0)
(forward-char 1))
(org-table-to-lisp))))
(when (pcase (plist-get params :transpose)
(`y t)
(`yes t)