Eric Schulte <schulte.e...@gmail.com> writes:

[snip (41 lines)]

>>> He added the following to his config file to test the approach:
>>> 
>>> ,----
>>> |  (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)
>>> |    
>>> |    (defun org-babel-mark-file-as-tangled ()
>>> |      (add-file-local-variable 'org-babel-tangled-file t)
>>> |      (basic-save-buffer))
>>> | 
>>> |    (add-hook 'org-babel-post-tangle-hook 'org-babel-mark-file-as-tangled)
>>> `----
>>> 

[snip (5 lines)]


I tried the above approach, but I was struggling with setting up the
rules in the function definition which files should get the local
variables and which not.

I ended up with the following:

,----
| (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)
| 
| (defun org-babel-mark-file-as-tangled ()
|   
|   (when  (string-match "[.]R" (buffer-file-name))
|       (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)))
| 
| (add-hook 'org-babel-post-tangle-hook 'org-babel-mark-file-as-tangled)
`----

Thanks everybody for their help,

Rainer



>

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

Attachment: pgpueI_WtlIe2.pgp
Description: PGP signature

Reply via email to