From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id N13hFgnOkmCx2wAAgWs5BA (envelope-from ) for ; Wed, 05 May 2021 18:55:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KM3LEQnOkmCBDgAAbx9fmQ (envelope-from ) for ; Wed, 05 May 2021 16:55:37 +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 4CCBECEB5 for ; Wed, 5 May 2021 18:55:36 +0200 (CEST) Received: from localhost ([::1]:48904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leKoB-0007iU-7E for larch@yhetil.org; Wed, 05 May 2021 12:55:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leKe4-0001X0-8x for emacs-orgmode@gnu.org; Wed, 05 May 2021 12:45:08 -0400 Received: from mail-db8eur05on20721.outbound.protection.outlook.com ([2a01:111:f400:7e1a::721]:29281 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leKdy-0003hk-4R for emacs-orgmode@gnu.org; Wed, 05 May 2021 12:45:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QEEvPB0RT4KGsD02blQ93nBx8dlrNv7jIkZvyl74ZrQpfGzoh7PGk+Fp48PwQnZRSEyJe//BbhvcvPkRt7V65nplJ8oQLUFF7Q6nefNwm7ZObo0HJrJpecXhFhLTNBtJBnsTSIY6RYRA2755ykMt4f39wiTIDESAbxnl/oy7P+eXLmWeyp7byXCC9XzZ+kAyvDjzC8Dvr1itvjU9zQKX0Pg+iGXN9Tgwptv4mNS+QhyXgUaDu94jlPVYWpnw/D2ZvE5kfkW4tjroyVk2WyBRdNYCIxj6IGO21FiNJWHhnBrf52Kw0EqyirM4n48X04Kui145VaJShfxkkpvZVnV68Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CvTvXXEJtPBuVUIQfqR3rO22P+7SrO6srdpfTxFDBx0=; b=gjBM0SAnEcoJvBMDL55HFJYK8pThGIH4pENayx62Z7u1RX7AhRG0o05gYMdqELiSMiE8N+a5FQLWg3O8+Bc50vGSb1I7t4W+cjnvr/m7w/vC2mMQ6gZqVA52Z08jsBqE+O3LzCAo8HALzHNKUBYh3EjQRqCwtJ6yDyGrZTXhyLZmekValoTi7WNEtx+mO83yDQlVhlnm/nTVuDVbxYGyIEJLJEZJ8BEefT/++DEVkDkkmDLRa6WEvNluqBBwyxWLWPQfxphqGptOg9Wx44JCRz9wyWGYb58rRTcR2m7PM3idh4ijI8oK6VMDVz+a7EIo/pjAWdgnvXL32IbJ7Sqk+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ucl.ac.uk; dmarc=pass action=none header.from=ucl.ac.uk; dkim=pass header.d=ucl.ac.uk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucl.ac.uk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CvTvXXEJtPBuVUIQfqR3rO22P+7SrO6srdpfTxFDBx0=; b=KIMx+ZhUSloVCHWgGeJXmjf673i8EzgIlUYHR4WW0NX1tJp98WKQB+WjOqHoCQPseGbMfaJLqjx89JQG1oyMLE1sCxPGJGO9ce8S2EoE4bF2/xLc8wRGYrcK52F8fw8hub1tCeE/XZ9xjMc5FZ0FVrv1Ovbi7tfV1ZfmA2sdmTk= Received: from PAXPR01MB8415.eurprd01.prod.exchangelabs.com (2603:10a6:102:21e::16) by PR3PR01MB8082.eurprd01.prod.exchangelabs.com (2603:10a6:102:179::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.40; Wed, 5 May 2021 16:39:57 +0000 Received: from PAXPR01MB8415.eurprd01.prod.exchangelabs.com ([fe80::dbd:886e:5854:8cec]) by PAXPR01MB8415.eurprd01.prod.exchangelabs.com ([fe80::dbd:886e:5854:8cec%5]) with mapi id 15.20.4108.025; Wed, 5 May 2021 16:39:57 +0000 From: Eric S Fraga To: Matt Price Subject: Re: Multiple calc commands with orgbabel Organization: On the Interweb somewhere References: <871ral7kq8.fsf@ucl.ac.uk> X-Url: http://www.ucl.ac.uk/~ucecesf/ Mail-Followup-To: Org Mode List Date: Wed, 05 May 2021 17:39:55 +0100 In-Reply-To: (Matt Price's message of "Wed, 5 May 2021 11:11:19 -0400") Message-ID: <87eeelrv6s.fsf@ucl.ac.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-Originating-IP: [95.146.38.114] X-ClientProxiedBy: LNXP265CA0036.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::24) To PAXPR01MB8415.eurprd01.prod.exchangelabs.com (2603:10a6:102:21e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from t3610 (95.146.38.114) by LNXP265CA0036.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 16:39:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34ca646a-d06e-4e2e-a4b3-08d90fe46ae9 X-MS-TrafficTypeDiagnostic: PR3PR01MB8082: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pdDsMQRT03lf6xfPFOTf5G2ufR8OGtfv6LiyNY5P7O9V9fHD4+9+gIsn2UvS49OQWESxLilWJJwthvG2flLkhybQcVgh2kmkGAkzwrBOIBiwbM3qODD5kII9TfyA5TLxDeiGuAmL5pTW37uMg+kGPWh8JH1dEAnp5O4sfh4k957HfyojmM6ELHankPRrKM86X77YIFQAXDQv1t9oRemjthLRhQIk8YPLDVNQC9tcF88AI/E91ls4nBT6dILsavu2M/Pf8LXvAuyPRc8G23c2w05vFgh+SeCcfUBNrLIAJFeCrd5oKi1zziUUfsIF1BSpHfH9uCo6wLOAdXdKutr0zYFFrzSMZHIqYuQ26nMwoqJsrMKW/k9eBKyS5vpEJZZ2d2G92K7AKBrDJKJDO1Jaqe78OWNisdml3zk/Hw42O5WGLocQ1tISqz0sfx/rgp5so1OFXsPAHfEL2g601IJqShQo07yMhKyyvX6B4kRIGafMhZrKHEeKpgTsZO6MXunMeQYdoL2t1xyO1hJbn3vwY0wD3OGsDO2rBO4RysrV/ZdstnoL1rNzoMXzcYx0wYB31Q/hij/yYJkrr1RiWDJp1kBmIfQcPXJWumFP8nJ5pVO/H5Q59HgE5k513ZaoyBBF2ikFVyj9eHqQpGJ0GGvyP5mPaNmTGMxOzO3UO+YZXZs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR01MB8415.eurprd01.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(366004)(396003)(39860400002)(8676002)(6496006)(2616005)(86362001)(956004)(36916002)(316002)(786003)(66476007)(478600001)(6916009)(38350700002)(66946007)(26005)(38100700002)(16526019)(2906002)(36756003)(4326008)(6486002)(83380400001)(52116002)(186003)(66556008)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?nAGx0NaLy2tz+df5hFzmK1Z0wxYFuJp3zv4mnCHGMdwN1xCZEM6V6jA2Bv9J?= =?us-ascii?Q?O8VmY7pHgfwunUzHV+CbGKUYDEc3kIf9NH0HEQGt0dcJCuvVlAEcYmOKRz85?= =?us-ascii?Q?7zNnGX5tVGV1ioYLLI3oaD9wvy50G+A2vTaL75TTXmCdiDWX1Hi5OOx3yh7x?= =?us-ascii?Q?/dMxshQWrdluj8hvv8f8ktOv3VMAkJiaDxOJ7VWMqBUsVV0evVvYaE3TFaTY?= =?us-ascii?Q?JopE+O0UiVchLiVd1IyJmFdYLay4kDDmN587XPTju+ZmKVru9DBC1XwlwCA1?= =?us-ascii?Q?UzgPYcc5J1dLySwbhKb4IB3HXXItrK96rVPcEI3ENA33AVXvrAuagsz2vesP?= =?us-ascii?Q?AjvyVi04DD4mvoV6Zp4RUfAjYRET+Sah+3m1aO5jOdIX1NiFsqyZ1VgUcgip?= =?us-ascii?Q?92BrzuwGLcPWYGWDphBe6rLl6X04XLUA1Z2P6/+AG+X1mH5czDMj9+QV4LFl?= =?us-ascii?Q?J3G5aan/GzhZzjjjldICU+/zSj4h0DSWich634E0uihGQ57FdGqfUdfqyWYC?= =?us-ascii?Q?SzNwmJ1EYQJRoRyr+RIWh4SzeVo5R8othFnQbbx0ElTCgx2eyPbcEG0avWpk?= =?us-ascii?Q?tww4DQRMaGgGYCAv2TpETdy4KiXNxCFjmJrgufji7ijFC3M7L1B3/cjFwWXY?= =?us-ascii?Q?IfytTbYo827m4dqGy5kxCjQrEc/SM3vsIpp0A1xGzAsg5vwJaQusRPB/lURg?= =?us-ascii?Q?tl0EHWzsxFIvXB8YnqQ+NRZ45BvO2AGYseMI/fTysWZ1boM4oyuyvbkrvpV6?= =?us-ascii?Q?DMsErh885xzv9Ju23o92zJDwllk0k8/E7khNlBRm26B/5M0mlQu0kCqUhr80?= =?us-ascii?Q?iSpKs7Ioh4+Brku8fMPym4tf0r1HLn3FeXLtc14aBCg5keVH1QwPnSGbJ9BI?= =?us-ascii?Q?gKdAlMxWyva+jGJ4+INdyxQQ5mAZcE5Yw2U9kTwDtqQaMzF2NxjF90XI5Cx2?= =?us-ascii?Q?gbVcvj9btGcK3RUGy0BpzAhYAq0gLYOqI9Gt8boD+F6eqm9aIc1aodiqR5j5?= =?us-ascii?Q?uxZ+yAz0iMPsncmyURW35gSQsCKFBmG/ULmoKIMCyhiXWBnfxjQgzsiqxSug?= =?us-ascii?Q?F5IcciFXyvh9aBnugSEnkUo+xdno655Icjb3Eut75M5YrNX/FMXDxTUUP6a3?= =?us-ascii?Q?GXfybNxC9kFYEWYul6zw3L8s8YpWeIhkfHhpaEl97LnloZrzxqtjfPIGwaRI?= =?us-ascii?Q?PlBmdqsxawsQjtq0Z7NOteDkLT7PKEZzWmE5Qp5UoKDqz9c7F4mIiLXxq/YI?= =?us-ascii?Q?PjaOi6uiUztwh0Ga1lv1Vbjv5QO2eldCBbqbqLEKgu+06CGtBgO6aCDUSUI2?= =?us-ascii?Q?HbGDlOWPHwj5p0B/nPoOdW83?= X-OriginatorOrg: ucl.ac.uk X-MS-Exchange-CrossTenant-Network-Message-Id: 34ca646a-d06e-4e2e-a4b3-08d90fe46ae9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR01MB8415.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 16:39:57.2214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1faf88fe-a998-4c5b-93c9-210a11d9a5c2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 663XetgK01uW549OfaFaKPjyzR2XggJY9GCOxiLhh5teu+6hfgnAfmQCtt63imxwEEJVP2Hh695NKlZ64Q6kUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR01MB8082 Received-SPF: pass client-ip=2a01:111:f400:7e1a::721; envelope-from=e.fraga@ucl.ac.uk; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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: pietru@caramail.com, Org Mode List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620233736; 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=CvTvXXEJtPBuVUIQfqR3rO22P+7SrO6srdpfTxFDBx0=; b=uT/JVTnfp+956dj/3Fb/OYVNBgJTrJeQyIzflBIP7VibCNV96nHcmMwDvQ3o2b4xzF9PFf Zd7g2/Ml7cDryCE6YhI4eAsZlenQoGHV3joLo4tE9KyuL0PlT7xNjXOuY5ec6vGsGxH1CX DJqSMnXtr8PXS2pKsf8KG9ikB65DyPjgtKWAJwEB9H5YwZPVivEIjN7acBMXIvm0AG5p2R h4L5ku3nLIHX+oMNLomo71EMJevIAMtYYnwxom+unertaIhfWE/n+V6qvWsGxSy77Ljs01 w495xFrAmRymvi2xh9sUswuT6zOL790nAiCZ2HfRoAqv3JcNKNAke135XcDWIg== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1620233736; a=rsa-sha256; cv=pass; b=haFmJAANkA3WAiCGy/6IsPdKrYt1AaJAAD2oS+2L/LNCT1oFO/wi5IrCP1oGu+JCkktFbC juWmFkEfffaSTgyIV+BGqKLRX3speGFp+g/MeoQ9aRT3DIPZBGUHVCEaMmU6jLTNcZgjQQ ZG5Mb9fKn9btD2qhc8c60D7lJrV7DLoZCkyl9T1cPVuhPDsqLFTWzqBcukuiNNnJZ/nwZE mOVJDgakKgxwTu3kPbTJYsKiPmxmHA6Ke7ImlUiuHjiVcfNf4lO7B6yyABzEQFrcjXwc7M Sr0nYO9TH+HFcF1Hr31pGMMYzbh2FDeLVzC4hBbK+t6wjG+AdXSVartyBTiFBg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=ucl.ac.uk header.s=selector1 header.b=KIMx+ZhU; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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: -4.17 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=ucl.ac.uk header.s=selector1 header.b=KIMx+ZhU; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=ucl.ac.uk; 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: 4CCBECEB5 X-Spam-Score: -4.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3o68/+jnlC2Y On Wednesday, 5 May 2021 at 11:11, Matt Price wrote: > Can you explain how you get calc embedded mode working in org? I have > never used it and it sounds interesting, but I don't understand what > hte delimiters are. Sure. Here is a mini-tutorial! :-) I recently gave an interactive talk on embedded Calc... The out-of-the-box settings for Emacs embedded mode are such that any line surrounded by empty lines (i.e. couple of blank lines before and after) can be interpreted as an expression to evaluate by Calc using "C-x * u". You do not need to place these expressions in any src block. The detection can be somewhat fragile so extra blank lines are sometimes necessary for some reason. For instance, copy the following few lines to a text buffer and type "C-x * u" on each line in turn: --8<---------------cut here---------------start------------->8--- x := 180 => y := sin(x / 4) => z := 2 y^2 => --8<---------------cut here---------------end--------------->8--- The general format for an embedded calc expression is var := expression => value where only "expression" is required. If you don't have "=>", evaluating the expression will replace the expression with its value. If you have lines as above, with assignments and values after the actual expression, you can then go back to the first line and change the value, say to 90, type "C-x *u" on that line again and all of them should update. The calculations can involve calculus (derivatives, integration), linear algebra, and units. Calc is actually an incredibly powerful (and relatively unknown) computer algebra system hiding within Emacs. The variables that could be customised to have org specific recognition would be calc-embedded-open-formula and calc-embedded-close-formula. It might be useful for the community to think about whether org should have org specific settings for these variables. I actually define settings for org so that only lines that look like this: #+calc: expression are interpreted (without requiring empty lines around such lines) [1]. I then have code for processing these lines on export to LaTeX to present the equations and results in a more accessible way as I use embedded calc a lot for teaching (beamer slides). Final note: the info manual for embedded Calc mode emphasises editing the expressions and interacting with Calc while doing so. I find that method of working rather confusing, tiring, and unproductive (for my use case) so I write the calc lines using normal editing and only "update" the expressions to get the results. YMMV, of course. Let me know if this helped at all, eric Footnotes: [1] it would be nice to have some generic way to hijack C-c C-c on such lines to do what I want, e.g. calc-embedded-update-formula. -- : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-395-g82fbdd