org: Enable plotting with C-c C-c

* lisp/org.el (org-ctrl-c-ctrl-c): When at a table, call
`org-plot/gnuplot' if the current line starts with "#+plot".
This commit is contained in:
TEC 2021-04-27 00:05:37 +08:00 committed by Bastien Guerry
parent ed8cd9cf21
commit aea31b0656
1 changed files with 23 additions and 18 deletions

View File

@ -17705,24 +17705,29 @@ This command does many different things, depending on context:
;; send the table if necessary. If the table has ;; send the table if necessary. If the table has
;; a `table.el' type, just give up. At a table row or cell, ;; a `table.el' type, just give up. At a table row or cell,
;; maybe recalculate line but always align table. ;; maybe recalculate line but always align table.
(if (eq (org-element-property :type context) 'table.el) (cond
(message "%s" (substitute-command-keys "\\<org-mode-map>\ ((and (< (point) (org-element-property :post-affiliated context))
Use `\\[org-edit-special]' to edit table.el tables")) (org-match-line "[ \t]*#\\+plot:"))
(if (or (eq type 'table) (org-plot/gnuplot))
;; Check if point is at a TBLFM line. ((eq (org-element-property :type context) 'table.el)
(and (eq type 'table-row) (message "%s" (substitute-command-keys "\\<org-mode-map>\
(= (point) (org-element-property :end context)))) Use `\\[org-edit-special]' to edit table.el tables")))
(save-excursion ((or (eq type 'table)
(if (org-at-TBLFM-p) ;; Check if point is at a TBLFM line.
(progn (require 'org-table) (and (eq type 'table-row)
(org-table-calc-current-TBLFM)) (= (point) (org-element-property :end context))))
(goto-char (org-element-property :contents-begin context)) (save-excursion
(org-call-with-arg 'org-table-recalculate (or arg t)) (if (org-at-TBLFM-p)
(orgtbl-send-table 'maybe))) (progn (require 'org-table)
(org-table-maybe-eval-formula) (org-table-calc-current-TBLFM))
(cond (arg (call-interactively #'org-table-recalculate)) (goto-char (org-element-property :contents-begin context))
((org-table-maybe-recalculate-line)) (org-call-with-arg 'org-table-recalculate (or arg t))
(t (org-table-align)))))) (orgtbl-send-table 'maybe))))
(t
(org-table-maybe-eval-formula)
(cond (arg (call-interactively #'org-table-recalculate))
((org-table-maybe-recalculate-line))
(t (org-table-align))))))
((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax)))) ((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
(org-timestamp-change 0 'day)) (org-timestamp-change 0 'day))
((and `nil (guard (org-at-heading-p))) ((and `nil (guard (org-at-heading-p)))