[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
provide and eval-after-load
From: |
Roland Winkler |
Subject: |
provide and eval-after-load |
Date: |
Mon, 5 Dec 2005 21:36:48 +0100 |
Symptoms:
I wanted to customize ediff-dir-diffs-buffer-map. So I put the
following into my .emacs.
(eval-after-load 'ediff-mult '(define-key ediff-dir-diffs-buffer-map ...
However, this gave me the error message
provide: Symbol's value as variable is void: ediff-dir-diffs-buffer-map
It seems to me that I get this error message because eval-after-load
is evaluated immediately after the (provide 'ediff-mult) at the
beginning of ediff-mult.el. If the (provide 'ediff-mult) appears at
the end of ediff-mult.el, everything is fine. Should (provide ...)
always appear at the end of the file? The documentation of provide
doesn't say that. Also, I believe that many packages have the
provide statement at the beginning of the file.
Or am I trying something illegal here?
In order to pin down the problem I played with the following two
files:
cat > foo.el <<EOF
(provide 'foo)
(defvar foo-buffer-map (make-sparse-keymap)
"Keymap for foo mode.")
(define-derived-mode foo-mode fundamental-mode "foo")
EOF
cat > bar.el <<EOF
(eval-after-load 'foo '(define-key foo-buffer-map "q" 'quit-window))
EOF
Executing `emacs --no-init-file -l bar.el -l foo.el' gives me
provide: Symbol's value as variable is void: foo-buffer-map
If the (provide 'foo) is moved to the end of foo.el everything is
fine.
Roland
- provide and eval-after-load,
Roland Winkler <=