From mboxrd@z Thu Jan 1 00:00:00 1970 From: Austin Frank Subject: [babel] re-hash cached blocks on each execution? or, force re-hash? Date: Mon, 12 Jul 2010 10:17:46 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2144740672==" Return-path: Received: from [140.186.70.92] (port=34281 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYKln-0005AN-D1 for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 11:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYKlk-00013I-0O for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 11:18:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:35129) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYKlj-00012v-N4 for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 11:18:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OYKlh-0000VL-Mo for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 17:18:05 +0200 Received: from adsl-209-30-144-201.dsl.stlsmo.swbell.net ([209.30.144.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Jul 2010 17:18:05 +0200 Received: from austin.frank by adsl-209-30-144-201.dsl.stlsmo.swbell.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Jul 2010 17:18:05 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============2144740672== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable Hello! I would find it extremely useful if the org-babel-execute-* family of commands re-hashed the executed blocks on each execution, or, alternatively, accepted a prefix argument that meant "re-execute this block even if cached, and replace the cache-hash if necessary". Currently, if a block is cached, when I change something inside the block and then execute the block again, the hash in the #+results line doesn't change. In cases where the contents of the block change but the output of the block does not, this makes it very difficult to tell whether the block has been re-executed or not. If there are good reasons not to re-hash the block on each execution and update the hash in the results line, I would like to be able to force this behavior. In cases where I know that I want the block to be re-hashed and re-executed, it seems like C-u C-c C-c or C-u C-u C-c C-c would be a natural and org-ish way to force this. Here's a simple test case: =2D-8<---------------cut here---------------start------------->8--- * elisp example #+source: elisp-test #+BEGIN_SRC emacs-lisp :cache yes (print "hello world") (print "re-hash and re-execute, please!") #+END_SRC #+results[f6dfc164b16889f1569fcd3242ba3de721853bc8]: elisp-test : hello world Now I change the above block in place (but reproduce the changes sequentially here): #+source: elisp-test #+BEGIN_SRC emacs-lisp :cache yes (print "hello world") (print "re-hash and re-execute, please!") #+END_SRC #+results[f6dfc164b16889f1569fcd3242ba3de721853bc8]: elisp-test : re-hash and re-execute, please! Note that the block changed, and the results changed, but the hash did not. Now we change it again, in a way that doesn't change the output: #+source: elisp-test #+BEGIN_SRC emacs-lisp :cache yes (setq four (+ 2 2)) (print "hello world") (print "re-hash and re-execute, please!") #+END_SRC #+results[f6dfc164b16889f1569fcd3242ba3de721853bc8]: elisp-test : re-hash and re-execute, please! Again the block changed, but this time the results did not change and neither did the hash. This makes it very hard to tell whether the code has been re-executed or not. If the hash changed when the block changed, I could tell that the new code had been detected and run. Finally, we check whether the previous change was actually evaluated: * elisp test #+source: elisp-test #+BEGIN_SRC emacs-lisp :cache yes (setq four (+ 2 2)) (print "hello world") (print "re-hash and re-execute, please!") (print four) #+END_SRC #+results[f6dfc164b16889f1569fcd3242ba3de721853bc8]: elisp-test : 4 So the block is re-evaluated when it's changed, but the hash isn't updated. The only way we can tell if an altered block is re-run is if the output changes, but that won't necessarily be the case for every change in a block. It would be very useful if the block were re-hashed before each execution, and the cache line updated whenever the hash changes. One possible solution is to force re-hashing and re-execution with a prefix argument (or double prefix argument, if preferred). =2D-8<---------------cut here---------------end--------------->8--- Thanks, /au =2D-=20 Austin Frank http://aufrank.net GPG Public Key (D7398C2F): http://aufrank.net/personal.asc --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkw7MhoACgkQlHMl2/XbR4EJ4ACgzWc0yfACIVhGCXVFfJ/TCtk9 EjIAoO+/5OhbCh2Vq5ciWHdVzxdYbJ7K =xwP/ -----END PGP SIGNATURE----- --=-=-=-- --===============2144740672== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============2144740672==--