From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ECf+KUHphmDzVwEAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 18:24:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id +O+NJUHphmACfwAAbx9fmQ (envelope-from ) for ; Mon, 26 Apr 2021 16:24:33 +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 E38CD1BF03 for ; Mon, 26 Apr 2021 18:24:32 +0200 (CEST) Received: from localhost ([::1]:59318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb42B-0008NN-LI for larch@yhetil.org; Mon, 26 Apr 2021 12:24:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb41o-0008N7-96 for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 12:24:08 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:40519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb41m-0003BW-Ma for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 12:24:08 -0400 Received: by mail-pl1-x631.google.com with SMTP id 20so25260400pll.7 for ; Mon, 26 Apr 2021 09:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:message-id:date :mime-version; bh=Nj20LpIOP6zRgj+3b1Of2WsXCgCDmx0Jb1dfYcceSjU=; b=j7HC4oLt5sLEjY/vztHRj/sYaLrCU9aiIf7/0wfTaQBrTjmELt4eORI45nKTiWwYFX sTacIh4tnZdorhztcaE3oznZJ0l9ylEwtl90sh8MKA/jQZYZPm7DVl+VQGjt/N17EGZY h+JuRs+dwhZhWAyp2Ea9duBNThOvfjYtgcxzqwKSQHr7mzGyVx3y/eTWg9fy3MsAMmrZ 3axDZ+NXKeAwiM+izD3q5MjJxkyzHetmTLpJxWwpS8O5p7S/fy44vdbcUI2ndffmnysy 3W5SCWMVNTnmqab6MJ8+ogBYEVw5+1WO34FEjSH2qMftkkS2GUxjGjEHMDmcesve4qup /rAw== 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:subject :in-reply-to:message-id:date:mime-version; bh=Nj20LpIOP6zRgj+3b1Of2WsXCgCDmx0Jb1dfYcceSjU=; b=c77DbkpU44kGZQydTptlziKSOHDO3vKFFg1EKEQQA7WEeQ0F8KhnCB4TZInTSHeb3y yBvanH3MBo3D3iIFWd/nV8wG7l2VBSmzph0q2zni8akeRVIN8Ons5lcfAkVN8fqxfv0+ gfBoDpYYfVT5O7eyFbnyfcDgTU/ciap0C5ESQOwaRdoGtt22nPPmzUByuOWL4VVKn08S 75tDdHO/ZP9Td64IyaMSgtwUk43wytaaA8ngSgEYSAfi5T1/Tvkl3EtGKZCUtK9XpGzx dSyylisZU6WydXmIuNoDWYkQSeLWtVyDGk3Zs2EtRoMa36P6UYUAjuMNCC/YLukuR7CZ bQSA== X-Gm-Message-State: AOAM533k1gZmMU3tIFgOJFTn5EH+V6pWwl6JxVaFAzy1ZYmszduf1lez /Se9r2YZhWU2jeGwtfz1z5ixlJocHkM= X-Google-Smtp-Source: ABdhPJxgya6G4r1essplFOVerLwkJZ2CSavP8UT06cWlUjbcJtdyVf0rjbzc45Kf0hWiJWcMHqtbIA== X-Received: by 2002:a17:90a:8c87:: with SMTP id b7mr22597630pjo.128.1619454245357; Mon, 26 Apr 2021 09:24:05 -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 i62sm202017pfc.162.2021.04.26.09.24.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 09:24:04 -0700 (PDT) References: <87ft0jzbq0.fsf@ucl.ac.uk> User-agent: mu4e 1.4.15; emacs 28.0.50 From: Timothy To: emacs-orgmode@gnu.org Subject: [PATCH] Have C-c C-c recognise #+plot lines In-reply-to: <87ft0jzbq0.fsf@ucl.ac.uk> Message-ID: <87tunt580v.fsf@gmail.com> Date: Tue, 27 Apr 2021 00:24:00 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=tecosaur@gmail.com; helo=mail-pl1-x631.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: , 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=1619454273; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Nj20LpIOP6zRgj+3b1Of2WsXCgCDmx0Jb1dfYcceSjU=; b=fROe7VAuY2HbVXOzs1cCP0Hg8yzYjz7BslAGxBZ/0KKYgi/2T4PjAiUX7prc643CIYvqPF cgrWQ0n+tuPajkaBBFRIRlcwhVGBITR+gv5cRuDzMLOqUivyizAxeOY2DpVVFm7jsofUD+ Qm5zKxphCojtSZQjkQ8BmBQ1DUJ0Em+pdn7CE0JOXKeNFufeLKJBDPPhy/ADbIyAHCDPFN DyZXqP1kyD92TpP1aiTud7HhpFas6nZDHtev8E/W82eJI/zsWiwZhjG1RCxuOFJBVoMi7d XJW8dDPFtekng+NWYIJRQXjF44G57y9MRuWC+Ci2QfVLSfoq4nqt2TxySH0BCg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619454273; a=rsa-sha256; cv=none; b=J3Fy8egXdoA0d35AC4vRlodi+9q29IFhtVG12gduI4h7HBHE9t1YQlM6ZR+LtL7Feo9UT7 uU8xGACG6cZrN4mjIBXwLNUtpUe2LWiMmDoJcSHvCs/tGzbSj/ZNBauaUhDS2ZGrq+yZS+ CfnB1GBeRcA94vdgF7Fi7+kKPIWXI426TpaG1/kniR7rP5HFKTgvmsF/YFo75YTA4QmubM 4IispMPIHAYeTs2rBYM9XPJNzTCplB8BvGZ/K+3UtXrKLv6QlBMOPcjj3qNLA5rhHzElY9 zwCxRvyNVTfmWN/+WLky9dkUKZN9qc2QTneqNNTNcV4Zxy8zOsD5scr+FW0gZw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=j7HC4oLt; 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=j7HC4oLt; 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: E38CD1BF03 X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: 18hgRXVMu9/L --=-=-= Content-Type: text/plain 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). Eric S Fraga writes: > 1. it would be consistent and useful if "C-c C-c" executed > org-plot/gnuplot when on such a #+PLOT line. > > 2. why does point move to the next line when I do execute the command? > This is somewhat annoying when playing around with the settings. It > would be nice to have point remain where it is. > > Thank you all! -- Timothy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-Enable-plotting-with-C-c-C-c.patch >From fccd5f2c66fe8342da2a8eb405240f5247958597 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 | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3f9c9a284..950509bfd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17693,24 +17693,28 @@ (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 + ((string-match-p "#\\+plot" (thing-at-point 'line t)) + (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 --=-=-=--