Eric Schulte <schulte.e...@gmail.com> writes: > Rainer M Krug <rai...@krugs.de> writes: > >> OK - narrowed it down to a post tangle hook which I need for proper >> debugging of R (jumping to source line in org file and not tangled R file): >> >> ,---- >> | #+begin_src emacs-lisp >> | (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) >> | #+end_src >> `---- >> >> The question is now why is this function org-babel-mark-file-as-tangled >> receives NULL as a buffer-file-name? > > I'm not sure, but perhaps you could wrap the body of buffer-file-name in > a (when (buffer-file-name) ...) form to protect against null files.
Sounds reasonable and I'll put it in to have properly tangled files when this happens - but then the file-local-variables would not be added if the file name is null. Is there any way that I could find out why this is happening (or under which conditions)? Thanks, Rainer > > Hope this helps, > >> >> I can't remove the "when" as I am also tangling some files which do >> not have any comment characters (DESCRIPTION file in R packages). >> >> Any suggestions welcome, >> >> Rainer >> >> >> Rainer M Krug <rai...@krugs.de> writes: >> >>> Forgot: tried with 8.2 stable release and with version from git - both >>> the same. >>> >>> Rainer M Krug <rai...@krugs.de> writes: >>> >>>> Hi >>>> >>>> I have a strange error when tangling. [snip: Now irrlevant stuff (156 lines)] -- Rainer M. Krug email: RMKrug<at>gmail<dot>com