英文:
Disable auto completion of python code in emacs with elpy
问题
我是新手使用 elpy,这是一个用于处理 Python 的 Emacs 包。我一般不喜欢自动完成,特别是 elpy 使用的 YAsnippet 工具。我该如何禁用它?我在网上找到了解决方法,应该在启用 elpy 之前执行以下操作:(delete 'elpy-module-yasnippet elpy-modules)。但在加载 elpy 之前,这个变量未定义,我遇到了一个循环依赖的问题!以下是我的 init.el 文件,只包含一组最相关的代码行:
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(require 'use-package)
(custom-set-variables
'(package-selected-packages (quote (elpy python-mode)))
)
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable)
)
;; 禁用 elpy 中的 YAsnippet 代码补全
;(delete 'elpy-module-yasnippet elpy-modules)
英文:
I am new to using elpy, an emacs package for working with Python. I am not a fan of auto-complete in general, and the YAsnippet tool elpy uses in particular. How can I disable it? I found on the web I should do (delete 'elpy-module-yasnippet elpy-modules) before elpy is enabled. But I have a chicken and egg problem that this var is undefined before I load elpy! Here is my init.el, cut down to a minimal set of relevant lines:
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(require 'use-package)
(custom-set-variables
'(package-selected-packages (quote (elpy python-mode)))
)
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable)
)
;; disable YAsnippet code completion in elpy
;(delete 'elpy-module-yasnippet elpy-modules)
答案1
得分: 2
如果您的问题的关键点确实是
我有一个鸡生蛋问题,在我加载elpy之前,这个变量未定义!
那么解决方案是
(with-eval-after-load 'elpy
(delete 'elpy-module-yasnippet elpy-modules))
英文:
If the crux of your problem is indeed
> I have a chicken and egg problem that this var is undefined before I load elpy!
Then the solution is
(with-eval-after-load 'elpy
(delete 'elpy-module-yasnippet elpy-modules))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论