2010-01-17 45 views
4

我知道,當有一個.el文件(.elc)的字節編譯版本時,emacs會加載第二個(我目前在同一個目錄中調整它們)。Emacs是否加載我的文件兩次(包括.el和.elc)?

當我開始Emacs和我看着我的消息緩衝區我看到這一點:

Loading c:/Documents and Settings.../App.../.emacs.d/themes/color-theme-example.el (source)...done 
Loading c:/Documents and Setting.../App.../.emacs.d/themes/color-theme-example.elc...done 
Loading c:/Documents and Settings.../App.../.emacs.d/themes/color-theme-library.el (source)...done 
Loading c:/Documents and Settings.../App.../.emacs.d/themes/color-theme-library.elc...done 

是emacs的裝載兩個.el和同一文件的.elc版本? 我不希望emacs加載我的插件兩次。

在我的.emacs我裝是這樣的:

;;color theme plugin 
(add-to-list 'load-path "~/.emacs.d/") 
(require 'color-theme) 
(eval-after-load "color-theme" 
    '(progn 
    (color-theme-initialize) 
    (color-theme-charcoal-black))) 

回答

2

你加載使用load-file或使用require顏色主題? require將不會加載其功能已提供的文件,只有在您明確要覆蓋該文件時才使用load-file。另一種可能性是color-theme-example和color-theme-library沒有使用provide,所以每次使用require時都要求他們再次加載 - 但是這會打印一個錯誤(「required feature'color-theme-例子不是由加載的文件提供的「或類似的東西)。

+0

我在我的.emacs使用此: ;;顏色主題插件 (添加到列表「負載路徑‘〜/ .emacs.d /’) (需要」顏色主題) (eval-after-load「color-theme」 '(progn (color-theme-initialize) (color-theme-charcoal-black))) – alexchenco 2010-01-17 22:10:15

+1

該手冊對此進行了關於eval-after-load的說明:精心設計Lisp程序不應該使用這個特性。您已經需要color-theme,只需直接運行代碼即可。它看起來像.emacs是好的,但如果這是唯一相關的代碼。我猜想color-theme在內部使用加載文件,或者以某種其他方式導致文件被錯誤加載多次。 – 2010-01-17 22:17:30

+0

我剛剛下載了color-theme-6.6.0,出於某種原因它調整了我的速度欄比我的屏幕高,但否則使用您在此發佈的代碼沒有問題(color-theme-example.el和color- theme-library.el每個加載一次)。 編譯color-theme-example和color-theme-library文件後,它們確實加載了源代碼和編譯版本。這表示顏色主題代碼中存在錯誤。 – 2010-01-17 22:35:42