From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Automatically adding local variables to tangled file Date: Fri, 07 Jun 2013 10:32:19 +0200 Message-ID: <87wqq6uxrg.fsf@krugs.de> References: <878v2omz5g.fsf@krugs.de> <51af4bfd.0c95ec0a.2372.097e@mx.google.com> <87ehcf6xey.fsf@gmail.com> <87ehcewdye.fsf@krugs.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uks6E-0002yt-EG for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 04:32:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uks6A-0004om-8d for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 04:32:42 -0400 Received: from plane.gmane.org ([80.91.229.3]:52600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uks6A-0004oe-2l for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 04:32:38 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uks67-0008FP-70 for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 10:32:35 +0200 Received: from arn78-1-88-186-171-7.fbx.proxad.net ([88.186.171.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Jun 2013 10:32:35 +0200 Received: from Rainer by arn78-1-88-186-171-7.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Jun 2013 10:32:35 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Rainer M Krug writes: [snip (54 lines)] >>>> ,---- >>>> | (defvar org-babel-tangled-file nil >>>> | "If non-nill, current file was tangled with org-babel-tangle") >>>> | (put 'org-babel-tangled-file 'safe-local-variable 'booleanp) >>>> |=20=20=20=20 >>>> | (defun org-babel-mark-file-as-tangled () >>>> | (add-file-local-variable 'org-babel-tangled-file t) >>>> | (basic-save-buffer)) >>>> |=20 >>>> | (add-hook 'org-babel-post-tangle-hook 'org-babel-mark-file-as-tan= gled) >>>> `---- >>>>=20 >> >> I think the above code should be considered an implementation rather >> than simply a test. This is exactly what the post-tangle hook is >> intended to support. Is there a motivating reason for this behavior to >> be "built in"? > > As pointed out, I think the possibility to easily add local variables to > the tangled file, will be valuable. I would opt for an the buil-in > option, as this could e.g. be used to set the file read-only in emacs, > adding svn information, etc. > > This could be achieved by supplying one variable containing strings, > which contains the names of the local variables to be added and their val= ues. > > For the time being, I will add the suggested code to my emacs.org. I stumbled upon one problem, though: I want to mame the tengled file, when nopened in emacs, to have the minor mode auto-revert-mode. So I did the following, which obviously did not work: ,---- | (defvar org-babel-tangled-file nil | "If non-nill, current file was tangled with org-babel-tangle") | (put 'org-babel-tangled-file 'safe-local-variable 'booleanp) |=20=20=20=20=20 | (defun org-babel-mark-file-as-tangled () | (add-file-local-variable 'org-babel-tangled-file t) | (add-file-local-variable 'buffer-read-only t) | (add-file-local-variable 'eval: (auto-revert-mode)) | (basic-save-buffer)) |=20=20=20 | (add-hook 'org-babel-post-tangle-hook 'org-babel-mark-file-as-tangled) `---- So is tere a way, of adding the line=20 ,---- | eval: (auto-revert-mode) `---- to the file local variables, so that emacs sutomatically enables auto-revert-mode? Thanks, Rainer > >> > [snip (38 lines)] =2D-=20 Rainer M. Krug email: RMKruggmailcom --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRsZqVAAoJENvXNx4PUvmCnyoH/2NNxTGFPV5eAyl3jLJZs+Ny BrJtrt1zQHYGx4LaRKdV5Ncn9k3OH8E56wT+YJXxl5XY8PFyoqi8a6YBZxyJZ/z0 Dk8KXGdgrBigJIozFh4UGj10+iTSRZRtl6m0Ft4Lnppl/I7YhO9kprWOMDU3F4TM 36Zkpvkpr4TndP1MOHjuOoVSaEhz/jmxvXNQ7SwO4RfhY1N+d3WzCKeywGzZcwbn BKDvrX0MeBzXRUu33hEctHtQG+FcbUsnBw0vO5kUExuDZdbnK8KJU1otJZJ6hgT+ +15bSHPlQzHtER5rMssdh3LEKQlLm916YJug0x5oN7kEQaDPzdH9q8z+A0beLLc= =AJjX -----END PGP SIGNATURE----- --=-=-=--