ports/114031: [PATCH] stop XEmacs from corrupting the ~/.emacs file when trying to migrate an init file it can't start to parse
jasonspiro4 at gmail.com
Tue Jun 26 08:50:02 UTC 2007
>Synopsis: [PATCH] stop XEmacs from corrupting the ~/.emacs file when trying to migrate an init file it can't start to parse
>Arrival-Date: Tue Jun 26 08:50:01 GMT 2007
>Originator: Jason Spiro
FreeBSD jlaptop. 6.2-RELEASE-p4 FreeBSD 6.2-RELEASE-p4 #0: Thu Apr 26 17:40:53 UTC 2007 root at i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
This is a patch for a preference-corruption issue. XEmacs corrupts the ~/.emacs file when you follow the steps below. It has happened to me both on Ubuntu Linux and on FreeBSD. The poor guy posting at https://stat.ethz.ch/pipermail/ess-help/2005-September/002851.html also experienced it.
* Add something to the top of the file (somewhere above the custom-set-variables statement) that xemacs can't understand, such as the lone word:
* Start xemacs for the first time
* At the "Migrate init file to ~/.xemacs/? (yes or no)" prompt, enter "no"
Now XEmacs will clobber the custom-set-variables and custom-set-fonts clauses in your ~/.emacs file. It replaces them with:
'(load-home-init-file t t))
See attached patch. To make the patch, I copied two lines from
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/cus-edit.el?revision=1.321&view=markup into the xemacs21-devel-mule port's unpacked source. Then I modified it to check even more aggressively: it refuses to try to save a user's customizations any time the init file didn't fully load, even if the custom file is a different file than the init file. This is because it seems that the variable custom-file was set (to /home/j/.emacs) on my PC and I am worried it may be set elsewhere too.
I tested the patch by deleting my cus-edit.elc and pasting in the new cus-edit.el in my xemacs lisp directory. It works fine.
Here is the patch:
--- xemacs-21.5.27/lisp/cus-edit.el.orig Tue Jun 26 04:10:18 2007
+++ xemacs-21.5.27/lisp/cus-edit.el Tue Jun 26 04:14:52 2007
@@ -3756,6 +3756,8 @@
(defun custom-save-all ()
"Save all customizations in `custom-file'."
+ (when init-file-had-error
+ (error "Cannot save customizations; init file was not fully loaded"))
(let ((inhibit-read-only t))
Dear FreeBSD people, could you please forward the patch onto the XEmacs people? Please let me know.
More information about the freebsd-ports-bugs