Emacs:在哪里放psvn.el文件?

时间:2009-06-30 07:49:09

标签: emacs cygwin

我对emacs完全陌生,并开始学习如何有效地使用它。

我想要使用的第一件事是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

3 个答案:

答案 0 :(得分:12)

这是因为Emacs找不到psvn上提供load-path的任何文件。

在你的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之外的过程几乎相同,只记得Windows XP上的~%APPDATA%,所以.emacs.d.emacs都应该在该目录中。

答案 1 :(得分:1)

您要做的第一件事是将.emacs.d添加到您的加载路径,以便它知道在哪里查看。通常,大多数人会在.el中存储~/.emacs.d/site-lisp个插件,所以我这样做:

;; >>> 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)应该可以正常运作。

答案 2 :(得分:1)

我猜您在Windows上找到主目录时遇到问题?尝试Cx d~RETURN(在主目录上运行)以查看主目录的位置,然后执行其他答案所说的:将psvn.el放入.emacs.d并在您的负载中添加〜/ .emacs.d-路径