[S21.5R21.4] After -q offer to load init files, not .emacs
Stephen J. Turnbull
stephen at xemacs.org
Wed Sep 22 04:04:15 EDT 2004
SUPERSEDES 21.5 RECOMMEND 21.4
sjt> When xemacs is started with -q (or any of the options that
sjt> implies it), initialization adds a button to load the init
sjt> files to the menu bar.
sjt> The existing test for .emacs is wrong, if someone doesn't
sjt> have a .emacs. This patch works for me, but I'm not entirely
sjt> confident it will always work right in the twisty maze of
sjt> little passages all alike that we name "startup.el". Mike?
sjt> Also, does anybody feel changing the notation to "Load init
sjt> files" is likely to confuse someone? I would appreciate
sjt> review, including comments from testers.
Urk. _Doesn't_ work for me, because `user-init-file' is nil at that
point. Discovered this on a rebuild. Newbie mistake---earlier
version of the patch was dumped into xemacs, so the patched-and-byte-
compiled file was ignored. :-P
I took a look at how things work, and the obvious fix, which is to
move initialization of `user-init-file' out of `load-user-init-file',
is really incoherent, because I'm pretty sure moving initialization of
`custom-file' is a Very Bad Thing (this would mean that even though
the customizations aren't loaded, any `custom-save-variables'
overwrites the custom file, destroying it). And I'm not 100% sure
that `find-user-init-file' initializes to a non-null string, anyway.
Mike, can you check me on the logic above? I'd like to document it;
the "migration destroys customizations" episode was the nadir of my
career so far---I don't want it to ever happen again. :-(
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.589
diff -u -U0 -r1.589 ChangeLog
--- lisp/ChangeLog 22 Sep 2004 02:05:42 -0000 1.589
+++ lisp/ChangeLog 22 Sep 2004 02:38:26 -0000
@@ -0,0 +1,5 @@
+2004-09-22 Stephen J. Turnbull <stephen at xemacs.org>
+
+ * menubar-items.el (init-menubar-at-startup):
+ XEmacs loads "init files", not ".emacs".
+
Index: lisp/menubar-items.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/menubar-items.el,v
retrieving revision 1.42
diff -u -r1.42 menubar-items.el
--- lisp/menubar-items.el 19 Apr 2004 08:54:50 -0000 1.42
+++ lisp/menubar-items.el 22 Sep 2004 07:54:38 -0000
@@ -1717,16 +1717,16 @@
(defun init-menubar-at-startup ()
"Don't call this.
-Adds `Load .emacs' button to menubar when starting up with -q."
- (when (and (not load-user-init-file-p)
- (file-exists-p (expand-file-name ".emacs" "~")))
+Adds `Load init files' button to menubar when starting up with -q."
+ ;; load-user-init-file finds the init files itself now
+ (when (not load-user-init-file-p)
(add-menu-button
nil
- ["%_Load .emacs"
+ ["%_Load init files"
(progn
(mapc #'(lambda (buf)
(with-current-buffer buf
- (delete-menu-item '("Load .emacs"))))
+ (delete-menu-item '("Load init files"))))
(buffer-list))
(load-user-init-file))
]
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
More information about the XEmacs-Beta
mailing list