python.el shell 和执行缓冲区
我正在使用 fgallina python.el github 的 python.el 有一个很长的列表功能,但我不知道如何使用它们。
编辑:发现此模式正在工作,但是没有自动打开解释器,信息被发送到那里。如何发送/加载当前要评估的 python 缓冲区?我正在尝试使用抄送抄送,但没有得到任何输出。
Python shell 集成和 shell 补全?我是否需要在标准加载路径和 require 语句旁边添加一些内容?
我也没有显示 Imenu 支持。 编辑我尝试将其添加到我的 emacs 中,但没有成功。
add-hook 'python-mode-hook 'imenu-add-menubar-index)
我在 ubuntu 上使用 emacs 23
I am using the python.el from fgallina python.el github There is a long list of features but I am unaware of how to use them.
EDIT: Found this mode was working, however didn't automatically open the interpreter went the information was sent there. How can I send/load my current python buffer to be evaluated? I am trying to use C-c C-c but I don't get any output.
Python shell integration and shell completion? Do I need to add something beside the standard load-path and require statements for this?
Imenu support this isn't showing for me either.
Edit I tried adding this to my emacs but that hasn't worked.
add-hook 'python-mode-hook 'imenu-add-menubar-index)
I am using emacs 23 on ubuntu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于你的第一个问题:通常你可以使用 Cc Cl 加载缓冲区/文件。 (刚刚针对 python.el 进行了测试,它也适用于这个)这会将文件发送到下级 python 进程——因此您应该打开 *Python* 缓冲区来查看结果。 *Python* 缓冲区也是常规的 python 解释器/shell/REPL。 CMx 绑定到 python-send-defun,它将方法/函数定义发送到解释进程。对于其他绑定,只需点击 Mx 描述绑定,然后在打开的 *帮助* 缓冲区窗口中查找“python-”(在“主要模式绑定”下)。
如果您想了解有关完成的更多信息,在 python.el 的开头还有更多文档:
Quote:
Shell 完成:点击 tab 将尝试完成当前
单词。 Shell 完成的实现方式是,如果您
将
python-shell-interpreter
更改为任何其他(例如IPython)应该很容易集成另一种计算方式
完成情况。您只需要指定您的自定义
python-shell-completion-setup-code
和python-shell-completion-string-code
。引用:
符号补全:您可以在点处补全符号。它使用
shell 在后台完成,所以你应该运行
python-shell-send-buffer
时不时地获得更好的结果。骨架:提供了6个骨架,用于简单的类插入,
def、for、if、try 和 while。这些骨架与
达布雷夫。如果您激活了
dabbrev-mode
并且python-sculpture-autoinsert
设置为 t,那么每当您键入时任何已定义并命中 SPC 的名称,它们将是
自动扩展。
imenu 条目显示给我,无需添加挂钩,只需在配置文件中添加
(require 'python)
即可。For your first question: Usually you can load a buffer/file using C-c C-l. (Just tested this for python.el, and it works for this one as well) This will send the file to the inferior python process -- so you should open the *Python* buffer to see the results. The *Python* buffer is also your regular python interpreter/shell/REPL. C-M-x is bound to python-send-defun which sends a method/function definition to the interpreting process. For other bindings just hit M-x describe-bindings and then look for "python-" (under "Major Mode Bindings") in the opened *Help* buffer window.
There is some more documentation at the beginning of python.el if you want to know more about completion:
Quote:
Shell completion: hitting tab will try to complete the current
word. Shell completion is implemented in a manner that if you
change the
python-shell-interpreter
to any other (for exampleIPython) it should be easy to integrate another way to calculate
completions. You just need to specify your custom
python-shell-completion-setup-code
andpython-shell-completion-string-code
.Quote:
Symbol completion: you can complete the symbol at point. It uses
the shell completion in background so you should run
python-shell-send-buffer
from time to time to get better results.Skeletons: 6 skeletons are provided for simple inserting of class,
def, for, if, try and while. These skeletons are integrated with
dabbrev. If you have
dabbrev-mode
activated andpython-skeleton-autoinsert
is set to t, then whenever you typethe name of any of those defined and hit SPC, they will be
automatically expanded.
The imenu entry shows up for me without adding the hook, just
(require 'python)
in a configuration file.