Browse Source

Added the extra :content parameter for dblocks.

Bastien Guerry 17 years ago
parent
commit
7da7810202
3 changed files with 13 additions and 2 deletions
  1. 4 0
      ChangeLog
  2. 4 0
      org.el
  3. 5 2
      org.texi

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-03-10  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-prepare-dblock): Added the extra :content parameter.
+
 2008-03-09  Carsten Dominik  <dominik@science.uva.nl>
 2008-03-09  Carsten Dominik  <dominik@science.uva.nl>
 
 
 	* org.texi (Exporting Agenda Views): Document agenda export to
 	* org.texi (Exporting Agenda Views): Document agenda export to

+ 4 - 0
org.el

@@ -14462,6 +14462,10 @@ the property list including an extra property :name with the block name."
 			 (read (concat "(" (match-string 3) ")")))))
 			 (read (concat "(" (match-string 3) ")")))))
     (unless (re-search-forward org-dblock-end-re nil t)
     (unless (re-search-forward org-dblock-end-re nil t)
       (error "Dynamic block not terminated"))
       (error "Dynamic block not terminated"))
+    (setq params
+	  (append params
+		  (list :content (buffer-substring 
+				  begdel (match-beginning 0)))))
     (delete-region begdel (match-beginning 0))
     (delete-region begdel (match-beginning 0))
     (goto-char begdel)
     (goto-char begdel)
     (open-line 1)
     (open-line 1)

+ 5 - 2
org.texi

@@ -8480,8 +8480,11 @@ Update all dynamic blocks in the current file.
 
 
 Updating a dynamic block means to remove all the text between BEGIN and
 Updating a dynamic block means to remove all the text between BEGIN and
 END, parse the BEGIN line for parameters and then call the specific
 END, parse the BEGIN line for parameters and then call the specific
-writer function for this block to insert the new content.  For a block
-with name @code{myblock}, the writer function is
+writer function for this block to insert the new content.  If you want
+to use the original content in the writer function, you can use the
+extra parameter @code{:content}.
+
+For a block with name @code{myblock}, the writer function is
 @code{org-dblock-write:myblock} with as only parameter a property list
 @code{org-dblock-write:myblock} with as only parameter a property list
 with the parameters given in the begin line.  Here is a trivial example
 with the parameters given in the begin line.  Here is a trivial example
 of a block that keeps track of when the block update function was last
 of a block that keeps track of when the block update function was last