[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] lisp/org-collector.el: Add support for TBLFM
From: |
Slava Barinov |
Subject: |
[PATCH] lisp/org-collector.el: Add support for TBLFM |
Date: |
Sat, 7 Dec 2024 12:56:18 +0900 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] lisp/org-collector.el: Add support for TBLFM,
Slava Barinov <=