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 GOHyNlv1hmCsAwAAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 19:16:11 +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 CA6AMlv1hmCZJwAAbx9fmQ (envelope-from ) for ; Mon, 26 Apr 2021 17:16:11 +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 429CF1D4DC for ; Mon, 26 Apr 2021 19:16:11 +0200 (CEST) Received: from localhost ([::1]:35140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb4qA-0002e1-Br for larch@yhetil.org; Mon, 26 Apr 2021 13:16:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb4nm-0001ad-Ki for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:13:42 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:36542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lb4nk-00010Z-SU for emacs-orgmode@gnu.org; Mon, 26 Apr 2021 13:13:42 -0400 Received: by mail-pl1-x636.google.com with SMTP id g16so12429872plq.3 for ; Mon, 26 Apr 2021 10:13:40 -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=BcplDT97a7hpgrz4xIrF/fzAUxXq6JaH8+mmpdjZh4Y=; b=drnIQ2SeCgbQscSVp+zRjd+KKVEyKPzsZG5I+rzmNxm7EP2HQLKKem7+957BNQatkb Mw1uyAhl8YfdGBvNIZR7uCxcb8VafgqIp/9z9HZxzelYC5wKtp+NVLCwsX1S3c+KGa49 +Cl9KpjDyTSB8pQjg4L5bKxEmQWqoZAxXvmf7nzHRdBOTxW9bzs5OLojS73rXNTvUOJX Bi+Wmkq+SFcmZU5pOfswAcTzuHFRDs6I3cLhbnsY5mtMgTqeuhiZRcmPCNkKjnnejRJr keab0vHV/FEEDXtEg5UcYICTMtW8rf876xfJ356oV7Hv29UHAyHMxZsCgD4PUU+LXNYi h/Uw== 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=BcplDT97a7hpgrz4xIrF/fzAUxXq6JaH8+mmpdjZh4Y=; b=PllsOA8dWRrNrOvnV2d45azphwtkgWrL29kwO1+pgPlVq96D4Dr6osWuhH0h8ZxyO/ fjcaafrJDWraO5c6MpkLy2gWvxdDkQIT8rC5oXFd9JfeBd+lB2fhW777Xw9ivzYwi2Uy IZBWj+0IdfWyabRr7gCu+ge4GpO/iXHjY2GcSL2LsbHNmJfMqY+i8UDnLTLXCfOTNS7L UozBhsCoXHpahNBYVduiAzW33Ui2sQVFL74u/dA1WHYlEdJbOsyy/1ZpSZ1B39NvWmLc 8QsiKtUfVDQJhJSbvoJg1rlrAYlChTO6rr+YSTO5cOw5bLp6xi6lIr6YBiZfzaPMwWa4 wqLw== X-Gm-Message-State: AOAM530d6tfCcrRSfqaiAoK1/ypvYuQsEIYkG67jAsluRYYZcWyntw9l I4xS1Xo4AXeLwkcIqVQrpi8= X-Google-Smtp-Source: ABdhPJwntvVks3LRPIDW5G7+F+3JU3eflzPCtnXzbnN+eSUbJRg0mRbca98p+9yVD8RnCtI/oNXoxA== X-Received: by 2002:a17:90a:c8:: with SMTP id v8mr132587pjd.18.1619457219204; Mon, 26 Apr 2021 10:13:39 -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 e6sm11447869pgh.17.2021.04.26.10.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 10:13:38 -0700 (PDT) References: <87ft0jzbq0.fsf@ucl.ac.uk> <88f6c54a01f345d785492c4d5b3b82d3@VI1PR0102MB3327.eurprd01.prod.exchangelabs.com> <87pmyh5634.fsf@ucl.ac.uk> <87o8e155ub.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: <87o8e155ub.fsf@gmail.com> Message-ID: <87lf9555q8.fsf@gmail.com> Date: Tue, 27 Apr 2021 01:13:35 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=tecosaur@gmail.com; helo=mail-pl1-x636.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=1619457371; 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=BcplDT97a7hpgrz4xIrF/fzAUxXq6JaH8+mmpdjZh4Y=; b=KaYl824Z9N4Kfazem0xGw5hg1c2iRMlA1DczY1cfpJMzxagSnRITfw7hjMrv4oi818+0Fs pp/WPMXivftSOoI7LT7FdgESxirn20O5oXMryi0fPA7LEF78MEEo+vafxv0MM5WPj55i6J 1rIuafcwo3lvSY3ob9LxSH3/5BB9V8IGXbePF0HKJ4bqcM9BVbOofnT0nHXV3OqznN3dhN Z1Q7ymBsPJ6SX4DRBICZYd4YIOsq9sNe0CLxU8Kf7sk7HLakdGHHptCTtaaqSzMZ4uNvd1 8bYrXnZsfJgtNRmUWwxBVzrGfp9535uLvUcv7qjAZnzvROeHI2MNymCLHEphvA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619457371; a=rsa-sha256; cv=none; b=AJKENFsoe6mnsCg67qGOceZr8XrM/bYhfZ8uLUy4kGroGPad7XrYSjMLxUyDoD3Quu5K05 dhPwMkfh256D5jj7gOjotE2HniQCUjrKLMjPKFPz/4nz+91IxQRMro4cl9kBrgJJAGEB2z zBnsR9Ewej0n+yMbdNQ+YisEyOn868dUqStKBtpTb1Rz6xaBQ4mxblCNYQA6ZUdJ1NbsRm SIYGcdJQb8iJ2P+1TkFH2BbDW5N859+VW0oXXkjLvpwiArHBqAqvRfIHfFHLKMdDvVRdhs 7qXOQBFAaowVmyl3f1qe6MtOUxQhRg9J6ZImhG0K6iDOxE2JI9gmanV+RWpEQg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=drnIQ2Se; 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=drnIQ2Se; 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: 429CF1D4DC X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1Ma4kNuF8dEw --=-=-= Content-Type: text/plain Timothy writes: > Since you don't seem to have pushed yet, here's an updated patch that > takes into account Nicolas' comments. ... and that patch didn't take into account the need to escape "+" in the regex. Take 3. --=-=-= 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 --=-=-=--