[ESS] Open .R files from backtrace as read-only?

Andreas Leha andreas.leha at med.uni-goettingen.de
Wed Jun 5 11:06:57 CEST 2013


Vitalie Spinu <spinuvit at gmail.com> writes:

>  >> Rainer M Krug <Rainer at krugs.de>
>  >> on Mon, 03 Jun 2013 13:53:00 +0200 wrote:
>
>  > Hi
>  > I am using org-mode for programming, therefore editing my .R files
>  > directly is futile, as the edits will be overwritten by the next
>  > tangle. Nevertheless, it happens to me from time to time, mainly when I
>  > am debugging and open the .R file from the ess-traceback buffer.
>
>  > Would it be possible, to have an option to open the .R file from the
>  > ess-tracebak buffer as read-only?
>
> And how to distinguish which files you want read only and which you
> don't. This doesn't look to me like a very useful features. 
>
> Would it be feasible to redirect source references to original org file?
>
> Something of that kind now works with org's C-c '. If you evaluated
> functions in org edit buffer. You will be redirected to original org
> file on errors or debug. It doesn't work with org's C-c C-c as yet, but
> I am looking into it.
>
>  > Or is there another way of achieving this?
>
> There is visit-file-hook. You can add to it a simple function that
> checks for a file name and marks buffer read only.
>

You could have a local file variable setting this.  Put that at the end
of your .R (or have it tangled there).  Might do what you want.

--8<---------------cut here---------------start------------->8---
Local variables:
buffer-read-only: t
End:
--8<---------------cut here---------------end--------------->8---

Regards,
Andreas



More information about the ESS-help mailing list