When I execute a source block, I'd like to get a timestamp on the
+RESULTS block so that I can remember when it was last executed. Is there a built-in option for this or do I need to go in and add a hook or a advise a function somewhere?
I came here wanting the same thing, but finding no answers, I wrote my own defadvice wrapper:
NOT BATTLE TESTED: #+BEGIN_SRC emacs-lisp (defadvice org-babel-execute-src-block (after org-babel-record-execute-timestamp) (let ((code-block-params (nth 2 (org-babel-get-src-block-info))) (code-block-name (nth 4 (org-babel-get-src-block-info)))) (let ((timestamp (cdr (assoc :timestamp code-block-params))) (result-params (assoc :result-params code-block-params))) (if (and (equal timestamp "t") (> (length code-block-name) 0)) (save-excursion (search-forward-regexp (concat "#\\+RESULTS\\(\\[.*\\]\\)?: " code-block-name)) (beginning-of-line) (search-forward "RESULTS") (kill-line) (insert (concat (format-time-string "[%F %r]: ") code-block-name))) (if (equal timestamp "t") (message (concat "Result timestamping requires a #+NAME: " "and a ':results output' argument."))))))) (ad-activate 'org-babel-execute-src-block) #+END_SRC #+NAME: test-no-timestamp #+BEGIN_SRC shell :results output echo "This ones doesn't have the right args for timestamping" #+END_SRC #+RESULTS: test-no-timestamp : This ones doesn't have the right args for timestamping #+NAME: test-timestamp #+BEGIN_SRC shell :results output :timestamp t echo "This one should have a timestamp. Run me again, I update." #+END_SRC #+RESULTS[2017-10-03 05:19:09 AM]: test-timestamp : This one should have a timestamp. Run me again, I update.