From xemacs-m  Wed Sep 10 09:06:50 1997
Received: from jagor.srce.hr (jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id JAA20854
	for <xemacs-beta@xemacs.org>; Wed, 10 Sep 1997 09:06:45 -0500 (CDT)
Received: (from hniksic@localhost)
	by jagor.srce.hr (8.8.7/8.8.6) id QAA11266;
	Wed, 10 Sep 1997 16:06:09 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Initialization files (edit-toolbar)
X-Attribution: Hrvoje
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 10 Sep 1997 16:06:08 +0200
Message-ID: <kigvi09mffz.fsf@jagor.srce.hr>
Lines: 105
X-Mailer: Gnus v5.4.65/XEmacs 20.3(beta19) - "Kyiv"

It seems that some of the modern applications require a `.xemacs/'
directory, and bomb out if they don't find one.  For instance, when I
tried out `edit-toolbar' and pressed `s', I got:

"Use M-x make-dir RET RET to create the directory"

and then:

/home/srce/hniksic/.xemacs/ is not a directory

...and nothing else happened.  Now, `edit-toolbar' contains code like
this:

(defvar edit-toolbar-file-name (concat "~"
				       (if (boundp 'emacs-user-extension-dir)
					   emacs-user-extension-dir
					 "/")
				       ".toolbar")
  "File name to save toolbars to.  Defaults to \"~/.xemacs/.toolbar\"")

Something is obviously wrong here.  For me, the value of
`emacs-user-extension-dir' is "/.xemacs", which is quite shaky, for
two reasons:

1) I don't _have_ a "~/.xemacs" directory;

2) Shouldn't it be "~/.xemacs/" rather than "/.xemacs/", which would
   result in more straightforward code?


Even if we forget the issue of those without a `.xemacs/' directory,
there is now an additional problem with `.xemacs' file.  NEWS says:

    By default XEmacs now loads the user file ~/.xemacs if it exists.  If
    there is no such file, it reads ~/.emacs as usual.  If both .xemacs
    and .emacs exist, XEmacs will only load .xemacs.

The obvious consequence is that our casual new user will use a
`.xemacs', which will sound very logical.  But now she will no longer
be able to have a `.xemacs/' directory at all!

There are further problems with Custom which /must/ be solved before
20.3 is released.  For instance, many 20.2 users have the
customizations in .emacs.  If I understand correctly, the new default
is ~/.xemacs-custom (or is it ~/.xemacs/options.el?).  Will the old
customizations be automagically transfered there?  I don't think so.
I had to transfer them manually.  Will that file be automatically
loaded after .emacs?  I don't know.  After having problems with this,
I had to put this to .emacs:

    (setq custom-file "~/.xemacs-custom")
    (load custom-file)

If we do not find satisfactory solutions to all of this, a terrible
confusion will ensue.  Here is my proposal:


1) Check for an `emacs-user-extension-dir' ("~/.xemacs" by default) at
   startup.  If not found, set the variable to nil.

2) If `emacs-user-extension-dir' is nil, construct `user-init-file' as 
   usual.  Else, set it to emacs-user-extension-dir/init.el.

3) Analogously, if `emacs-user-extension-dir' is nil, set
   `custom-file' to "~/.xemacs-custom" (or "~/.xemacs-options"),
   otherwise to emacs-user-extension-dir/options.el.

4) Create a function for packages to use consistently for their own
   init files.  For instance:

   (defun init-file-location (file &optional file-in-dir)
     "Return the proper location for FILE."
     (unless file-in-dir
       (setq file-in-dir file))
     (if emacs-user-extension-dir
         (concat emacs-user-extension-dir file-in-dir)
       (concat "~/" file)))

   This would enable people to write stuff like this:

   (defvar gnus-init-file
          (init-file-location ".gnus" "gnus-options.el"))

   ...with the meaning that Gnus will read either ~/.gnus or
   ~/.xemacs/gnus-options.el, or whatever the user wants.  The same
   would go for custom:

   (defvar custom-file (init-file-location ".xemacs-options" "options.el"))


This doesn't solve the problem of moving old customizations from
`.emacs' to `.xemacs-custom' (or whatever), but at least it should
reduce the amount of confusion.


P.S.
Why `emacs-user-extension-dir' instead of just `user-extension-dir',
which would be shorter, as well as analogous to `user-init-file' and
others?

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
You'll notice that perl is not itself written in Perl.
                                                 -- The Perl FAQ

