X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fstartup.el;h=26cc29935de961eea1ce9fe7fa53d4485e8d32bc;hb=764cd736b2ffdaa917c3af06cb060f80f86fbe9f;hp=0a495e43cda77f61dbc75ce51d19338b46ceab07;hpb=a5812bf2ff9a9cf40f4ff78dcb83f5b4c295bd18;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/startup.el b/lisp/startup.el index 0a495e4..26cc299 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -715,43 +715,56 @@ perform the migration at any time with M-x migrate-user-init-file.") (yes-or-no-p-minibuf (concat "Migrate init file to " user-init-directory "? ")))) - (progn - (migrate-user-init-file) - (maybe-create-compatibility-dot-emacs)) - (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) - (progn - (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) + (progn + (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 + (progn + (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) + (maybe-create-compatibility-dot-emacs)))) + (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? ") (create-compatibility-dot-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." (interactive) (if (not (file-exists-p user-init-directory)) (progn (message "Creating %s directory..." user-init-directory) (make-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 - 'force-new)) - (message "Moving init file...") - (let ((new-user-init-file (expand-file-name user-init-file-base - user-init-directory))) - (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")) + (backup-p + (and (not (file-exists-p backup)) + (progn + (copy-file user-init-file backup) + t)))) + (customize-set-value 'load-home-init-file nil) + (custom-migrate-custom-file (make-custom-file-name user-init-file + 'force-new)) + (message "Moving init file...") + (let ((new-user-init-file (expand-file-name user-init-file-base + user-init-directory))) + (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." @@ -1159,7 +1172,7 @@ Copyright (C) 1996-2002 MORIOKA Tomohiko ((key about-xemacs) ": see who's developing XEmacs\n")) ((face (blue bold underline) "\nUseful stuff:\n\n") - "Things that you should know rather quickly...\n\n" + "Things that you should learn rather quickly...\n\n" ((key find-file) ": visit a file\n") ((key save-buffer) ": save changes\n") ((key advertised-undo) ": undo changes\n")