2009-06-30 137 views
7

我對emacs完全陌生,並開始學習如何有效地使用它。Emacs:把p​​svn.el文件放在哪裏?

我想要使用的第一件事是svn模式。

我下載psvn.el並把它放在〜/ .emacs.d目錄

然後在psvn.el文件的註釋部分的指令之後,我把這個線

(require 'psvn) 

進入.emacs文件

這是我目前.emacs文件

(custom-set-variables 
    ;; custom-set-variables was added by Custom. 
    ;; If you edit it by hand, you could mess it up, so be careful. 
    ;; Your init file should contain only one such instance. 
    ;; If there is more than one, they won't work right. 
'(inhibit-startup-screen t)) 
(custom-set-faces 
    ;; custom-set-faces was added by Custom. 
    ;; If you edit it by hand, you could mess it up, so be careful. 
    ;; Your init file should contain only one such instance. 
    ;; If there is more than one, they won't work right. 
) 

(require 'psvn) 

現在,當我啓動emacs,我得到了這個錯誤信息:

An error has occurred while loading `/home/akong/.emacs': 

File error: "Cannot open load file", "psvn" 

To ensure normal operation, you should investigate the cause 
of the error in your initialization file and remove it. Start 
Emacs with the `--debug-init' option to view a complete error 
backtrace 

我把psvn.el放在錯誤的位置?

我使用的cygwin + WinXP的

回答

12

這是因爲Emacs在load-path上找不到任何文件psvn

在你的shell:

mkdir -p ~/.emacs.d    # Make the directory unless it exists 
mv /some/path/psvn.el ~/.emacs.d/ # Move psvn.el into that directory 

在您的Emacs init文件(通常~/.emacs):

(add-to-list 'load-path "~/.emacs.d") ; Add this directory to Emacs' load path 
(require 'psvn)      ; Load psvn 

編輯:我只是意識到你是在Windows XP上。我不確定Cygwin是如何處理所有這些的,但Cygwin的程序與Cygwin完全相同,只記得在Windows XP上~%APPDATA%,所以.emacs.d.emacs都應該在該目錄中。

1

你會想要做的第一件事是添加.emacs.d到您的負載路徑,以便它知道去哪裏找。一般大多數人存放在~/.emacs.d/site-lisp.el插件,所以我這樣做:

;; >>> Configure Load Path <<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
(setq emacs-config-path "~/.emacs.d/") 
(setq base-lisp-path "~/.emacs.d/site-lisp/") 
(setq site-lisp-path (concat emacs-config-path "/site-lisp")) 
(defun add-path (p) 
    (add-to-list 'load-path (concat base-lisp-path p))) 

;; I should really just do this recursively. 
(add-path "") 
;; (add-path "some-nested-folder") 

現在(require 'psvn)應該迎刃而解。

1

我想你有問題在Windows上找到你的主目錄?試試Cx d〜RETURN(直接運行你的主目錄)來查看你的主目錄是什麼,然後做其他答案:將psvn.el放入.emacs.d並在你的加載目錄中添加〜/ .emacs.d,路徑