diff --git a/compose-publish.el b/compose-publish.el
index 4afbe5f1656aa02576d62a2b1d8251d15073f7e5..4c5c7eaccb4c8dbc1016d68b32dc05e02eeb2629 100644
--- a/compose-publish.el
+++ b/compose-publish.el
@@ -182,6 +182,26 @@ To solve this problem, when your code only knows the relative path of another fi
      (with-current-buffer "*Org PDF LaTeX Output*"
        (message (buffer-string))))))
 
+(defun org-babel-execute-file (plist filename pub-dir)
+  ;; A custom publishing function for executing all Babel source code blocks in
+  ;; the Org file `filename'. Note that the function does not actually publish
+  ;; anything to `pub-dir'.
+  (progn
+    (find-file filename)
+    (org-babel-execute-buffer)
+    (set-buffer-modified-p nil)
+    (kill-buffer)))
+
+(defun execute-block-in-file (block file)
+  ;; Executes the named source code `block' in `file' without altering the
+  ;; latter.
+  (progn
+    (find-file file)
+    (org-babel-goto-named-src-block block)
+    (org-babel-execute-src-block)
+    (set-buffer-modified-p nil)
+    (kill-buffer)))
+
 ;; Use timestamp to avoid publishing
 (setq org-publish-use-timestamps-flag t)