[comp.emacs] autoloading + Proposal for new load function

ram-ashwin@YALE.ARPA.UUCP (10/29/87)

>    From: grover%potomac.UUCP@YALE.ARPA (Mark D. Grover)
>    Date: 27 Oct 87 14:51:24 GMT
> 
>    I have extra stuff (modified definitions) that I want to load after
>    the normal autoloading of the rmail system.  How do I do this?

I usually write my own rmail.el file that loads the standard rmail file and
then redefines whatever I need.

This raises a question that I've had for a while -- what is the "standard"
way of customizing Emacs packages?  Should one write one's own file for each
package that needs to be customized (as with the rmail case above)?  If so,
maybe there should be an Emacs function "load-default" or "load-standard" or
something would load the standard version of the package (otherwise identical
to load).  For example, it would be nice to do the following:

        (load-default "rmail" nil t)
        ...my own stuff...

load-default would load the file from wherever it would come from if your
file hadn't been there, by looking down your load-path.  This saves you the
trouble of worrying about where the package really comes from (lisp, local,
elsewhere?) and also makes customization easier (independent of load-path and
installation-dependent pathnames).

I have a kludgy version of this function but I'm sure someone can do a better
job.  Or does anyone have a better way of doing customizations?  

-- Ashwin Ram --

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,linus,seismo}!yale!Ram-Ashwin
BITNET:  Ram@yalecs

mdb@amadeus.UUCP (Mark D. Baushke) (10/29/87)

>    From: grover%potomac.UUCP@YALE.ARPA (Mark D. Grover)
>    Date: 27 Oct 87 14:51:24 GMT
> 
>    I have extra stuff (modified definitions) that I want to load after
>    the normal autoloading of the rmail system.  How do I do this?

When I make customizations to packages like rmail.el, I use the hook
provided (c.f., rmail-mode-hook). For example, in ~/.emacs I put
something like this:

(defun rmail-mode-hook-extras ()
  "load personal rmail extras"
  (load-library "rmail-extra")
  (load-library "misc-tools"))

(setq rmail-mode-hook 'rmail-mode-hook-extras)

everytime I do a "rmail" command, these libraries get loaded (as that
is when the hook is run).

Of course, some things don't have hooks. Then I usually force loading
the standard (if it is not already loaded) and redefine what I want
redefined.

Mark Baushke
UUCP: ...!sun!silvlis!mdb

markl@ptt.LCS.MIT.EDU (10/30/87)

In-Reply-To: ram-ashwin@YALE.ARPA's message of 29 Oct 87 17:45:01 GMT

Repository: PTT-test

Originating-Client: allspice


>This raises a question that I've had for a while -- what is the "standard"
>way of customizing Emacs packages?  

80% of the customizations you will do can be achived using existing hook
variables (rmail-mode-hook, text-mode-hook, rmail-summary-mode-hook,
scribe-mode-hook etc, ad nauseum), or option variables
(mail-use-rfc822, rmail-dont-reply-to-names,
rmail-yank-ignored-headers, etc) .  The only time you should have to
overlay existing function definitions with your own is if a fairly
minor function in a subsystem does not do exactly what you want it to do.
That should be fairly rare.  When that does happen, you should think
of a way to implement the desired behaviour as (1) an option controlled by
a variable value or (2) in a hook variable.  Then you can make your
changes, recompile the lisp file, and no-one will notice any changes
unless they set the appropriate option variable or hook variable.

markl

Internet: markl@ptt.lcs.mit.edu

Mark L. Lambert
MIT Laboratory for Computer Science
Distributed Systems Group

----------

ram-ashwin@YALE.ARPA.UUCP (10/30/87)

>    When I make customizations to packages like rmail.el, I use the hook
>    provided (c.f., rmail-mode-hook). For example, in ~/.emacs I put
>    something like this:
> 
>    (defun rmail-mode-hook-extras ()
>      "load personal rmail extras"
>      (load-library "rmail-extra")
>      (load-library "misc-tools"))
> 
>    (setq rmail-mode-hook 'rmail-mode-hook-extras)
> 
>    everytime I do a "rmail" command, these libraries get loaded (as that
>    is when the hook is run).

This is fine, except you really don't want everything (re)loaded *each* time
you run the rmail function; rather, you want to load your libraries only
once, when you first invoke rmail.  You could, of course, get around this by
requiring your libraries rather then loading them.

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,linus,seismo}!yale!Ram-Ashwin
BITNET:  Ram@yalecs