在Emacs中运行当前缓冲区的Python程序并在输出窗口显示结果
我在使用Python模式(不是Emacs 23自带的那个)。
我无法在Emacs中执行当前加载的Python程序。
我遇到了一个错误,提示“符号的函数定义是空的:smart-operator-mode-on”。
有没有什么线索或者建议,能让我在Emacs中运行Python程序,并显示结果输出窗口呢?
这里是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)
))
2 个回答
0
我通过把 smart-operator.el
文件下载到一个可以加载的路径里,然后在调用 smart-operator-mode-on
之前加上 require 'smart-operator'
这行代码,解决了这个错误。
0
关闭后它就能正常工作了(智能操作模式开启)。我需要看看怎么解决智能操作模式开启的问题。
(setq debug-on-error t) 这个设置帮我找到了错误。谢谢你,Noufal。