Let me start by saying this is very bad, and the circumstantial
evidence looks pretty strong. I'm very sorry about the whole mess.
But I don't see how it could happen, so ... a few questions.
>>>> "Alex" == Alex Schroeder
<kensanata(a)yahoo.com> writes:
Alex> I installed XEmacs 21.4.6 today. I was asked wether I
Alex> wanted to migrate .emacs to .xemacs or something.
What was the previous version of XEmacs? If it was anything later
than 21.2.35, then you should have been asked about migration before,
and your custom-file should have already contained code to inhibit the
query.
When was the last time you ran XEmacs before installing
21.4.6?
Any idea when the last time you saved customizations for XEmacs was
(looks like Jan 23)?
Is there any code that changes custom-file to ~/.emacs that might have
gotten triggered somehow after custom-file was changed to ~/.xemacs?
Alex> I answered no, because my .emacs is carefully crafted to
Alex> work on BOTH platforms. Something was saved in my .emacs.
As you guess, that should have been a customization to prevent future
queries. If your XEmacs customizations were already null, Custom
would throw away all customizations in that file. However, XEmacs
should not be saving to that file under the conditions you describe.
Alex> Strange. I checked the beginning and the end of the file,
Alex> but found nothing.
You mean as far as you could tell the file was the same as ever? Not
that it was empty, right? And I take it there are never customizations
in that file because you've been in the habit of saving them in
~/.xemacs? Otherwise wouldn't you miss them because customize
normally saves them at the end AFAIK? Oops, no, if you had them in
the middle they'd get saved there forever, it seems.
Alex> This is what I find:
Alex> ...
Alex> ;; Customization code. These entries are usually generated automatically
Alex> (custom-set-variables '(load-home-init-file t t))
I don't understand this being in .emacs, unless custom-file somehow
got changed back to "~/.emacs". The migration code is executed after
loading the init file, and the way it is saved is bog-standard custom:
(customize-save-variable 'load-home-init-file t)
So at that point custom-file should already be "~/.xemacs", and that
code should be saved there.
Since customize-save-variable works by doing a customize-save-all,
this suggests that your XEmacs customizations were already empty, and
that Custom just did what it always does: remove all existing
customizations in the file, and then add the customizations known to
the running emacs.
Alex> ;; When using XEmacs, save customizations in another file!
Alex> ;; When using Emacs 21, save customizations in another file!
Is this your comment? XEmacs 21.4.6 does not add such comments.
Alex> (when (featurep 'xemacs)
Alex> (setq custom-file "~/.xemacs")
Alex> (load "~/.xemacs"))
Is this your code? XEmacs 21.4.6 does not add such code.
NB. Although it shouldn't be a problem, that code will result in the
customizations being loaded twice, as XEmacs automatically loads
custom-file immediately on completion of loading the init file.
Alex> About 3.5k of customizations are now lost. My oldest backup
Alex> is several months old.
3.5k of customizations from what file?
Were they in ~/.emacs? If not, I can't see why XEmacs would have
touched them. The migration procedure starts by loading the init file
and whatever custom-file is, init file first. Assuming the (setq
custom-file "~/.xemacs") is your code, what should happen here is
something like
(1) xemacs starts, and does some initializations, including looking
for packages and stuff
(2) it processes the command line (I'm following the structure of the
code here, not what you might think is the obvious way to
interpret "command line")
(2a) it processes args including those that inhibit init files;
assume init file loading is enabled.
(2b) xemacs looks for your init file in the usual places, and finds
~/.emacs.
(2c) It loads .emacs, and in the process changes the value of
custom-file to "~/.xemacs", and loads it per the code in .emacs.
(2d) It now loads custom-file again.
(3) it asks about some optional stuff, in particular init file
migration. If you say no, it inhibits the question as above by
adding the load-home-init-file thingie.
If they _were_ in .emacs, it's possible. But as described above, this
should remove all customizations only if _both_ (1) ~/.xemacs is
already null and (2) custom-file is somehow set to "~/.emacs". XEmacs
has no code that would do (2) that I can find.
I also find this rather curious:
Alex> ~$ ll .xemacs*
Alex> -rw-r--r-- 1 alex alex 0 Jan 23 22:44 .xemacs
Alex> -rw-r--r-- 1 alex alex 0 Jan 23 22:43 .xemacs-custom
If XEmacs did this yesterday, why do the file times go back to Jan 23?
What is .xemacs-custom?
Once again, I don't want to "blame the victim." This could very well
be an XEmacs bug somehow, but I don't see it in the migration code
yet. It looks to me like a bug in Custom itself, actually, that if
somehow you manage to not get your customizations loaded, and then do
custom-save-all, your customizations will all go away. Emacs 21 would
do the same thing AFAICT.
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Don't ask how you can "do" free software business;
ask what your business can "do for" free software.