【发布时间】:2010-01-14 10:09:49
【问题描述】:
我正在使用 Emacs 23 和 python-mode 5.1.0 来编辑我的 python 程序。有时在编写程序时,我想运行一个小的一次性 python 脚本,所以我运行交互式移动(C-c!)。这很好,但它既不缩进也不突出显示代码,如果我尝试在其中运行 python 模式,它不再计算。那么,如何设置缩进和高亮呢?
【问题讨论】:
我正在使用 Emacs 23 和 python-mode 5.1.0 来编辑我的 python 程序。有时在编写程序时,我想运行一个小的一次性 python 脚本,所以我运行交互式移动(C-c!)。这很好,但它既不缩进也不突出显示代码,如果我尝试在其中运行 python 模式,它不再计算。那么,如何设置缩进和高亮呢?
【问题讨论】:
将这些添加到我的 .emacs 似乎已经完成了。
它在通知中检查缓冲区名称的位置可能会更好地作为对 set-pycomint-keywords 设置的缓冲区局部变量的测试,但你明白了。
(defun set-pycomint-keywords ()
(setq font-lock-keywords python-font-lock-keywords))
(add-hook 'py-shell-hook 'set-pycomint-keywords)
(defadvice comint-send-input (around block-comint-formatting activate)
(if (string= (buffer-name) "*Python*")
(letf (((symbol-function 'add-text-properties) (lambda (x y z) nil)))
ad-do-it))
ad-do-it)
【讨论】:
【讨论】: