【问题标题】:Emacs sr-speedbar cannot open loadfile, sr-speedbarEmacs sr-speedbar 无法打开loadfile,sr-speedbar
【发布时间】:2014-09-07 16:59:37
【问题描述】:

我无法按照在 Emacs 上安装 speedbar 的说明进行操作。

步骤 1. 将 Lisp:sr-speedbar.el 放入你的加载路径,添加 (需要 'sr-speedbar)

好的,将“sr-speedbar.el”放在我的加载路径中。 (首先我假设我的加载路径是我根目录中的 .emacs.d 目录。

我去这个链接:http://www.emacswiki.org/emacs/sr-speedbar.el 点击下载按钮,我最终不得不复制/粘贴整个文件,将其保存为 sr-speedbar.el 在我的 .emacs.d 目录中。

~/.emacs.d 现在有 sr-speedbar.el 并且我的 .emacs 文件有以下代码:

  1 (add-to-list 'load-path "~/.emacs.d/evil")..
  2 (require 'evil)..
  3 (evil-mode 1)
  4 (require 'sr-speedbar)

~
~ 所以我关闭了emacs,打开它并得到这个错误:

Warning (initialization): An error occurred while loading `/Users/johncurry/.emacs':

File error: Cannot open load file, sr-speedbar

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

所以我 $ emacs --debug-init

Debugger entered--Lisp error: (file-error "Cannot open load file" "sr-speedbar"$
  require(sr-speedbar)
  eval-buffer(#<buffer  *load*> nil "/Users/johncurry/.emacs" nil t)  ; Reading$
  load-with-code-conversion("/Users/johncurry/.emacs" "/Users/johncurry/.emacs"$
  load("~/.emacs" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312$
  command-line()
  normal-top-level()

sr-speedbar-open 在 emacs 中不返回匹配项。知道怎么弄错吗?我确定只是我不理解说明,但我需要这方面的帮助。

【问题讨论】:

  • 最可能的情况是您的sr-speedbar.el 库在您的load-path。因此,您可以将sr-speedbar.el 移动到您的load-path 中已经存在的目录中,或者您可以将该目录添加到load-path 所在的load-path 中。几分钟前有一个关于向~/.emacs.d 目录添加子目录的帖子——例如,创建一个名为lisp 的目录并将其添加到您的load-path 并将您的sr-speedbar.el 文件放在那里: stackoverflow.com/a/24791753/2112489
  • 我很确定我把它放在我的加载路径中,我安装的所有其他东西都在工作。这是我的 emacs.d 文件:.emacs.d johncurry$ ls Cask emacs-nav-49 framemove.el auto-save-list evil init.el 它有 sr-speedbar.el 但我将其删除并使用 emacs- nav-49 工作正常。
  • @JohnCurry 你有没有解决这个问题?我在使用 emacs 24.4.1 时遇到了同样的问题

标签: emacs editor elisp


【解决方案1】:

我遇到了同样的问题。当我检查 emacs 的加载路径时,我发现 ~/.emacs.d 目录不是路径的一部分。

您可以使用以下命令检查您的加载路径

C-h v load-path RET

为了添加路径,我将以下内容添加到我的 .emacs 文件中。

;; Add the ~/.emacs.d/lisp directory and all subdirectories to the load path of emacs
(let ((default-directory  "~/.emacs.d/lisp/"))
  (normal-top-level-add-subdirs-to-load-path))

我已经在 .emacs.d 目录中有一些文件,所以我添加了一个 lisp 目录,这样我就不会破坏任何东西。

然后我重新加载了我的 .emacs 文件,一切正常。 要重新加载您的 .emacs 文件,请使用以下命令

M-x load-file RET .emacs RET

来源:https://www.emacswiki.org/emacs/LoadPath

【讨论】:

    猜你喜欢
    • 2015-02-05
    • 2012-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多