python - el-get 安装的包加载问题 emacs-jedi

标签 python emacs elisp el-get emacs-jedi

我关注了these instructions with el-get to try to install emacs-jedi (和其他需要的包),但运气不好。

在我的 .emacs 文件中,我添加了以下几行:

;; .emacs

;; Load package repositories
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/package/") t)

(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

;; Install / load / require el-get and
;; packages managed by it.
(add-to-list 'load-path "~/.emacs.d/el-get/")
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

(unless (require 'el-get nil t)
  (url-retrieve
   "https://raw.github.com/dimitri/el-get/master/el-get-install.el"
   (lambda (s)
     (end-of-buffer)
     (eval-print-last-sexp))))

;; Initialize any loaded packages 
(package-initialize)

;; stuff to set font, theme, etc.
;; ...

;; Include jedi for Python mode.
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)

;; rest of file ...

起初,我看到的是“无法打开加载文件 jedi/jedi”的问题。当我将“~/.emacs.d/el-get/”添加到加载路径时,这似乎消失了(el-get 似乎只放置“~/.emacs.d/el- get/el-get"安装时在加载路径上)。

但在此之后,打开 Python 文件并尝试 M-x python-mode 会产生错误:

Symbol's function definition is void: jedi:setup

我很乐意做更多的调试或提供更多的消息或输出——但是在谷歌搜索这些错误消息很长时间之后,我一直无法找到任何似乎有效的尝试。

最佳答案

您缺少在 https://github.com/dimitri/el-get#basic-setup 中提到的 (el-get 'sync)

此外,您不需要 (package-initialize) 等来设置 package.el。一切都由 el-get 处理。最好不要混用两个包管理器。

这是通过 el-get 使用 Jedi 的最小 Emacs 设置:

(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

;; Uncomment this, if you are in hurry
;; (setq el-get-install-skip-emacswiki-recipes nil)

(unless (require 'el-get nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (goto-char (point-max))
    (eval-print-last-sexp)))

(el-get 'sync)

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)

;; Type:
;; - M-x el-get-install RET jedi RET
;; - M-x jedi:install-server RET
;; Then open any Python file.

更新:

我在手册中添加了它

  1. http://tkf.github.io/emacs-jedi/latest/#install
  2. http://tkf.github.io/emacs-jedi/latest/#quick-try

关于python - el-get 安装的包加载问题 emacs-jedi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22462261/

相关文章:

python 正则表达式 [新手]

windows - 如何在减小文本大小时避免跟随模式大文本溢出到下一个窗口?

emacs - 我可以限制 Emacs 中编译缓冲区的长度吗?

emacs - 如何在 Emacs 中显示所有 minibuffer 命令历史记录?

python - 在列 Pandas 中查找字符最少的值

python - 修改后代中的祖先嵌套元类

python - Django 测试覆盖率与代码覆盖率

emacs - org-mode:org-time-stamp-custom-formats 显示午夜时间

emacs - org 模式下的粗体标记区域

emacs - 在 Emacs 启动时列出加载的配置文件?