Emacs:python-shell 不响应 RET

发布于 2024-12-07 00:43:50 字数 670 浏览 2 评论 0原文

当我启动 python-shell(甚至只是从 Mx shell 启动 python)时,Emacs 会给出预期的提示:

bash-3.2$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

但是当我在提示符下键入内容并按 RET 时,光标向下移动一行,但命令并未执行。我可以让子进程响应的唯一命令是 CC Cc 等中断。中断后,会出现另一个提示 (>>),我可以使用 Mn 和 Mp 来导航我之前“输入”的行。

>>> test
hmmm, definitely pressed enter there
  C-c C-c
KeyboardInterrupt
>>> 

奇怪的是,这种情况在 Aquaemacs 和 emacs -nw 中都会发生。我尝试移动我的 .emacs 和 .emacs.d 文件,行为是相同的。关于可能导致此问题的任何想法?

When I start python-shell (or even just start python from M-x shell), Emacs gives the expected prompt:

bash-3.2$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

But when I type something at the prompt and press RET, the cursor moves down a line but the command is not executed. The only commands I can get the subprocess to respond to are interrupts like C-C C-c. After an interrupt, another prompt (>>>) appears and I can use M-n and M-p to navigate the lines I "entered" earlier.

>>> test
hmmm, definitely pressed enter there
  C-c C-c
KeyboardInterrupt
>>> 

Curiously, this occurs both in Aquaemacs and in emacs -nw. I've tried moving my .emacs and .emacs.d files and the behavior is the same. Any ideas on what might be causing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绅士风度i 2024-12-14 00:43:51

在执行“Mx shell”然后“python RET”后,执行“Ch k RET”然后显示什么?帮助缓冲区应该显示“comint-send-input”是为 RET 执行的命令。如果它没有将“comint-send-input”显示为“RET”执行的命令,那么您的初始化文件之一中可能有某些内容(.emacs 文件不是唯一的初始化文件)覆盖了此绑定。因此,然后尝试使用“emacs -nw -q -no-site-file”运行 emacs 并重复上述操作。如果它之前没有显示“comint-send-input”而现在显示“comint-send-input”,那么它肯定是您的初始化文件之一中的某些内容。查看本地(http://www.gnu.org/software/emacs/emacs-lisp-intro/elisp/Init-File.html#Init-File)和站点范围(http://www.gnu .org/software/emacs/emacs-lisp-intro/html_node/Site_002dwide-Init.html#Site_002dwide-Init) init 文件尝试查找罪魁祸首。如果检查文件后情况并不明显,最好的办法是重命名找到的所有初始化文件,并逐渐重新引入代码,直到找到导致“损坏”的原因。

After you do "M-x shell" and then "python RET", do "C-h k RET" and then what is displayed? the Help buffer should say that "comint-send-input" is the command that is executed for RET. If it isn't showing "comint-send-input" as the command executed by "RET" then there is probably something in one of your init files (the .emacs file isn't the only init file) that is overriding this binding. So, then try running emacs with "emacs -nw -q -no-site-file" and repeat the above. If it wasn't displaying "comint-send-input" previously and is displaying "comint-send-input" now, then it's definitely something in one of your init files. Look at both your local (http://www.gnu.org/software/emacs/emacs-lisp-intro/elisp/Init-File.html#Init-File) and site-wide (http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/Site_002dwide-Init.html#Site_002dwide-Init) init files to try to find the culprit. If it's not obvious after examining the files, your best bet is to rename any init files you find and gradually re-introduce the code until you find what is causing the "breakage".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文