From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id IFFtDePHU2cPawEAe85BDQ:P1 (envelope-from ) for ; Sat, 07 Dec 2024 03:58:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id IFFtDePHU2cPawEAe85BDQ (envelope-from ) for ; Sat, 07 Dec 2024 04:58:27 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ei1b3f5V; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733543906; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=OdZKpAIEW0yDyVBweSZNXMTLdaNKFDkq1EJr1N+Z8Jk=; b=kZr6TUEfgMmyjlwb0GsLBMNPkZRbr0UYq8as01aH+MrzKB+Qv5AW0ASpxc2eHNZq8Hj/z8 cUP0lh354PXGDkrLVjTE+44qZdb9WkRSLPAcmiqO9jVyAjlN1nnJDI5K4MHQd1O3dCnkZB joxK6nZe06iQL/Q8CqcFym07TJHs1bg44RYZxkd6FvrpzgidLn+zKGZamXd2sRAL+1FdVe zY25wVNmXfUVbcWDt1YGqWPN7PYN5xX1vUernmeOW+OcXsl9SrGo26oMvVA/zU/ptahdfM yS2Zz7S2vsFtFqZxG1O+TuMDKr1lJyes0145u2wj+oWP8a5iLHn2Ihlvgiir0g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ei1b3f5V; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733543906; a=rsa-sha256; cv=none; b=LhuvupunzrtuE893VH/0RQBClJ5TH22h6he6TKiscaNnEZpZs1dTgZ4ZeJszJdO5xVBvpn Ik4DxUwQEj91+ZIQ9gvjZZa1PFUP7g+eU8J4dFBlnY4DMTRKtNpXUQdesfNjx0nTLG07FR 0tHuYEWnl7Oy/C3b8IbbcMUQhr3lh9DqbaF+3We/TRlLhbGFOuPuua48wfF2pDAVS9Lt6O TLTJuaHnTwudUtls1qpkTiRZN8ZkKwMN4m3uJGTJN8W0IKWcGGMCOwm75kFGRFkYavozFZ 7udsXLY/x4qgTul58ftlRQCmhNLEHiUERHiqMIs37m1ecrRcfXJpimueL84FiQ== 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 BA4F585BFC for ; Sat, 07 Dec 2024 04:58:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJlwr-0003PX-96; Fri, 06 Dec 2024 22:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJlwp-0003PJ-Tp for emacs-orgmode@gnu.org; Fri, 06 Dec 2024 22:57:40 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJlwo-0001mg-7n for emacs-orgmode@gnu.org; Fri, 06 Dec 2024 22:57:39 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-7259a26ad10so2207703b3a.1 for ; Fri, 06 Dec 2024 19:57:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733543856; x=1734148656; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OdZKpAIEW0yDyVBweSZNXMTLdaNKFDkq1EJr1N+Z8Jk=; b=ei1b3f5V5+g2htlypFYu9htxmwPvUfo1RKG67EORhe1FmDJU6tN/9AesUAoTw3Qvhc lAodijhiIo91RgeAu3kvCOMI5S40ZeLQlHM1UPw+LS9UR9kujJelE5Y+76LgZ+vnL9MH 1hkyCypaAd8kntamzzs4RBHVHEnpJ+Gc7wAQsDAtteQz6S/MKhG5PsYNCcXS7WX6lFpg iCaOT26MXb3o+jM2y4+3OP6b/j3SLIPGuSRAUfXuN0kap4AU9S/98y+hTgDMqXBBkPEA 394KVSKTV8hO2vguFSHbF9dSzmJYRx6A3d2zENMhGLiAqUcwkayqFfwITPpJksbvNHHn X38w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733543856; x=1734148656; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OdZKpAIEW0yDyVBweSZNXMTLdaNKFDkq1EJr1N+Z8Jk=; b=P2tDA5Qy7ndP1PtLC2UEElOybruFEj4bHqTkL2osFo0HLlgqIeePXf3vjIq2LKdGXG CUoCVvwW0Y3cOVmZ4K89h2Jw8ljXExdqAWTCkFlf+hIYUZnOMF1N5rmWKDG1osf9JYlZ kUpWQ21sza1jz9AasmPcDJ9zVX7t80OtsRW2OddwBG6Fr1kiJS24204pNgxR4bzkApvg 2MAkEuiAXYjcMR0/kZSTAylxigBIa7eNFRonW7lKvbm6lbXXlGLtVV3ShysHVBwz+nNa 1eQ5g8ZZ6e4kW7VPkyUeICX4YyXAhrfI1DVE6CfOprmLyt3Qb3Obt7l5swJu7TvUA44L xZ9g== X-Gm-Message-State: AOJu0YzS8XuBJ6Bd00VeemPf1AquTDbbXRgO528n6SIwU9nGJr685dnF xuq88bzxZOx4Mtc7c74XMATM04fahibG64XeYqm6HKf6APBd2JWhaOS98jSM X-Gm-Gg: ASbGncvdbuvq/unHI9138UuCmXYicnPri845LJlc+RA54+28L15cyMTjgLlppSvsSbG fEeNBicZu1HUp7IdL3JoXik7MKAu2LJKHMDAZQ12Y2KBh6szcHlJ8S3rbsJpp2NqIkC9gSAvRxM dtz+nAU67xGb5AhImTx3cePpN2G+u8AnPF1CwNcw5RLHetWMX3xOflg1fCypnwKkPLJqZrJ3L4E 7dH9DvFksB1f+0s7utRhKoWUVQydSPXV9EG03GJ0ibnje/6N84O50Ej0vL86TgjDRSrhsRsItRs 8y6b8bG5TQ== X-Google-Smtp-Source: AGHT+IHKz18gVn5IqAuYVEPXBM1Ca6WCfwH+aWI0uV2Ie/ifO920huFDbRjjXatcNPyXYI+4YkdFvQ== X-Received: by 2002:a05:6a00:2d11:b0:725:437f:9656 with SMTP id d2e1a72fcca58-7259d6620bamr17265481b3a.11.1733543855695; Fri, 06 Dec 2024 19:57:35 -0800 (PST) Received: from localhost (113x37x224x100.ap113.ftth.ucom.ne.jp. [113.37.224.100]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725a2a90364sm3775999b3a.102.2024.12.06.19.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 19:57:35 -0800 (PST) From: Slava Barinov To: emacs-orgmode@gnu.org Cc: Slava Barinov Subject: [PATCH] lisp/org-collector.el: Add support for TBLFM Date: Sat, 7 Dec 2024 12:56:18 +0900 Message-ID: <20241207035621.147856-1-rayslava@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=rayslava@gmail.com; helo=mail-pf1-x434.google.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, FREEMAIL_FROM=0.001, 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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -0.89 X-Spam-Score: -0.89 X-Migadu-Queue-Id: BA4F585BFC X-TUID: cZX1d0aXGIst The :tblfm keyword adds formulas to the end of table so they are applied right after collection is done and the table is generated. * lisp/org-collector.el (org-dblock-write:propview): Add support for the :tblfm keyword. --- lisp/org-collector.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/org-collector.el b/lisp/org-collector.el index b645d3a..69f4e0f 100644 --- a/lisp/org-collector.el +++ b/lisp/org-collector.el @@ -122,6 +122,7 @@ preceding the dblock, then update the contents of the dblock." (noquote (plist-get params :noquote)) (colnames (plist-get params :colnames)) (defaultval (plist-get params :defaultval)) + (tblfm (plist-get params :tblfm)) (content-lines (org-split-string (plist-get params :content) "\n")) id table line pos idpos stringformat) (save-excursion @@ -148,6 +149,15 @@ preceding the dblock, then update the contents of the dblock." (while (setq line (pop content-lines)) (when (string-match "^#" line) (insert "\n" line))) + (when tblfm + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^#\\+TBLFM:" nil t) + (setq tblfm-pos (match-beginning 0)) + (delete-region tblfm-pos (line-end-position)))) + (unless (looking-back "\n" 1) + (insert "\n")) + (insert (concat "#+TBLFM:" tblfm))) (goto-char pos) (org-table-recalculate 'all)) (org-collector-error (widen) (error "%s" er)) -- 2.47.1