[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval-after-load weirdness
From: |
Trent Buck |
Subject: |
Re: eval-after-load weirdness |
Date: |
Wed, 23 May 2007 11:46:14 +1000 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Wed, May 23, 2007 at 07:59:22AM +0900, Miles Bader wrote:
> Trent Buck <trentbuck@gmail.com> writes:
> > because my modular .emacs setup has each configuration module named
> > after the library it configures (e.g. ~/.emacs-prefs/vc.el for the vc
> > library), eval-after-load thinks "vc" has already been loaded.
> ...
> > Some solutions suggested on #emacs:
> > - stuff everything back into a single .emacs;
> > - prefix filenames with digits (e.g. 20vc.el), like system V init
> > scripts; and
> > - instead of LOADing each config module, FIND-FILE it and then
> > EVAL-BUFFER it.
>
> You could also just remove the init files from `load-history' after the
> fact.
>
> E.g. (at the end of your .emacs):
>
> (let ((remove-regexp
> (concat "\\`" (regexp-quote (file-truename "~/.emacs-prefs/"))))
> (new-load-hist nil))
> (dolist (entry load-history)
> (unless (string-match remove-regexp (car entry))
> (push entry new-load-hist)))
> (setq load-history (nreverse new-load-hist)))
I think that would solve EVAL-AFTER-LOADs in Emacs itself, but not
those scattered throughout .emacs-prefs/ itself. Here is the change I
eventually made per method (3), which solves the problem.
Mon May 21 19:30:33 EST 2007 Trent Buck <trentbuck@gmail.com>
* .emacs: don't use LOAD in .emacs-prefs.
Doing so breaks EVAL-AFTER-LOAD when passed a string as argument.
See http://paste.lisp.org/display/41451 for details.
diff -rN -u old-profile/.emacs new-profile/.emacs
--- old-profile/.emacs 2007-05-23 11:39:23.219566437 +1000
+++ new-profile/.emacs 2007-05-23 11:39:23.267571168 +1000
@@ -17,9 +17,11 @@
(let ((default-directory "~/.emacs-prefs/"))
(when (file-accessible-directory-p ".")
(load (expand-file-name "Emacs.el") t)
(load (expand-file-name
(format "window-system-%s.el" window-system)) t)
- (mapc (lambda (x)
- (when (locate-library (file-name-sans-extension x))
- (load (expand-file-name x))))
- (directory-files "." nil "\\`[a-z].*\\.el\\'"))))
+ (with-temp-buffer
+ (mapc (lambda (x)
+ (when (locate-library (file-name-sans-extension x))
+ (insert-file-contents (expand-file-name x))))
+ (directory-files "." nil "\\`[a-z].*\\.el\\'"))
+ (eval-buffer))))
--
Trent Buck
signature.asc
Description: Digital signature