1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-25 10:47:12 +00:00

Save and restore formulas for column view capture.

This commit is contained in:
Carsten Dominik 2008-09-08 09:43:41 +02:00
parent 4aa23cfb0c
commit 3f1062a15d
4 changed files with 27 additions and 4 deletions

View File

@ -32,6 +32,13 @@
** Details
*** Column view capture tables can have formulas and plotting instructions
If you attach formulas and plotting instructions to a table
capturing column view, these extra lines will now survive an
update of the coloumn view capture, and any formulas will be
re-applied to the captured table. This works be keeping any
continuous block of comments bfore an after the actual table.
*** The note buffer for clocking out now mentions the task
This was a request by Peter Frings.

View File

@ -4100,6 +4100,11 @@ Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
you have several clock table blocks in a buffer.
@end table
You can add formulas to the column view table and you may add plotting
instructions in front of the table - these will survive an update of the
block. If there is a @code{#+TBLFM:} after the table, the table will actually
be recalculated automatically after an update.
@node Property API, , Column view, Properties and Columns
@section The Property API
@cindex properties, API

View File

@ -1059,8 +1059,9 @@ PARAMS is a property list of parameters:
(hlines (plist-get params :hlines))
(vlines (plist-get params :vlines))
(maxlevel (plist-get params :maxlevel))
(content-lines (org-split-string (plist-get params :content) "\n"))
(skip-empty-rows (plist-get params :skip-empty-rows))
tbl id idpos nfields tmp)
tbl id idpos nfields tmp recalc line)
(save-excursion
(save-restriction
(when (setq id (plist-get params :id))
@ -1095,12 +1096,22 @@ PARAMS is a property list of parameters:
tbl))
(setq tbl (append tbl (list (cons "/" (make-list nfields "<>"))))))
(setq pos (point))
(when content-lines
(while (string-match "^#" (car content-lines))
(insert (pop content-lines) "\n")))
(insert (org-listtable-to-string tbl))
(when (plist-get params :width)
(insert "\n|" (mapconcat (lambda (x) (format "<%d>" (max 3 x)))
org-columns-current-widths "|")))
(goto-char pos)
(org-table-align))))
(while (setq line (pop content-lines))
(when (string-match "^#" line)
(insert "\n" line)
(when (string-match "^#\\+TBLFM" line)
(setq recalc t))))
(if recalc
(progn (goto-char pos) (org-table-recalculate 'all))
(goto-char pos)
(org-table-align)))))
(defun org-listtable-to-string (tbl)
"Convert a listtable TBL to a string that contains the Org-mode table.

View File

@ -13149,7 +13149,7 @@ This command does many different things, depending on context:
((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:"))
;; Dynamic block
(beginning-of-line 1)
(org-update-dblock))
(save-excursion (org-update-dblock)))
((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
(cond
((equal (match-string 1) "TBLFM")