0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 22:07:49 +00:00

org-plot: Don't move point when plotting

* lisp/org-plot.el (org-plot/gnuplot): Expanding the `save-excursion'
block to include `org-plot/goto-nearest-table` prevents the current
point from being moved, and doesn't affect the rest of the function.
This commit is contained in:
TEC 2021-04-26 23:41:40 +08:00
parent 2c22bba4a2
commit ac3148ef8d
Signed by: tec
GPG key ID: 779591AFDB81F06C

View file

@ -637,15 +637,16 @@ line directly before or after the table."
(when (get-buffer "*gnuplot*") ; reset *gnuplot* if it already running
(with-current-buffer "*gnuplot*"
(goto-char (point-max))))
(org-plot/goto-nearest-table)
;; Set default options.
(dolist (pair org-plot/gnuplot-default-options)
(unless (plist-member params (car pair))
(setf params (plist-put params (car pair) (cdr pair)))))
;; Collect options.
(save-excursion (while (and (equal 0 (forward-line -1))
(looking-at "[[:space:]]*#\\+"))
(setf params (org-plot/collect-options params))))
(save-excursion
(org-plot/goto-nearest-table)
;; Set default options.
(dolist (pair org-plot/gnuplot-default-options)
(unless (plist-member params (car pair))
(setf params (plist-put params (car pair) (cdr pair)))))
;; Collect options.
(while (and (equal 0 (forward-line -1))
(looking-at "[[:space:]]*#\\+"))
(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)))