[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] SOLVED: Automatically adding local variables to tangled file
From: |
Rainer M Krug |
Subject: |
[O] SOLVED: Automatically adding local variables to tangled file |
Date: |
Mon, 10 Jun 2013 13:32:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eric Schulte <address@hidden> 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
pgpxKsNqlBMkq.pgp
Description: PGP signature
- Re: [O] Automatically adding local variables to tangled file, (continued)
- Re: [O] Automatically adding local variables to tangled file, Eric Schulte, 2013/06/08
- Re: [O] Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/10
- [O] Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file, Rainer M Krug, 2013/06/10
- Re: [O] Problem in tangle-mode -- WAS: Automatically adding local variables to tangled file, Eric Schulte, 2013/06/10
- [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Eric Schulte, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/11
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/12
- Re: [O] BUG - Problem in tangle-mode, Eric Schulte, 2013/06/12
- Re: [O] BUG - Problem in tangle-mode, Rainer M Krug, 2013/06/13
- [O] SOLVED: Automatically adding local variables to tangled file,
Rainer M Krug <=
Re: [O] Automatically adding local variables to tangled file, Thorsten Jolitz, 2013/06/05