emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org aea31b0 2/2: org: Enable plotting with C-c C-c


From: ELPA Syncer
Subject: [elpa] externals/org aea31b0 2/2: org: Enable plotting with C-c C-c
Date: Fri, 30 Apr 2021 03:57:10 -0400 (EDT)

branch: externals/org
commit aea31b0656337b3dfb7d6295043b2c5754067f20
Author: TEC <tec@tecosaur.com>
Commit: Bastien Guerry <bzg@gnu.org>

    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".
---
 lisp/org.el | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]