[ESS-bugs] Re: Setting dump file name
Martin Maechler
maechler at stat.math.ethz.ch
Thu Sep 25 12:45:29 CEST 2003
>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Thu, 25 Sep 2003 11:55:49 +0200 writes:
>>>>> "MatW" == Wiener, Matthew <matthew_wiener at merck.com>
>>>>> on Wed, 24 Sep 2003 20:42:20 -0400 writes:
MatW> Hi, all. I am trying to remove my user name from the
MatW> beginning of my dump files. I save them in
MatW> project-specific directories that no-one else is
MatW> using, so there's no risk of confusion, and it will
MatW> help in putting them into a version control system so
MatW> other people can in fact work on them.
MatW> I have tried putting the following into my .emacs
MatW> file: (setq ess-dump-filename-template "%s.S")
MM> Nowadays, the recommended via is using "Customize Emacs"
MM> (from the [Options] menu,
MM> either or directly by middle-mouse clicking on the
MM> underlined word "customize" in the help page you get after
MM> C-h v ess-dump-filename-template
MM> )
MM> which automagically produces something like
MM> (custom-set-variables
MM> ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
MM> ;; Your init file should contain only one such instance.
MM> '(ess-dump-filename-template "%s.R")
MM> )
MM> in your ~/.emacs
MatW> But it doesn't seem to help.
MM> nor does the modern "customize" way.
MatW> Changing, for example, the dump directory in the same
MatW> .emacs file does change the directory to which files
MatW> are dumped.
MM> (yes, I know, since I've been doing that since ever ..)
MatW> Any ideas?
MM> It's a bug {---> hence CC: to "ESS-bugs"} :
MM> After adding the above, restarting Emacs,
MM> M-x R
MM> C-c C-d pi
MM> then C-h v ess-dump-filename-template
MM> gives a *Help* buffer
MM> ---------------------------------------------------------------
MM> ess-dump-filename-template's value is "%s.S"
MM> Local in buffer maechler.pi.R; global value is "maechler.%s.R"
MM> ...
MM> ...
MM> ---------------------------------------------------------------
MM> Which shows that the variable's setting is not used everywhere
MM> it should. Grepping in ess/lisp/*.el quickly reveals that
MM> all the essd-*.el files
MM> explicitly construct ess-dump-filename-template by prepending
MM> (user-login-name) ....
MM> and post-pending the correct ending, namely ess-suffix: .R or
MM> .S or ....
MM> Ok, I'm working on fixing this. I think a nice solution looks
MM> possible.
MM> As a workaround, do edit the ess/lisp/essd-<dialect>.el file
MM> e.g., for R, it's ess/lisp/essd-r.el file.
One bug fix is to do the following replacement
e.g. in (defvar R-customize-alist ...)
~~~~~~~~~~~~~~~~
in essd-r.el :
--- essd-r.el 8 Aug 2003 14:41:49 -0000 5.44
+++ essd-r.el 25 Sep 2003 10:20:34 -0000
@@ -52,9 +52,9 @@
(ess-dialect . "R")
(ess-suffix . "R")
(ess-loop-timeout . 500000 )
- (ess-dump-filename-template . (concat (user-login-name)
- ".%s."
- ess-suffix))
+ (ess-dump-filename-template . (replace-regexp-in-string
+ "S$" ess-suffix ; in the one from custom:
+ ess-dump-filename-template))
(ess-mode-editing-alist . S-editing-alist)
(ess-mode-syntax-table . S-syntax-table)
(ess-help-sec-regex . ess-help-R-sec-regex)
----------------------------------
and do this in all (about a dozen) essd-*.el files.
But I think it's conceptually wrong: If
ess-dump-filename-template
is set via customize and initialized in ess-cust.el,
the above "substitution" should be compulsory and not part of
the {old-style, pre-custom !} R-customize-alist.
I propose to move the equivalent of the code
(ess-dump-filename-template . (replace-regexp-in-string
"S$" ess-suffix ; in the one from custom:
ess-dump-filename-template))
directly into the (inferior-ess ..) function {in ess-inf.el}
just after the
(ess-setq-vars-local ess-customize-alist buf)
statement
{and make sure ess-dump-filename-template does become a local variable!}.
Actually I think, the variable to be customized should be
(defcustom ess-dump-fname-proto-template (concat (user-login-name) ".%s.S")
"*Prototype template for filenames of dumped objects.
The ending `S' is replaced by the current \\[ess-suffix], to give
\\[ess-dump-filename-template] when an inferior ESS process starts."
:group 'ess-edit
:type 'string)
And the ess-dump-filename-template variable used by C-c C-d
should be a function of
ess-dump-fname-proto-template and ess-suffix
and should *not* be customized itself
which poses the question where to (defvar ..) it;
ess-vars.el now being completely empty...
Comments? Different proposals?
More information about the ESS-bugs
mailing list