From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QAMhHnP0hmD2hQEAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 19:12:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uO7QGXP0hmAyJAAAB5/wlQ (envelope-from ) for ; Mon, 26 Apr 2021 17:12:19 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A893F1D306 for ; Mon, 26 Apr 2021 19:12:18 +0200 (CEST) Received: from localhost ([::1]:56982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb4mP-0008QK-Ht for larch@yhetil.org; Mon, 26 Apr 2021 13:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb4lP-0008QA-Ga for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:11:15 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:38570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb4lN-0008H2-Om for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:11:15 -0400 Received: by mail-pf1-x435.google.com with SMTP id j6so14198pfh.5 for ; Mon, 26 Apr 2021 10:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=3OAI1Jp8i9k9Q2tQtawsvwZszrGeSQACHZzX1tl5V90=; b=YPn/kXrBW4WntEeIIMUF4xYVAbzdjZk1fkFy5lceShDtl1JtxJeOlLBGhKhP902+ec FaP2t243kJxv0hBqldMt2bSfUC28yq0fHzujNeVtRtLepCERvrXZSPLiWnsEf6jmf2VQ Xs2QuQGjD/UsmIcgifO8eHKQccGzLs+xV6V6x4KGxL5RcOGeoreTFhqwtOn5qg1+C2jA BZI0Bal+MBk6EH3TyzuD7Ayo4bRG+Cs1Wvoz/L/yPOkuZ/8czGqoRFG7s9YHOE4ANqWf FXEDnVP6/q3LL805qjgQnh1CVLOI/71nPIs4AWNdz0fr50W/c65yu2NC8Bm8BOpyT1C2 XACg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=3OAI1Jp8i9k9Q2tQtawsvwZszrGeSQACHZzX1tl5V90=; b=qrG9bDzVpDxA03FtbO6G6/eYgZp3U1XCulCWpKcBewHtYUselV5tL78KMwZF6KUo3h hNlSYLLNGwsMquRYDmlk9RFzkCIUGsfGaEoH5lnWGY+x++yBUjmDqh0w9O+gZqmyPeC8 40XbTex3BWlU1YgKjPG+C72Ksycxl9puqNzuxl8Wfax7o4pn8mF3rtYvr3TH3WYTopoZ ZYVHVEnr0AzL4OaZhQuakzsI93cYyqOg1esWNZkO87NdBqsSB7qMUg+Z/4ZvEQMKCEp1 UqXumPoTyfW6+3NWlbl22CHLP0TUWEMDLVq7FbpLc/TBhzD11AznbI8anaRE/+22NZzG NoTg== X-Gm-Message-State: AOAM531rHa4D9PclaUjuIk0+/8aOomy9x3xAG2KmOToBqsRyPBPBgbOP blkmy8BHhoy9TFbRy610n84= X-Google-Smtp-Source: ABdhPJwCduP+Mx+Ddwv+cOXXZUIHqLM2JCTfPcmMPCKnDiOb/m5P/TJKG1dh68zovj/ipSHZLmxX8w== X-Received: by 2002:a62:6202:0:b029:208:f11c:2143 with SMTP id w2-20020a6262020000b0290208f11c2143mr18884499pfb.32.1619457072012; Mon, 26 Apr 2021 10:11:12 -0700 (PDT) Received: from localhost (180-150-91-8.b4965b.per.nbn.aussiebb.net. [180.150.91.8]) by smtp.gmail.com with ESMTPSA id h17sm295176pfo.54.2021.04.26.10.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 10:11:11 -0700 (PDT) References: <87ft0jzbq0.fsf@ucl.ac.uk> <88f6c54a01f345d785492c4d5b3b82d3@VI1PR0102MB3327.eurprd01.prod.exchangelabs.com> <87pmyh5634.fsf@ucl.ac.uk> User-agent: mu4e 1.4.15; emacs 28.0.50 From: Timothy To: Eric S Fraga Subject: Re: [PATCH] Have C-c C-c recognise #+plot lines In-reply-to: <87pmyh5634.fsf@ucl.ac.uk> Message-ID: <87o8e155ub.fsf@gmail.com> Date: Tue, 27 Apr 2021 01:11:08 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=tecosaur@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, GAPPY_SUBJECT=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "emacs-orgmode@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619457138; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3OAI1Jp8i9k9Q2tQtawsvwZszrGeSQACHZzX1tl5V90=; b=L/MWtVl4KggUUEKkMtv9X7Tj96bDPVEaUs04MrJFSKXU4W81vF8/LIMjFzgFkfnQVm76gQ pvSBsu3dFQ4Pa1jGGmaqY4K0ysbTSX0ocEuMaFROZiKJTmeKhHMuAcKDu4nltqIEQBUBYN MuxnJX8ZXFE/KzfNsSI+IcKE0ts4XndxBA9SiyX1FdyC9ctiBozqMFEJGiuVM6LGWfQNr5 92oSVHqUfouFKTG0OvELf7QBvZUqk2Zdekh7UFFfRyaRdlBKGEDuSCftQUg1Jk1fEoOMJW 0nHGFEGRG3uvdJxc4PdhTYvuAwrBVyWPkSTPiUTz9NkANH5mSbCDBaRT31/dMw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619457138; a=rsa-sha256; cv=none; b=Fc7bgOqc70CoG6z0sfGAuUjVb+EuiYG6zzPLG1OIKE5iFADE74jE1qScw+Anoy69qL0u7/ pqfhGiSWf9uqrIXuYc2v++shkzvWk+hbwQcAZ6NAdwSGExTW6pFS51nvmLldv4NpuS6W+Z uveOWCQFh2gcxUZDs8rrQYhzfuhdXZ8TD02Ja/FP0sqlu/RT4eMOXDy5SMaI04q0CuqkgO 7WhHp5DPufhyzdjlFJie388xXTVDYqqhp3YZiGBZeIFdz17CuYXA/pyHrC8DWhRPZBvu5v /3CrDp9WRqEPfF3Iq2MlzLlpEOxMgqn+PKnYJAmwiF84z+7cuGnKBJ8tySYxlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="YPn/kXrB"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="YPn/kXrB"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: A893F1D306 X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: zEvzIEML8Hzm --=-=-= Content-Type: text/plain Since you don't seem to have pushed yet, here's an updated patche that takes into account Nicolas' comments. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-Enable-plotting-with-C-c-C-c.patch >From 04270b64315fed399748509f1c09428557b7742d Mon Sep 17 00:00:00 2001 From: TEC Date: Tue, 27 Apr 2021 00:05:37 +0800 Subject: [PATCH] org: Enable plotting with C-c C-c * lisp/org.el (org-ctrl-c-ctrl-c): When at a table, check if the current line starts with "#+plot", and if so call `org-plot/gnuplot'. As I think 4-deep nested if statements are bad for readability, I refactored the nested if statements to use `cond' while I was at it. --- lisp/org.el | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3f9c9a284..c4e2e132f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17693,24 +17693,29 @@ (defun org-ctrl-c-ctrl-c (&optional arg) ;; 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 "\\\ -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 "\\\ +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))) -- 2.31.1 --=-=-= Content-Type: text/plain Eric S Fraga writes: > On Monday, 26 Apr 2021 at 16:24, Timothy wrote: >> A while ago Eric raised two nice suggestions. (2) has just been >> implemented as Bastien reminded me that I can now just push straight to >> Org for org-plot.el without going through a patch-review process. >> >> This patch resolves (1). > > Timothy, > > I've updated org and applied the patch. Both aspects seem to work just > fine. I haven't done much testing, however, as it's beer time... I'll > update tomorrow should I run into any strange behaviour. > > thank you, > eric --=-=-=--