emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: emacs-orgmode@gnu.org
Subject: Re: [BABEL] BUG - error on tangling - disappears when changing the filename
Date: Mon, 30 Sep 2013 09:30:40 +0200	[thread overview]
Message-ID: <m2li2ekbq7.fsf@krugs.de> (raw)
In-Reply-To: 877ge1w22e.fsf@gmail.com

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

> Rainer M Krug <Rainer@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 <Rainer@krugs.de> writes:
>>
>>> Forgot: tried with 8.2 stable release and with version from git - both
>>> the same.
>>>
>>> Rainer M Krug <Rainer@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

  reply	other threads:[~2013-09-30  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 12:23 [BABEL] BUG - error on tangling - disappears when changing the filename Rainer M Krug
2013-09-27 13:30 ` Rainer M Krug
2013-09-27 13:44   ` Rainer M Krug
2013-09-28 12:22     ` Eric Schulte
2013-09-30  7:30       ` Rainer M Krug [this message]
2013-10-01  0:10         ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2li2ekbq7.fsf@krugs.de \
    --to=rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).