Ralf Angeli <angeli(a)iwi.uni-sb.de> writes:
When starting XEmacs without a .xemacs directory, but with a .emacs
file being present, it asks if the .emacs file should be migrated to
.xemacs/init.el. If you answer "no" to this question, it will change
and delete a lot of customizations in the .emacs file.
I know things take a long time out here, but here's finally a fix for
this. Migration will now create a backup file of your .emacs if
possible. (Leaving the old .emacs in place doesn't really
work---migration either wants to replace it or know that it's been
moved.) Will apply Saturday if nobody objects.
2007-08-09 Mike Sperber <mike(a)xemacs.org>
* startup.el (migrate-user-init-file): Create backup of
`user-init-file' before migrating.
* startup.el (maybe-migrate-user-init-file): Print
information about backup file.
(maybe-create-compatibility-dot-emacs): Follow above change.
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/startup.el,v
retrieving revision 1.59
diff -u -r1.59 startup.el
--- lisp/startup.el 2 Aug 2007 06:37:53 -0000 1.59
+++ lisp/startup.el 9 Aug 2007 12:54:05 -0000
＠＠ -880,43 +880,56 ＠＠
(yes-or-no-p-minibuf (concat "Migrate init file to "
- (customize-save-variable 'load-home-init-file t))))
-(defun maybe-create-compatibility-dot-emacs ()
- "Ask user if she wants to create a .emacs compatibility file."
- (if (with-output-to-temp-buffer (help-buffer-name nil)
- (princ "The initialization code has now been migrated to the ")
- (princ user-init-directory)
- (princ "directory.
+ (let ((backup (migrate-user-init-file)))
+ (with-output-to-temp-buffer (help-buffer-name nil)
+ (princ "The initialization code has now been migrated to the ")
+ (princ user-init-directory)
+ (princ "directory.
For backwards compatibility with, for example, older versions of XEmacs,
XEmacs can create a special old-style .emacs file in your home
directory which will load the relocated initialization code.")
- (show-temp-buffer-in-current-frame standard-output)
- (yes-or-no-p-minibuf "Create compatibility .emacs? ")))
+ (if backup
+ (princ "\nMoreover, a backup of your old .emacs file was created as\n")
+ (princ backup)
+ (princ ".\n")))
+ (show-temp-buffer-in-current-frame standard-output)
+ (customize-save-variable 'load-home-init-file t))))
+(defun maybe-create-compatibility-dot-emacs ()
+ "Ask user if she wants to create a .emacs compatibility file."
+ (if (yes-or-no-p-minibuf "Create compatibility .emacs? ")
(defun migrate-user-init-file ()
- "Migrate the init file from the home directory."
+ "Migrate the init file from the home directory.
+Return the name of backup file, if one was created."
(if (not (file-exists-p user-init-directory))
(message "Creating %s directory..." user-init-directory)
(message "Migrating custom file...")
- (customize-set-value 'load-home-init-file nil)
- (custom-migrate-custom-file (make-custom-file-name user-init-file
- (message "Moving init file...")
- (let ((new-user-init-file (expand-file-name user-init-file-base
- (rename-file user-init-file new-user-init-file)
- (setq user-init-file new-user-init-file))
- (message "Migration done."))
+ (let* ((backup (concat user-init-file ".backup"))
+ (and (not (file-exists-p backup))
+ (copy-file user-init-file backup)
+ (customize-set-value 'load-home-init-file nil)
+ (custom-migrate-custom-file (make-custom-file-name user-init-file
+ (message "Moving init file...")
+ (let ((new-user-init-file (expand-file-name user-init-file-base
+ (rename-file user-init-file new-user-init-file)
+ (setq user-init-file new-user-init-file))
+ (message "Migration done.")
+ (and backup-p backup)))
(defun create-compatibility-dot-emacs ()
"Create .emacs compatibility file for migrated setup."
XEmacs-Beta mailing list
XEmacs-Patches mailing list