unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Subject: Clarification of eval-after-load [was: Problem mit symlinks, locate-library and load-history]
Date: Wed, 10 May 2006 21:11:46 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1060510203622.370A-100000@acm.acm> (raw)

Hi, Emacs!

The doc string (and manual entry) for eval-after-load are a bit hazy and
indefinite.  Here is the doc-string:

   "Arrange that, if FILE is ever loaded, FORM will be run at that time.
    This makes or adds to an entry on `after-load-alist'.
    If FILE is already loaded, evaluate FORM right now.
    It does nothing if FORM is already on the list for FILE.
    FILE must match exactly.  Normally FILE is the name of a library,
    with no directory or extension specified, since that is how `load'
    is normally called.
    FILE can also be a feature (i.e. a symbol), in which case FORM is
    evaluated whenever that feature is `provide'd."

Some problems are:
(i) "FILE must match exactly" doesn't say what FILE must match, or how it
must match it, and it is unclear what "exactly" means.  Given this
description, I would not expect the argument "font-lock" to match the
file name "font-lock.elc", but it does.  :-(

(ii) The doc-string doesn't say what happens when FILE gets loaded again.


I propose the following as a replacement:

   "Arrange that, if FILE is ever loaded, FORM will be run at that time.
    If FILE is already loaded, evaluate FORM right now.

    FILE, a string, must be either an absolute file name or a file name with
    no directory part; in either case it may have an extension
    \(e.g. \".el\") or may lack one.  Symbolic links in an absolute file name
    will be chased out before it is matched against the names of loaded files.

    When FILE is absolute, only FILE in that directory triggers evaluation
    of FORM, otherwise FILE in any directory will do.  If FILE has an
    extension, only a file with that exact extension will trigger evaluation,
    otherwise any extension will do it.

    Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
    is evaluated whenever that feature is `provide'd.

    Usually FILE is just a library name like \"font-lock\".

    If a matching file is loaded again, FORM will be evaluated again.

    This makes or adds to an entry on `after-load-alist'.
    It does nothing if FORM is already on the list for FILE."

Naturally, the code will need tweaking a bit to fit this doc-string.

What do you think?

-- 
Alan.

             reply	other threads:[~2006-05-10 21:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-10 21:11 Alan Mackenzie [this message]
2006-05-11 16:46 ` Clarification of eval-after-load [was: Problem mit symlinks, locate-library and load-history] Stuart D. Herring
2006-05-11 17:19   ` Alan Mackenzie
2006-05-11 17:46     ` Stuart D. Herring
2006-05-11 21:44       ` Alan Mackenzie
2006-05-12  4:15       ` Richard Stallman
2006-05-14 11:07 ` FIXED!! " Alan Mackenzie
2006-05-15  5:13   ` Richard Stallman
2006-05-21  9:39     ` Alan Mackenzie
2006-05-22  2:39       ` Richard Stallman
2006-05-23 17:21         ` Alan Mackenzie
2006-05-23 17:51           ` Andreas Schwab
2006-05-23 20:10             ` Alan Mackenzie
2006-05-23 20:58             ` FIXED!! Re: Clarification of eval-after-load Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.96.1060510203622.370A-100000@acm.acm \
    --to=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).