【问题标题】:Problem with ropemacs when opening file in jython-mode在 jython 模式下打开文件时,ropemacs 出现问题
【发布时间】:2011-03-08 14:26:26
【问题描述】:

我使用ropemacs编写python源码,这里是.emacs的相关部分:

(defun my-python-hook-mode ()
  (interactive)
  (require 'pymacs)
  (autoload 'pymacs-apply "pymacs")
  (autoload 'pymacs-call "pymacs")
  (autoload 'pymacs-eval "pymacs" nil t)
  (autoload 'pymacs-exec "pymacs" nil t)
  (autoload 'pymacs-load "pymacs" nil t)
  (ac-ropemacs-setup)
  (setq ropemacs-confirm-saving 'nil)
  (ropemacs-mode t)
  (define-key python-mode-map "\C-m" 'newline-and-indent)
 )
(add-hook 'python-mode-hook 'my-python-hook-mode)

以上内容适用于以 python 模式打开的文件。但由于某种原因(尚不清楚),emacs 会在 jython-mode 中处理一些 .py 文件。

每次在 jython-mode 中打开文件时,函数“my-python-hook-mode”会被调用两次,并出现警告消息 (目前没有发现副作用):

关闭ropemacs模式;最好传递一个明确的参数。

有人遇到过这样的问题吗?谢谢。

【问题讨论】:

    标签: python emacs jython ropemacs


    【解决方案1】:

    从您的描述中可以看出,jython-mode 有自己的挂钩,这些挂钩在运行 python-mode 的挂钩后运行。这也是M-x describe-function jython-mode 显示的内容。这个函数很可能是通过这两个钩子执行的。

    在文件的第一行输入注释以指示文件的模式应该有助于 Emacs 选择最适合您的目的的主要模式,并停止警告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-22
      • 2019-08-04
      • 1970-01-01
      • 2021-04-07
      • 2011-03-11
      • 1970-01-01
      • 2021-04-19
      相关资源
      最近更新 更多