2009-06-30 178 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,路径