User manual
Chapter 7: Editing objects and functions 42
7.7 Names and locations of dump files
Every dump file should be given a unique file name, usually the dumped object name with
some additions.
[User Option]ess-dump-filename-template
Template for filenames of dumped objects. %s is replaced by the object name.
By default, dump file names are the user name, followed by ‘.’ and the object and end-
ing with ‘.S’. Thus if user joe dumps the object myfun the dump file will have name
‘joe.myfun.S’. The username part is included to avoid clashes when dumping into a
publicly-writable directory, such as ‘/tmp’; you may wish to remove this part if you are
dumping into a directory owned by you.
You may also specify the directory in which dump files are written:
[User Option]ess-source-directory
Directory name (ending in a slash) where S dump files are to be written.
By default, dump files are always written to ‘/tmp’, which is fine when ess-keep-dump-
files is nil. If you are keeping dump files, then you will probably want to keep them
somewhere in your home directory, say ‘~/S-source’. This could be achieved by including
the following line in your ‘.emacs’ file:
(setq ess-source-directory (expand-file-name "~/S-source/"))
If you would prefer to keep your dump files in separate directories depending on the value
of some variable, ESS provides a facility for this also. By setting ess-source-directory to
a lambda expression which evaluates to a directory name, you have a great deal of flexibility
in selecting the directory for a particular source file to appear in. The lambda expression is
evaluated with the process buffer as the current buffer and so you can use the variables local
to that buffer to make your choice. For example, the following expression causes source files
to be saved in the subdirectory ‘Src’ of the directory the ESS process was run in.
(setq ess-source-directory
(lambda ()
(concat ess-directory "Src/")))
(ess-directory is a buffer-local variable in process buffers which records the directory the
ESS process was run from.) This is useful if you keep your dump files and you often edit
objects with the same name in different ESS processes. Alternatively, if you often change
your S working directory during an S session, you may like to keep dump files in some
subdirectory of the directory pointed to by the first element of the current search list. This
way you can edit objects of the same name in different directories during the one S session:
(setq ess-source-directory
(lambda ()
(file-name-as-directory
(expand-file-name (concat
(car ess-search-list)
"/.Src")))))










