* Set or update timestamp after evaluation of code block? @ 2015-09-21 12:46 Rainer M Krug 2015-09-21 13:17 ` Eric S Fraga 0 siblings, 1 reply; 15+ messages in thread From: Rainer M Krug @ 2015-09-21 12:46 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 758 bytes --] Hi I have some code blocks which represent an sequence of fitting-analysis-plotting. But Sometimes I am loosing track which code blocks I have evaluated. Is it possible to set a timestamp (ur update it when it exists already) when a code block has been evaluated, so that I have e record when it was updated? Thanks, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 12:46 Set or update timestamp after evaluation of code block? Rainer M Krug @ 2015-09-21 13:17 ` Eric S Fraga 2015-09-21 13:42 ` Rainer M Krug 0 siblings, 1 reply; 15+ messages in thread From: Eric S Fraga @ 2015-09-21 13:17 UTC (permalink / raw) To: Rainer M Krug; +Cc: emacs-orgmode On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: [...] > Is it possible to set a timestamp (ur update it when it exists already) > when a code block has been evaluated, so that I have e record when it > was updated? Could you make use of the :post header argument to invoke emacs lisp and execute org-time-stamp-inactive in some way? -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-234-g8c85c9 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 13:17 ` Eric S Fraga @ 2015-09-21 13:42 ` Rainer M Krug 2015-09-21 14:09 ` Eric S Fraga ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Rainer M Krug @ 2015-09-21 13:42 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1225 bytes --] Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: > > [...] > >> Is it possible to set a timestamp (ur update it when it exists already) >> when a code block has been evaluated, so that I have e record when it >> was updated? > > Could you make use of the :post header argument to invoke emacs lisp and > execute org-time-stamp-inactive in some way? Thanks - sounds possible? But if I just use ,---- | :post (org-time-stamp-inactive) `---- 1) an input is required and 2) the time stamp is inserted before the #+begin_src and makes the block invalid. How can I put the time stamp in the line after the #+end_src or possibly even in the same line, as this does not seem to have an impact on the source block? Thanks, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 13:42 ` Rainer M Krug @ 2015-09-21 14:09 ` Eric S Fraga 2015-09-21 15:15 ` Rainer M Krug 2015-09-21 15:10 ` John Kitchin 2015-09-21 15:37 ` Jorge A. Alfaro-Murillo 2 siblings, 1 reply; 15+ messages in thread From: Eric S Fraga @ 2015-09-21 14:09 UTC (permalink / raw) To: Rainer M Krug; +Cc: emacs-orgmode On Monday, 21 Sep 2015 at 15:42, Rainer M Krug wrote: [...] > How can I put the time stamp in the line after the #+end_src or possibly > even in the same line, as this does not seem to have an impact on the > source block? Above my pay grade unfortunately ;-) Sorry. Hopefully one of the emacs lisp gurus here will be able to help! -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-234-g8c85c9 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 14:09 ` Eric S Fraga @ 2015-09-21 15:15 ` Rainer M Krug 0 siblings, 0 replies; 15+ messages in thread From: Rainer M Krug @ 2015-09-21 15:15 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 895 bytes --] Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Monday, 21 Sep 2015 at 15:42, Rainer M Krug wrote: > > [...] > >> How can I put the time stamp in the line after the #+end_src or possibly >> even in the same line, as this does not seem to have an impact on the >> source block? > > Above my pay grade unfortunately ;-) Sorry. > > Hopefully one of the emacs lisp gurus here will be able to help! Thanks - and hopefully your pay grade will be upgraded. Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 13:42 ` Rainer M Krug 2015-09-21 14:09 ` Eric S Fraga @ 2015-09-21 15:10 ` John Kitchin 2015-09-21 18:43 ` Rainer M Krug 2015-09-21 15:37 ` Jorge A. Alfaro-Murillo 2 siblings, 1 reply; 15+ messages in thread From: John Kitchin @ 2015-09-21 15:10 UTC (permalink / raw) To: Rainer M Krug; +Cc: emacs-orgmode Here is one approach: #+name: update-timestamp #+BEGIN_SRC emacs-lisp :var data="" (concat "Last run: " (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) "\n" data) #+END_SRC #+BEGIN_SRC python :post update-timestamp(data=*this*) print('hello') #+END_SRC #+RESULTS: : Last run: [2015-09-21 Mon 11:09:18] : hello Rainer M Krug writes: > Eric S Fraga <e.fraga@ucl.ac.uk> writes: > >> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >> >> [...] >> >>> Is it possible to set a timestamp (ur update it when it exists already) >>> when a code block has been evaluated, so that I have e record when it >>> was updated? >> >> Could you make use of the :post header argument to invoke emacs lisp and >> execute org-time-stamp-inactive in some way? > > Thanks - sounds possible? But if I just use > > ,---- > | :post (org-time-stamp-inactive) > `---- > > 1) an input is required and > 2) the time stamp is inserted before the #+begin_src and makes the block > invalid. > > How can I put the time stamp in the line after the #+end_src or possibly > even in the same line, as this does not seem to have an impact on the > source block? > > Thanks, > > Rainer -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 15:10 ` John Kitchin @ 2015-09-21 18:43 ` Rainer M Krug 2015-09-21 19:27 ` John Kitchin 2015-09-21 19:53 ` Grant Rettke 0 siblings, 2 replies; 15+ messages in thread From: Rainer M Krug @ 2015-09-21 18:43 UTC (permalink / raw) To: John Kitchin; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2257 bytes --] John Kitchin <jkitchin@andrew.cmu.edu> writes: > Here is one approach: > > #+name: update-timestamp > #+BEGIN_SRC emacs-lisp :var data="" > (concat > "Last run: " > (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) > "\n" data) > #+END_SRC > > > #+BEGIN_SRC python :post update-timestamp(data=*this*) > print('hello') > #+END_SRC > > #+RESULTS: > : Last run: [2015-09-21 Mon 11:09:18] > : hello Thanks John - that looks nice and I like the idea of using (current-time) and the possibility to format the time string, but this info will be part of the export - and I only would like tho have the info in the org file and not in the exported document. Rainer > > > > Rainer M Krug writes: > >> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >> >>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>> >>> [...] >>> >>>> Is it possible to set a timestamp (ur update it when it exists already) >>>> when a code block has been evaluated, so that I have e record when it >>>> was updated? >>> >>> Could you make use of the :post header argument to invoke emacs lisp and >>> execute org-time-stamp-inactive in some way? >> >> Thanks - sounds possible? But if I just use >> >> ,---- >> | :post (org-time-stamp-inactive) >> `---- >> >> 1) an input is required and >> 2) the time stamp is inserted before the #+begin_src and makes the block >> invalid. >> >> How can I put the time stamp in the line after the #+end_src or possibly >> even in the same line, as this does not seem to have an impact on the >> source block? >> >> Thanks, >> >> Rainer > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 18:43 ` Rainer M Krug @ 2015-09-21 19:27 ` John Kitchin 2015-09-22 7:52 ` Rainer M Krug 2015-09-21 19:53 ` Grant Rettke 1 sibling, 1 reply; 15+ messages in thread From: John Kitchin @ 2015-09-21 19:27 UTC (permalink / raw) To: Rainer M Krug; +Cc: emacs-orgmode so picky ;) Maybe something like this will put that stamp in a comment that won't export. #+BEGIN_SRC emacs-lisp (defun j-add-ts () (save-excursion (re-search-forward "#\\+END_SRC") (forward-line) (beginning-of-line) (when (looking-at "# Last run:") (kill-line)) (insert (concat "# Last run: " (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))))) (add-hook 'org-babel-after-execute-hook 'j-add-ts) ;(remove-hook 'org-babel-after-execute-hook ; 'j-add-ts) #+END_SRC Rainer M Krug writes: > John Kitchin <jkitchin@andrew.cmu.edu> writes: > >> Here is one approach: >> >> #+name: update-timestamp >> #+BEGIN_SRC emacs-lisp :var data="" >> (concat >> "Last run: " >> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) >> "\n" data) >> #+END_SRC >> >> >> #+BEGIN_SRC python :post update-timestamp(data=*this*) >> print('hello') >> #+END_SRC >> >> #+RESULTS: >> : Last run: [2015-09-21 Mon 11:09:18] >> : hello > > Thanks John - that looks nice and I like the idea of using > (current-time) and the possibility to format the time string, but this > info will be part of the export - and I only would like tho have the > info in the org file and not in the exported document. > > > Rainer > >> >> >> >> Rainer M Krug writes: >> >>> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >>> >>>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>>> >>>> [...] >>>> >>>>> Is it possible to set a timestamp (ur update it when it exists already) >>>>> when a code block has been evaluated, so that I have e record when it >>>>> was updated? >>>> >>>> Could you make use of the :post header argument to invoke emacs lisp and >>>> execute org-time-stamp-inactive in some way? >>> >>> Thanks - sounds possible? But if I just use >>> >>> ,---- >>> | :post (org-time-stamp-inactive) >>> `---- >>> >>> 1) an input is required and >>> 2) the time stamp is inserted before the #+begin_src and makes the block >>> invalid. >>> >>> How can I put the time stamp in the line after the #+end_src or possibly >>> even in the same line, as this does not seem to have an impact on the >>> source block? >>> >>> Thanks, >>> >>> Rainer >> >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 19:27 ` John Kitchin @ 2015-09-22 7:52 ` Rainer M Krug 2015-09-22 9:45 ` Rainer M Krug 0 siblings, 1 reply; 15+ messages in thread From: Rainer M Krug @ 2015-09-22 7:52 UTC (permalink / raw) To: John Kitchin; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3472 bytes --] John Kitchin <jkitchin@andrew.cmu.edu> writes: > so picky ;) Jup - aren't all org users like that? > Maybe something like this will put that stamp in a comment > that won't export. > > #+BEGIN_SRC emacs-lisp > (defun j-add-ts () > (save-excursion > (re-search-forward "#\\+END_SRC") > (forward-line) > (beginning-of-line) > (when (looking-at "# Last run:") > (kill-line)) > (insert (concat > "# Last run: " > (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))))) > > > (add-hook 'org-babel-after-execute-hook > 'j-add-ts) > > ;(remove-hook 'org-babel-after-execute-hook > ; 'j-add-ts) > #+END_SRC Perfect! I added it to my emacs.org just now and I relly like it. Thanks a lot, Rainer > > > Rainer M Krug writes: > >> John Kitchin <jkitchin@andrew.cmu.edu> writes: >> >>> Here is one approach: >>> >>> #+name: update-timestamp >>> #+BEGIN_SRC emacs-lisp :var data="" >>> (concat >>> "Last run: " >>> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) >>> "\n" data) >>> #+END_SRC >>> >>> >>> #+BEGIN_SRC python :post update-timestamp(data=*this*) >>> print('hello') >>> #+END_SRC >>> >>> #+RESULTS: >>> : Last run: [2015-09-21 Mon 11:09:18] >>> : hello >> >> Thanks John - that looks nice and I like the idea of using >> (current-time) and the possibility to format the time string, but this >> info will be part of the export - and I only would like tho have the >> info in the org file and not in the exported document. >> >> >> Rainer >> >>> >>> >>> >>> Rainer M Krug writes: >>> >>>> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >>>> >>>>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>>>> >>>>> [...] >>>>> >>>>>> Is it possible to set a timestamp (ur update it when it exists already) >>>>>> when a code block has been evaluated, so that I have e record when it >>>>>> was updated? >>>>> >>>>> Could you make use of the :post header argument to invoke emacs lisp and >>>>> execute org-time-stamp-inactive in some way? >>>> >>>> Thanks - sounds possible? But if I just use >>>> >>>> ,---- >>>> | :post (org-time-stamp-inactive) >>>> `---- >>>> >>>> 1) an input is required and >>>> 2) the time stamp is inserted before the #+begin_src and makes the block >>>> invalid. >>>> >>>> How can I put the time stamp in the line after the #+end_src or possibly >>>> even in the same line, as this does not seem to have an impact on the >>>> source block? >>>> >>>> Thanks, >>>> >>>> Rainer >>> >>> -- >>> Professor John Kitchin >>> Doherty Hall A207F >>> Department of Chemical Engineering >>> Carnegie Mellon University >>> Pittsburgh, PA 15213 >>> 412-268-7803 >>> @johnkitchin >>> http://kitchingroup.cheme.cmu.edu > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-22 7:52 ` Rainer M Krug @ 2015-09-22 9:45 ` Rainer M Krug 0 siblings, 0 replies; 15+ messages in thread From: Rainer M Krug @ 2015-09-22 9:45 UTC (permalink / raw) To: John Kitchin; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 5143 bytes --] Rainer M Krug <Rainer@krugs.de> writes: > John Kitchin <jkitchin@andrew.cmu.edu> writes: > >> so picky ;) > > Jup - aren't all org users like that? > >> Maybe something like this will put that stamp in a comment >> that won't export. >> >> #+BEGIN_SRC emacs-lisp >> (defun j-add-ts () >> (save-excursion >> (re-search-forward "#\\+END_SRC") >> (forward-line) >> (beginning-of-line) >> (when (looking-at "# Last run:") >> (kill-line)) >> (insert (concat >> "# Last run: " >> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))))) >> >> >> (add-hook 'org-babel-after-execute-hook >> 'j-add-ts) >> >> ;(remove-hook 'org-babel-after-execute-hook >> ; 'j-add-ts) >> #+END_SRC > > Perfect! I added it to my emacs.org just now and I relly like it. I modified it a bit so that I get the following time stamp before the source block. Can the fact that I use #+ cause problems? Because I like the coloring of the LASTRUN line. Additional question: if I execute the code block from a preceding e.g. #+NAME: line which belongs to the code block, the line gets obviously inserted in front of the code block before. Is there some org wizardry so that I can search the property #+LASTRUN: which belongs to the code block and replace or insert it? Or g=can I somehow jump to the beginning of the code block when I am in a preceding #+ line? Thanks, Rainer --8<---------------cut here---------------start------------->8--- #+LASTRUN: [2015-09-22 Tue 11:37:43] #+begin_src emacs-lisp (defun rmk/org-babel-add-time-stamp-after-execute-before-src-block () (save-excursion (re-search-backward "#\\+BEGIN_SRC") (forward-line -1) (beginning-of-line) (when (not (or (looking-at "[[:space:]]*$") (looking-at "#\\+LASTRUN:"))) (forward-line 1) (newline) (forward-line -1)) (when (looking-at "#\\+LASTRUN:") (kill-line)) (insert (concat "#+LASTRUN: " (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))) )) (add-hook 'org-babel-after-execute-hook 'rmk/org-babel-add-time-stamp-after-execute-before-src-block) #+end_src --8<---------------cut here---------------end--------------->8--- > > Thanks a lot, > > Rainer > >> >> >> Rainer M Krug writes: >> >>> John Kitchin <jkitchin@andrew.cmu.edu> writes: >>> >>>> Here is one approach: >>>> >>>> #+name: update-timestamp >>>> #+BEGIN_SRC emacs-lisp :var data="" >>>> (concat >>>> "Last run: " >>>> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) >>>> "\n" data) >>>> #+END_SRC >>>> >>>> >>>> #+BEGIN_SRC python :post update-timestamp(data=*this*) >>>> print('hello') >>>> #+END_SRC >>>> >>>> #+RESULTS: >>>> : Last run: [2015-09-21 Mon 11:09:18] >>>> : hello >>> >>> Thanks John - that looks nice and I like the idea of using >>> (current-time) and the possibility to format the time string, but this >>> info will be part of the export - and I only would like tho have the >>> info in the org file and not in the exported document. >>> >>> >>> Rainer >>> >>>> >>>> >>>> >>>> Rainer M Krug writes: >>>> >>>>> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >>>>> >>>>>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>>>>> >>>>>> [...] >>>>>> >>>>>>> Is it possible to set a timestamp (ur update it when it exists already) >>>>>>> when a code block has been evaluated, so that I have e record when it >>>>>>> was updated? >>>>>> >>>>>> Could you make use of the :post header argument to invoke emacs lisp and >>>>>> execute org-time-stamp-inactive in some way? >>>>> >>>>> Thanks - sounds possible? But if I just use >>>>> >>>>> ,---- >>>>> | :post (org-time-stamp-inactive) >>>>> `---- >>>>> >>>>> 1) an input is required and >>>>> 2) the time stamp is inserted before the #+begin_src and makes the block >>>>> invalid. >>>>> >>>>> How can I put the time stamp in the line after the #+end_src or possibly >>>>> even in the same line, as this does not seem to have an impact on the >>>>> source block? >>>>> >>>>> Thanks, >>>>> >>>>> Rainer >>>> >>>> -- >>>> Professor John Kitchin >>>> Doherty Hall A207F >>>> Department of Chemical Engineering >>>> Carnegie Mellon University >>>> Pittsburgh, PA 15213 >>>> 412-268-7803 >>>> @johnkitchin >>>> http://kitchingroup.cheme.cmu.edu >> >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 18:43 ` Rainer M Krug 2015-09-21 19:27 ` John Kitchin @ 2015-09-21 19:53 ` Grant Rettke 2015-09-22 7:56 ` PROPERTIES attached to results blocks - Was: " Rainer M Krug 1 sibling, 1 reply; 15+ messages in thread From: Grant Rettke @ 2015-09-21 19:53 UTC (permalink / raw) To: Rainer M Krug; +Cc: emacs-orgmode@gnu.org, John Kitchin Might be nice to have properties attached to result blocks. That is a nice idea. Grant Rettke -- gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ “Wisdom begins in wonder.” --Socrates “All creativity is an extended form of a joke.” --Kay ((λ (x) (x x)) (λ (x) (x x))) “Life has become immeasurably better since I have been forced to stop taking it seriously.” --Thompson On Mon, Sep 21, 2015 at 1:43 PM, Rainer M Krug <Rainer@krugs.de> wrote: > John Kitchin <jkitchin@andrew.cmu.edu> writes: > >> Here is one approach: >> >> #+name: update-timestamp >> #+BEGIN_SRC emacs-lisp :var data="" >> (concat >> "Last run: " >> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) >> "\n" data) >> #+END_SRC >> >> >> #+BEGIN_SRC python :post update-timestamp(data=*this*) >> print('hello') >> #+END_SRC >> >> #+RESULTS: >> : Last run: [2015-09-21 Mon 11:09:18] >> : hello > > Thanks John - that looks nice and I like the idea of using > (current-time) and the possibility to format the time string, but this > info will be part of the export - and I only would like tho have the > info in the org file and not in the exported document. > > > Rainer > >> >> >> >> Rainer M Krug writes: >> >>> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >>> >>>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>>> >>>> [...] >>>> >>>>> Is it possible to set a timestamp (ur update it when it exists already) >>>>> when a code block has been evaluated, so that I have e record when it >>>>> was updated? >>>> >>>> Could you make use of the :post header argument to invoke emacs lisp and >>>> execute org-time-stamp-inactive in some way? >>> >>> Thanks - sounds possible? But if I just use >>> >>> ,---- >>> | :post (org-time-stamp-inactive) >>> `---- >>> >>> 1) an input is required and >>> 2) the time stamp is inserted before the #+begin_src and makes the block >>> invalid. >>> >>> How can I put the time stamp in the line after the #+end_src or possibly >>> even in the same line, as this does not seem to have an impact on the >>> source block? >>> >>> Thanks, >>> >>> Rainer >> >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu > > -- > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) > > Centre of Excellence for Invasion Biology > Stellenbosch University > South Africa > > Tel : +33 - (0)9 53 10 27 44 > Cell: +33 - (0)6 85 62 59 98 > Fax : +33 - (0)9 58 10 27 44 > > Fax (D): +49 - (0)3 21 21 25 22 44 > > email: Rainer@krugs.de > > Skype: RMkrug > > PGP: 0x0F52F982 ^ permalink raw reply [flat|nested] 15+ messages in thread
* PROPERTIES attached to results blocks - Was: Set or update timestamp after evaluation of code block? 2015-09-21 19:53 ` Grant Rettke @ 2015-09-22 7:56 ` Rainer M Krug 2015-09-22 15:52 ` Charles C. Berry 0 siblings, 1 reply; 15+ messages in thread From: Rainer M Krug @ 2015-09-22 7:56 UTC (permalink / raw) To: Grant Rettke; +Cc: emacs-orgmode@gnu.org, John Kitchin [-- Attachment #1: Type: text/plain, Size: 3708 bytes --] Grant Rettke <gcr@wisdomandwonder.com> writes: > Might be nice to have properties attached to result blocks. That is a nice idea. True. These could be used for in the long run many purposes, like formating for export. If the formating would be defined in the properties of the result block, it would make it easy to have different formating for export when using multiple result blocks. Rainer > Grant Rettke > -- > gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ > “Wisdom begins in wonder.” --Socrates > “All creativity is an extended form of a joke.” --Kay > ((λ (x) (x x)) (λ (x) (x x))) > “Life has become immeasurably better since I have been forced to stop > taking it seriously.” --Thompson > > > On Mon, Sep 21, 2015 at 1:43 PM, Rainer M Krug <Rainer@krugs.de> wrote: >> John Kitchin <jkitchin@andrew.cmu.edu> writes: >> >>> Here is one approach: >>> >>> #+name: update-timestamp >>> #+BEGIN_SRC emacs-lisp :var data="" >>> (concat >>> "Last run: " >>> (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)) >>> "\n" data) >>> #+END_SRC >>> >>> >>> #+BEGIN_SRC python :post update-timestamp(data=*this*) >>> print('hello') >>> #+END_SRC >>> >>> #+RESULTS: >>> : Last run: [2015-09-21 Mon 11:09:18] >>> : hello >> >> Thanks John - that looks nice and I like the idea of using >> (current-time) and the possibility to format the time string, but this >> info will be part of the export - and I only would like tho have the >> info in the org file and not in the exported document. >> >> >> Rainer >> >>> >>> >>> >>> Rainer M Krug writes: >>> >>>> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >>>> >>>>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>>>> >>>>> [...] >>>>> >>>>>> Is it possible to set a timestamp (ur update it when it exists already) >>>>>> when a code block has been evaluated, so that I have e record when it >>>>>> was updated? >>>>> >>>>> Could you make use of the :post header argument to invoke emacs lisp and >>>>> execute org-time-stamp-inactive in some way? >>>> >>>> Thanks - sounds possible? But if I just use >>>> >>>> ,---- >>>> | :post (org-time-stamp-inactive) >>>> `---- >>>> >>>> 1) an input is required and >>>> 2) the time stamp is inserted before the #+begin_src and makes the block >>>> invalid. >>>> >>>> How can I put the time stamp in the line after the #+end_src or possibly >>>> even in the same line, as this does not seem to have an impact on the >>>> source block? >>>> >>>> Thanks, >>>> >>>> Rainer >>> >>> -- >>> Professor John Kitchin >>> Doherty Hall A207F >>> Department of Chemical Engineering >>> Carnegie Mellon University >>> Pittsburgh, PA 15213 >>> 412-268-7803 >>> @johnkitchin >>> http://kitchingroup.cheme.cmu.edu >> >> -- >> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) >> >> Centre of Excellence for Invasion Biology >> Stellenbosch University >> South Africa >> >> Tel : +33 - (0)9 53 10 27 44 >> Cell: +33 - (0)6 85 62 59 98 >> Fax : +33 - (0)9 58 10 27 44 >> >> Fax (D): +49 - (0)3 21 21 25 22 44 >> >> email: Rainer@krugs.de >> >> Skype: RMkrug >> >> PGP: 0x0F52F982 -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: PROPERTIES attached to results blocks - Was: Set or update timestamp after evaluation of code block? 2015-09-22 7:56 ` PROPERTIES attached to results blocks - Was: " Rainer M Krug @ 2015-09-22 15:52 ` Charles C. Berry 0 siblings, 0 replies; 15+ messages in thread From: Charles C. Berry @ 2015-09-22 15:52 UTC (permalink / raw) To: Rainer M Krug; +Cc: John Kitchin, emacs-orgmode@gnu.org, Grant Rettke On Tue, 22 Sep 2015, Rainer M Krug wrote: > Grant Rettke <gcr@wisdomandwonder.com> writes: > >> Might be nice to have properties attached to result blocks. That is a nice idea. > > True. These could be used for in the long run many > purposes, like formating for export. If the formating would be defined > in the properties of the result block, it would make it easy to have > different formating for export when using multiple result blocks. > This is available through babel as in the `latex' language src blocks. Add a new babel language - `results', says. Use :wrap or :post to setup the `results' src block: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC emacs-lisp :wrap "src results :properties abc" 1 #+END_SRC #+RESULTS: #+BEGIN_src results :properties abc 1 #+END_src --8<---------------cut here---------------end--------------->8--- ... then define a babel language 'results' along the line of ob-latex.el with suitable `org-babel-header-args:results' and you are there. HTH, Chuck ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 13:42 ` Rainer M Krug 2015-09-21 14:09 ` Eric S Fraga 2015-09-21 15:10 ` John Kitchin @ 2015-09-21 15:37 ` Jorge A. Alfaro-Murillo 2015-09-21 18:37 ` Rainer M Krug 2 siblings, 1 reply; 15+ messages in thread From: Jorge A. Alfaro-Murillo @ 2015-09-21 15:37 UTC (permalink / raw) To: emacs-orgmode Rainer M Krug writes: > Eric S Fraga <e.fraga@ucl.ac.uk> writes: > >> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >> >> [...] >> >>> Is it possible to set a timestamp (ur update it when it exists >>> already) when a code block has been evaluated, so that I have >>> e record when it was updated? >> >> Could you make use of the :post header argument to invoke emacs >> lisp and execute org-time-stamp-inactive in some way? > > Thanks - sounds possible? But if I just use > > ,---- | :post (org-time-stamp-inactive) `---- > > 1) an input is required and 2) the time stamp is inserted before > the #+begin_src and makes the block invalid. > > How can I put the time stamp in the line after the #+end_src or > possibly even in the same line, as this does not seem to have an > impact on the source block? You could use the :epilogue header argument. Since you want after the #+end_src this is rather hackish: :epilogue (save-excursion (re-search-forward "END_SRC" nil nil 2) (org-insert-time-stamp (current-time) t t "\nEvaluated: " "\n")) It does not update the results, but it will show you all the results and when they were evaluated. If you want to keep only one set of results and do not mind having the timestamp before the #+BEGIN_SRC, you could use something like: :epilogue (save-excursion (if (re-search-backward "Last evaluated: " nil t) (kill-line 1)) (org-insert-time-stamp (current-time) t t "Last evaluated: " "\n")) Best, -- Jorge. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Set or update timestamp after evaluation of code block? 2015-09-21 15:37 ` Jorge A. Alfaro-Murillo @ 2015-09-21 18:37 ` Rainer M Krug 0 siblings, 0 replies; 15+ messages in thread From: Rainer M Krug @ 2015-09-21 18:37 UTC (permalink / raw) To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2209 bytes --] jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) writes: > Rainer M Krug writes: > >> Eric S Fraga <e.fraga@ucl.ac.uk> writes: >> >>> On Monday, 21 Sep 2015 at 14:46, Rainer M Krug wrote: >>> >>> [...] >>> >>>> Is it possible to set a timestamp (ur update it when it exists >>>> already) when a code block has been evaluated, so that I have e >>>> record when it was updated? >>> >>> Could you make use of the :post header argument to invoke emacs >>> lisp and execute org-time-stamp-inactive in some way? >> >> Thanks - sounds possible? But if I just use >> >> ,---- | :post (org-time-stamp-inactive) `---- >> >> 1) an input is required and 2) the time stamp is inserted before the >> #+begin_src and makes the block invalid. >> >> How can I put the time stamp in the line after the #+end_src or >> possibly even in the same line, as this does not seem to have an >> impact on the source block? > > You could use the :epilogue header argument. Since you want after the > #+end_src this is rather hackish: > > :epilogue (save-excursion (re-search-forward "END_SRC" nil nil 2) > (org-insert-time-stamp (current-time) t t "\nEvaluated: " "\n")) > > It does not update the results, but it will show you all the results > and when they were evaluated. > > If you want to keep only one set of results and do not mind having the > timestamp before the #+BEGIN_SRC, you could use something like: > > :epilogue (save-excursion (if (re-search-backward "Last evaluated: " > nil t) (kill-line 1)) (org-insert-time-stamp (current-time) t t "Last > evaluated: " "\n")) The :epilogue won't work, as the source code block is in R and the epilogue is appended to the code. But I will look at the elisp code Thanks, Rainer > > Best, -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 454 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-09-22 15:52 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-21 12:46 Set or update timestamp after evaluation of code block? Rainer M Krug 2015-09-21 13:17 ` Eric S Fraga 2015-09-21 13:42 ` Rainer M Krug 2015-09-21 14:09 ` Eric S Fraga 2015-09-21 15:15 ` Rainer M Krug 2015-09-21 15:10 ` John Kitchin 2015-09-21 18:43 ` Rainer M Krug 2015-09-21 19:27 ` John Kitchin 2015-09-22 7:52 ` Rainer M Krug 2015-09-22 9:45 ` Rainer M Krug 2015-09-21 19:53 ` Grant Rettke 2015-09-22 7:56 ` PROPERTIES attached to results blocks - Was: " Rainer M Krug 2015-09-22 15:52 ` Charles C. Berry 2015-09-21 15:37 ` Jorge A. Alfaro-Murillo 2015-09-21 18:37 ` Rainer M Krug
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.