I am in the process of switching from one machine to another, and I am
of course setting up emacs on the new machine. (How could I live
without it?) The old machine has a defaults.el file in the emacs/lisp
directory, and I have a few things in there, for example the lisp code
needed to make GNUS work. In this new setup I was being assisted by
the local system guru (who does not use emacs), and he mentioned that
he created a site-init.el file for this kind of thing.
Now I always assumed that these two files, defaults.el and
site-init.el, were essentially the same thing. Either name would work.
But lo and behold, when I put my GNUS intialization stuff in
site-init.el, GNUS didn't work! I have to open site-inti.el and do an
eval-current-buffer to get GNUS to work. Obviously site-init.el is not
automatically evaluated when I start emacs. Can someone out there
clear up this confusion for me? What is site-init.el for, if it's not
evaluated at startup? Should I just use default.el? Any comments or
advice welcomed.
PS - I'd prefer it if you could post your reply. I haven't got RMAIL
to work properly on this new machine yet - but that's another question.
clear up this confusion for me? What is site-init.el for, if it's not
evaluated at startup? Should I just use default.el? Any comments or
advice welcomed.
Site-init.el runs when emacs is _compiled_, default.el is loaded
every time emacs is run (after the .emacs file). For now default.el
is probably the best place to put things so you don't have to
recompile emacs. Eventually you might develop a list of things that
belongs in site-init (like autoloads).
Here is an example:
;; So shell can keep track of the directories
(setq shell-pushd-regexp "pd")
(setq shell-popd-regexp "pop")
;; Set up gnus variables
(setq gnus-nntp-server "spool.cs.wisc.edu")
(setq gnus-local-domain "physics.wisc.edu")
(setq gnus-local-organization "Space Physics, University of Wisconsin - Madison")
;; Fix up display-time so load shows too.
(load "load-average" nil t)
;; Fix ispell to use Geoff Kuenning's ispell
(define-function 'ispell nil)
(autoload 'ispell-buffer "ispell"
"Check the spelling of buffer." t)
site-init.el(c) is loaded into Emacs before the Emacs executable is
dumped out. Thus, changes to site-init.el will not take effect until
Emacs is rebuilt. (Shouldn't this be mentioned somewhere in the Emacs
or Emacs Lisp info manuals?)
So stuff in site-init.el should be stuff that you don't expect to
change often.
default.el is loaded at run-time, after ~/.emacs. Quoting from the Emacs
Lisp manual:
3. It loads `default.el' unless `inhibit-default-init' is non-`nil'.
(This is not done in `-batch' mode or if `-q' was specified on
command line.)
Since default.el is run after ~/.emacs, it should generally contain
defvar statements rather than setq, so as not to override settings
in users' .emacs files.
Lars Huttar "Yoompin Yiminy! Now I'm mad!!"
hut...@hp750.itg.ti.com - short viking on Woody Woodpecker cartoon
YP> By default emacs looks for directory /usr/local/lib/emacs/site-init.
YP> You can put the files that do not come with the emacs distribution to
YP> site-init directory, so when you switch to a new version of emacs
I think you are majorly confused here, or didn't understand the
question asked.
YP> these files will still be available. The file default.el can be either
YP> in /usr/local/lib/emacs/19.17/lisp directory or under site-init. I
YP> prefer putting it under site-init since it does not come with the
YP> distribution and the same file is used for a number of emacs versions.
Emacs 19 has a site-lisp directory, where you can place local emacs
lisp files.
The file site-init.el is loaded when emacs gets built (when temacs
gets dumped into emacs and emacs-<version number>). It is only loaded
if it exists in the lisp directory at build time. This lets you build
into the emacs executable any lisp code you always need.
The file default.el is loaded (if it exists) after your .emacs file
gets loaded when you run emacs. Loading of default.el can be
inhibited by setting the appropriate variable in your .emacs file.
Emacs 19 also has a site-start file that gets loaded just prior to the
user's .emacs file, so is always (if it exists) loaded at runtime.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Gradual Student/Systems Guy Department of Computer Science
Internet: kh...@cs.duke.edu Box 90129
RIPEM/PGP/MIME spoken here Durham, NC 27708-0129 (919)660-6528
Well, I got several replies to this telling me the asnwer and clearing
up some confusion that has been bothering me for some time. The answer
is that the site-init.el file is rolled into emacs when you compile
it, whereas default.el is evaluated each time you start, right after
emacs evaluates your .emacs. So the point of site-init is if you have
some code that you always want executed for everyone, and you know it
before you copile emacs. Presumably it would then be faster to put
that code in site-init.el, then compile emacs. But for day-to-day
changes that you want to apply to everyone (which is what I wanted),
default.el is the way to go.
Thanks to all those who replied.
--
Such wind as scatters young men through the world, to seek their
fortunes farther than at home, where small experience grows.
- Shakespeare
Edward Hartnett e...@khonshu.colorado.edu
>Now I always assumed that these two files, defaults.el and
>site-init.el, were essentially the same thing. Either name would work.
>But lo and behold, when I put my GNUS intialization stuff in
>site-init.el, GNUS didn't work! I have to open site-inti.el and do an
>eval-current-buffer to get GNUS to work. Obviously site-init.el is not
>automatically evaluated when I start emacs. Can someone out there
>clear up this confusion for me? What is site-init.el for, if it's not
>evaluated at startup? Should I just use default.el? Any comments or
>advice welcomed.
The file should be default.el, not defaults.el (no s). site-init.el must be
created prior to dumping emacs, and is loaded and dumped with the dumped
emacs. default.el is loaded by all emacses at startup.
It is to your advantage (speedwise) to have no default.el and put all this
site-specific stuff in site-init.el, and that is convenient to do when you're
building and setting up emacs.
If I have to install a lisp packiage or make some change to system-wide emacs
defaults, I will generally make that change in default.el. Then, when I install
the next emacs beta ( :-) ), I will move the stuff into site-init.el.
This is covered in the INSTALL file.
--
John Hawkinson
jh...@panix.com
> Now I always assumed that these two files, defaults.el and
> site-init.el, were essentially the same thing. Either name would work.
> But lo and behold, when I put my GNUS intialization stuff in
> site-init.el, GNUS didn't work! I have to open site-inti.el and do an
> eval-current-buffer to get GNUS to work. Obviously site-init.el is not
> automatically evaluated when I start emacs. Can someone out there
> clear up this confusion for me? What is site-init.el for, if it's not
> evaluated at startup? Should I just use default.el? Any comments or
> advice welcomed.
site-init.el is used when initially building emacs. That is, the file is
loaded with temacs, then the entire system is dumped into emacs and
emacs.19.17.x (x=compilation count). The new emacs is then installed
with the make install.
Any changes to site-init.el require that emacs be rebuilt and
reinstalled.
The lisp files that you wish to add are put in $EMACS/site-lisp which is
automatically in your load path. The emacs distribution lisp files are
in $EMACS/lisp.
default.el is loaded after your .emacs is loaded. If you have anything
that must override system defaults, DO NOT put the system defaults into
default.el.
--
____________________________________________________________________
| Hillel Markowitz | Said the fox to the fish, join me ashore |
| H_Mar...@att.com | The fish are the Jews, Torah is the water |
|_____________________|____________________________________________|
/Thommy M.
--
Thommy M. Malmström
Work: EP Telecom HM/EPK/TH, Östergatan 15, S-281 32 Hässleholm. +46-451-812 30
Home: Iliongränd T:312, S-224 71 Lund. +46-46-13 21 78
PGP Public Key Block available upon request
FSFmacs uses the file site-start.el{c}, but it hardcodes this name
whereas Lemacs lets you (the person building emacs) change it. FSFmacs
should let you change it too. See the defun command-line in
startup.el in FSFmacs 19.17.
-Barry
VK> Emacs 19 also has a site-start file that gets loaded just
VK> prior to the user's .emacs file, so is always (if it exists)
VK> loaded at runtime.
FSFmacs should allow you to inhibit loading of the site-start file,
and should allow you to change the name of the file when you dump
emacs. Lemacs lets you do both. The name of the file is kept in a
variable site-run-file:
site-run-file's value is "/depot/gnu/lib/lisp-local/site/site-run.el"
Documentation:
File containing site-wide run-time initializations.
This file is loaded at run-time before ~/.emacs. It contains inits
that need to be in place for the entire site, but which, due to their
higher incidence of change, don't make sense to load into emacs'
dumped image. Thus, the run-time load order is: 1. file described in
this variable, if non-nil; 2. ~/.emacs; 3. default.el.
And the loading of this file can be inhibited with the inclusion of
the -no-site-file switch:
warsaw@anthem[79]% lemacs -help
GNU Emacs 19.6.26 Lucid of Mon Jul 26 1993 on anthem (berkeley-unix)
[...]
These options are processed only if they appear before all other options:
-batch Execute noninteractively (messages go to stderr.)
This option must be first in the list.
-nw Inhibit the use of any window-system-specific
display code: use the current tty.
-no-site-file Do not load site-wide run-time init file.
-no-init-file Do not load an init file (~/.emacs).
-q Same as -no-init-file.
-user <user> Load user's init file instead of your own.
-u <user> Same as -user.
default.el is evaluated every time emacs starts up (after the user's
.emacs).