rbj@dsys.icst.nbs.GOV (Root Boy Jim) (05/18/89)
? From: odi!benson@uunet.uu.net (Benson Margulies) ? Is there a hook (18.53-wise) that can be set in site-init.el to cause a function ? to run when emacs is started up? Yes. It's called `load'. Let me explain. When you build emacs, you compile all the .c files and link them all together to build `temacs'. The Makefile then executes `temacs -l loadup.el dump'. Scanning the source of lisp/loadup.el reveals that it loads several packages, including site-init.el. When loading a file, all the lisp forms are executed as if they were typed (more or less). Say you wanted to preload dired.el into your dumped emacs. You can just put the form `(load "dired")' into site-init.el in the lisp directory. There is also a `site-load.el' that gets loaded in a different place; I am not quite sure what the real distinction is. There is also a convention on how the doc strings are loaded; see loadup or loaddefs for details. Doing the above will preload emacs for everyone. If you only want to do this for yourself, a better solution is to put the `(load "dired")' in your private .emacs file. In either case, you may add other forms besides (load ...) in either file, to set variables, remap keys, etc. Around here, we use site-init.el to remap ^Q & ^S to ^^ and ^\. Good luck! ? Benson I. Margulies odi!benson@talcott.harvard.edu Root Boy Jim is what I am Are you what you are or what?
jr@bbn.com (John Robinson) (05/18/89)
In article <8905171912.AA06544@dsys.icst.nbs.gov>, rbj@dsys (Root Boy Jim) writes: >? From: odi!benson@uunet.uu.net (Benson Margulies) > >? Is there a hook (18.53-wise) that can be set in site-init.el to cause a function >? to run when emacs is started up? > >Yes. It's called `load'. I don't think this gets at what Benson is asking. site-init.el can cause packages to be put into shareable pure lisp space, and can initialize some lisp variables, but it can't leave something around to be run when emacs is started. The file $EMACS/lisp/default.el, if it exists, is loaded at startup for any user without a .emacs file. This may help. Another way to get this effect is to have the installed `emacs' program (/usr/local/bin/emacs or whatever) be a shellscript that does soemthing like: exec /usr/local/emacs/src/xemacs -f special-startup-function $* I do a similar thing (actually, with a csh alias) to get an elc command (emacs-lisp compiler) so as to avoid burdening my persistent emacs with the byte-compiler library. To modify how emacs starts up, look at the code in lisp/startup.el. It's pretty obvious what's going on there. You can probably modify it to look for a (say) default-entry-function symbol and call that at more or less the same place where .emacs or default.el is loaded. I suppose allow .emacs to override it through another config variable or by setting it to nil. -- /jr jr@bbn.com or bbn!jr C'mon big money!
benson@odi.COM ("Benson I. Margulies") (05/18/89)
? From: odi!benson@uunet.uu.net (Benson Margulies) ? Is there a hook (18.53-wise) that can be set in site-init.el to cause a function ? to run when emacs is started up? Yes. It's called `load'. Let me explain. When you build emacs, you compile all the .c files and link them all together to build `temacs'. The Makefile then executes `temacs -l loadup.el dump'. Scanning the source of lisp/loadup.el reveals that it loads several packages, including site-init.el. When loading a file, all the lisp forms are executed as if they were typed (more or less). Say you wanted to preload dired.el into your dumped emacs. You can just put the form `(load "dired")' into site-init.el in the lisp directory. There is also a `site-load.el' that gets loaded in a different place; I am not quite sure what the real distinction is. There is also a convention on how the doc strings are loaded; see loadup or loaddefs for details. OK, this part I get. However, we want to keep everyone's emacs up to date without the need to rebuild the emacs each time some package changes. So I wanted a hook to run at individual emacs start-up time to load up any patches that are defined to hold the fort until the next build. --benson
roberts@studguppy.lanl.gov (Doug Roberts) (05/18/89)
In article <40104@bbn.COM> jr@bbn.com (John Robinson) writes: > In article <8905171912.AA06544@dsys.icst.nbs.gov>, rbj@dsys (Root Boy Jim) writes: > >? From: odi!benson@uunet.uu.net (Benson Margulies) > > > >? Is there a hook (18.53-wise) that can be set in site-init.el to cause a function > >? to run when emacs is started up? > > > >Yes. It's called `load'. > > I don't think this gets at what Benson is asking. site-init.el can > cause packages to be put into shareable pure lisp space, and can > initialize some lisp variables, but it can't leave something around to > be run when emacs is started. > I believe that Benson _can_ use a load definition to accomplish what he wants. He can create a load file like the following: (defun () do-foo "A function that we wish to be running when GNU starts." (format t "Doing foo.")) (do-foo) This will cause do-foo to come up running. --Doug -- =============================================================== Douglas Roberts Los Alamos National Laboratory Box 1663, MS F-602 Los Alamos, New Mexico 87545 (505)667-4569 dzzr@lanl.gov ===============================================================
jr@bbn.com (John Robinson) (05/23/89)
In article <40104@bbn.COM>, jr@bbn (John Robinson) [that's me!] writes: >>? From: odi!benson@uunet.uu.net (Benson Margulies) >> >>? Is there a hook (18.53-wise) that can be set in site-init.el to cause a function >>? to run when emacs is started up? >> >The file $EMACS/lisp/default.el, if it exists, is loaded at startup >for any user without a .emacs file. This may help. Mark D. Baushke <mdb@bridge2.esd.3com.com> pointed out in mail that I said that a little wrong. The condition on its being loaded should read: The file $EMACS/lisp/default.el, if it exists, is loaded at startup for any user that has not done a (setq inhibit-default-init t) into their ~/.emacs file. In other words, Benson need only create a default.el file with the code he needs in it. Users smart enough to set inhibit-default-init ought to be able to figure out what they lose by so doing. default.el is loaded after the user's .emacs. It may be byte-compiled. This is true for 18.51, (probably 18.52), 18.53 and 18.54. -- /jr, nee John Robinson What a waste it is to lose one's mind--or not jr@bbn.com or bbn!jr to have a mind. How true that is. -Dan Quayle
jcgs@wundt.harlqn.uucp (John Sturdy) (05/24/89)
Benson writes: >> So I wanted a hook to run at individual emacs start-up time to load >> up any patches that are defined to hold the fort until the next >> build. The file <system elisp directory>/default.el is provided for this purpose. It is read after the user's .emacs file. __John (jcgs@uk.co.harlqn)