From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EDpZAuf1hmA6BAAAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 19:18:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8CF9Oeb1hmAgKQAAbx9fmQ (envelope-from ) for ; Mon, 26 Apr 2021 17:18:30 +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 ED91111A8F for ; Mon, 26 Apr 2021 19:18:27 +0200 (CEST) Received: from localhost ([::1]:38688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb4sM-0004Gt-P0 for larch@yhetil.org; Mon, 26 Apr 2021 13:18:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb4rg-0004Do-D8 for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:17:46 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:43928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb4re-0002vO-9B for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:17:44 -0400 Received: by mail-pf1-x429.google.com with SMTP id e15so2632795pfv.10 for ; Mon, 26 Apr 2021 10:17:41 -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=PnJ6fJRS8X9X097vm1E1hLaWeOiMnVZXeNyUvNYhk1k=; b=VtmQr8EvE3FxR1UFpLxAaO04TcxfD+XXmNJdLeasPqluP2YH4w/lC22P6tMzmSPAi8 uPm1IX6jrmFkJjjDXQr3/C1fAgo3Rk3JHpodkmjAVpoH+UdtBBG4FXzsu9k3RofDR23W 0/5CYb3F1RkGxWK4D0eipR04tn7gvovCP0B/Gdte7HjpJoeGgkS/rPgi+ywhN+nHhNSq XG6n6YECu4xxin+O1QzCuvoJPKoRHVxOtWn3amBwOTjjdGN2jnihbI14+TKBJhFdBFX0 yWFw4tNMD8YmUsEW3ivF1LtJbF/fSqxlQe7+TvmEsk/sQQOEeEmMLR02TNxl6KyoGYvm UOcw== 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=PnJ6fJRS8X9X097vm1E1hLaWeOiMnVZXeNyUvNYhk1k=; b=jHm2pLhZIPwtc5IwoB6CGrJWNCTTkLav7exGFmmLZYUBVX9wu0kA79nxd2MdyAxplL VUMM/2EqpIF10296JCFYr/W+zdqWnFwepIIv8ri5ngWxCHYRNgiahOesowU/KHuS8n3x e/y4HbcLJ0DdCtjfI3vrden8TJADME3m52vM/+vtsupMTYOJNz0Mbs72svyQz22qBqie OocM4c05rLCmRrYzY5D2vvZSetHnF2RWYURYvY9BDCbAYt4965HJaImIpr11wnzNnViJ EO+qXcwU4WxWP5PLW+wWAEoiE0ZDDAejN32jgLSFu03FBaEwHotKOfxrCktRWQRyNP4s 5UbQ== X-Gm-Message-State: AOAM530vpYZWXFt+SUiNLCKeqmYanndjl80ZFXVrX+nYdqFKAaBLlXxc S+xOFk3e4AHbz58Ifjo2HlQ= X-Google-Smtp-Source: ABdhPJxOl2MuMydqL+u9i47tJrotFRDsOwpZ0A0oJUK9CwDZUeXyRjxkf/OxtTa8CKfsXUVFeNVtWg== X-Received: by 2002:a62:1547:0:b029:272:1c45:5d1c with SMTP id 68-20020a6215470000b02902721c455d1cmr12397524pfv.77.1619457460677; Mon, 26 Apr 2021 10:17:40 -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 w8sm229739pjq.10.2021.04.26.10.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 10:17:40 -0700 (PDT) References: <87ft0jzbq0.fsf@ucl.ac.uk> <88f6c54a01f345d785492c4d5b3b82d3@VI1PR0102MB3327.eurprd01.prod.exchangelabs.com> <87pmyh5634.fsf@ucl.ac.uk> <87o8e155ub.fsf@gmail.com> <87lf9555q8.fsf@gmail.com> 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: <87lf9555q8.fsf@gmail.com> Message-ID: <87im4955jj.fsf@gmail.com> Date: Tue, 27 Apr 2021 01:17:37 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=tecosaur@gmail.com; helo=mail-pf1-x429.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=1619457508; 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=PnJ6fJRS8X9X097vm1E1hLaWeOiMnVZXeNyUvNYhk1k=; b=g/PBdl1R+GzaN4zY4DE+vPetTdCy776Q5Zxq4+qC576+g3BURqMlCC25AOzhb0L5MNpuLd ix+8pehKbsbC38bzqMvq9EPuJ7OVwuBWXgUEkAtRubuT9nCnJ5VKiAeg8Sugi2jMMT36V4 wrVzv1cu8g08tAzlhTYH4eCWrWag86o4Az4v/zqEXiKSPHD4Lf7ePU6vEMq5HK+1bQQYWK owgMBVzyzHaw0gFGJYt7VX6ghekN/48/z1EZbW9YuqKWllejNKJ7bNiny5ERcVZmkbW9M8 VLN5FzF2ibvcODbOB6rvUx/90gWQQrBVzKVcY69WYsnxUiWJNf1a0Konn6Lxfw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619457508; a=rsa-sha256; cv=none; b=GBDiUv3/M4QBliaCPxZjs7dlLBEx7Fh6rs5ba7Q1+O+NzqnUmIhkVoK2NByZRWSNWMaZmT ahx8+sEeu+KRWojUbnk/mXMQB/WX0Gw1LKqPPv5MajVBbeImA5k7E1mcvPArhjpdDArwSs fWhfXycz0fI38fZTc41B+cjzBwgogvsNn0JprmoMy2GM4AAB4S5CJvxOvtwnAvyKBfyfF9 F0IaA8Z2eBpBoNVLqVuR3UuXDpcytX0QE/3hC9RhSRjxh3bK9ZO1rJ+3hcEIQn+/vREadV 4B8R2UZE4HAg6xpbde2mVE6IvngkmPDWriKfs6Fm56xvWQfkL4kYotuqogoIXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=VtmQr8Ev; 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=VtmQr8Ev; 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: ED91111A8F X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: /k1tQ8bsUEtm --=-=-= Content-Type: text/plain ... I didn't regenerate the patch after amending the commit. :big sigh: Take 4 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-Enable-plotting-with-C-c-C-c.patch >From 4e5fcb4726711ff356656cb6fccf6e341656443d 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..94ef9660d 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 Sorry for the noise, Timothy --=-=-=--