emacs windows 在当前缓冲区中运行 python 程序并在输出窗口上显示输出

发布于 2024-08-17 15:30:17 字数 1322 浏览 5 评论 0原文

我使用 Python 模式(不是 emacs 23 附带的默认模式)。

我无法执行当前在 emacs 中加载的 python 程序。

我收到“符号的函数定义无效:智能操作模式开启”错误。

有任何线索或任何提示可以制作一个 python 程序,它可以在 emacs 上运行并显示结果输出窗口吗?

这里是emacs 错误报告

Debugger entered--Lisp error: (void-function smart-operator-mode-on)
     (smart-operator-mode-on)
     (lambda nil (set-variable (quote py-indent-offset) 4) 
      (set-variable (quote indent-tabs-mode) nil) (define-key py-mode-map (kbd "RET")  (quote newline-and-indent)) (smart-operator-mode-on))()
      run-hooks(python-mode-hook)
     (if python-mode-hook (run-hooks (quote python-mode-hook)) (run-hooks (quote py-mode-hook)))   python-mode()

我的 init_python.el 脚本

 (autoload 'python-mode "python-mode" "Python Mode." t)
 (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
 (add-to-list 'interpreter-mode-alist '("python" . python-mode))

  (require 'python-mode)
  (add-hook 'python-mode-hook
    (lambda ()
(set-variable 'py-indent-offset 4)
;(set-variable 'py-smart-indentation nil)
(set-variable 'indent-tabs-mode nil)
(define-key py-mode-map (kbd "RET") 'newline-and-indent)
;(define-key py-mode-map [tab] 'yas/expand)
;(setq yas/after-exit-snippet-hook 'indent-according-to-mode)
(smart-operator-mode-on)
))

I use the Python-mode (not the default one comes with emacs 23).

I could not execute the python program currently loaded in emacs.

I am getting "Symbol's function definition is void: smart-operator-mode-on" error.

Any clue or any tips makes a python program and it can be run on emacs and show the result output window?

Here the emacs error report.

Debugger entered--Lisp error: (void-function smart-operator-mode-on)
     (smart-operator-mode-on)
     (lambda nil (set-variable (quote py-indent-offset) 4) 
      (set-variable (quote indent-tabs-mode) nil) (define-key py-mode-map (kbd "RET")  (quote newline-and-indent)) (smart-operator-mode-on))()
      run-hooks(python-mode-hook)
     (if python-mode-hook (run-hooks (quote python-mode-hook)) (run-hooks (quote py-mode-hook)))   python-mode()

My init_python.el script

 (autoload 'python-mode "python-mode" "Python Mode." t)
 (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
 (add-to-list 'interpreter-mode-alist '("python" . python-mode))

  (require 'python-mode)
  (add-hook 'python-mode-hook
    (lambda ()
(set-variable 'py-indent-offset 4)
;(set-variable 'py-smart-indentation nil)
(set-variable 'indent-tabs-mode nil)
(define-key py-mode-map (kbd "RET") 'newline-and-indent)
;(define-key py-mode-map [tab] 'yas/expand)
;(setq yas/after-exit-snippet-hook 'indent-according-to-mode)
(smart-operator-mode-on)
))

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

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

发布评论

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

评论(2

蝶…霜飞 2024-08-24 15:30:18

关闭后即可工作(智能操作员模式开启)
我需要了解如何解决 smart-operator-mode-on

(setq debug-on-error t) 帮助我发现错误。谢谢努法尔。

It works after turning it off (smart-operator-mode-on)
I need to see how to solve smart-operator-mode-on

(setq debug-on-error t) helps me to spot the error. Thanks Noufal.

猫九 2024-08-24 15:30:18

我通过将 smart-operator.el 文件下载到加载路径并在调用 smart-operator- 之前添加 require 'smart-operator' 修复了此错误模式开启。

I got this error fixed by downloading the smart-operator.el file into a load-path and adding require 'smart-operator' before calling smart-operator-mode-on.

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