[ESS] setting transcript file name

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Tue Aug 2 10:50:29 CEST 2005


 > Is it possible to set transcript file name to a predefined one, when
 > starting ESS? If you set ess-ask-about-transfile to t, it will ask the
 > filename, but it is a hassle to enter it everytime. I for example
 > want, that every R session I start with ESS would be recorded in a
 > transcript file with name
 > "name-of-directory-R-was-started-in--current-date.St". The bash
 > equivalent of name would be
 > 
 > $(echo "`pwd`" | sed "s/\/.*\///")-`date +%y-%m-%d`.St
 > 
 > How to translate that to lisp? I have none lisp experience, but if
 > someone would give an example of similar script, I would be very
 > grateful.

Currently, ESS does not have that behaviour.  The relevant function is 
inferior-ess which has:

	(if ess-ask-about-transfile
	    (let ((transfilename (read-file-name
				  "Use transcript file (default none):"
				  startdir "")))

One possibility is that we could overload ess-ask-about-transfile
so that if it is bound to a function, that function is executed to
return the default transcript name.  Then you could have a simple
function like:

(defun my-transcript-name ()
  (let ((date (format-time-string "%y-%m-%d" (current-time)))
	(directory (car
		    (last (split-string default-directory "/" 'omit-null)))))
	(concat date "-" directory ".Rt")))

when then returns something like

(my-transcript-name) 
"05-08-02-Code.Rt"

But as you can see, this requires a little knowledge of lisp to
write the defun to return the transcript name.

Ess-core: does this sound like worth adding (& is there an easier
way to get the name of the current directory?)

Stephen




More information about the ESS-help mailing list