开发者

Problem with ropemacs when opening file in jython-mode

开发者 https://www.devze.com 2023-02-16 00:43 出处:网络
I use ropemacs to write python source and here is the related portion of .emacs: (defun my-python-hook-mode ()

I use ropemacs to write python source and here is the related portion of .emacs:

(defun my-python-hook-mode ()
  (interactive)
  (require 'pymacs)
  (aut开发者_运维百科oload '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)

The above works for files opened in python-mode. But for some reason (unknown yet), emacs will treat a few of .py files in jython-mode.

Each time that a file is opened in jython-mode, the function "my-python-hook-mode" is called twice and there is a warning message (no side effect found so far):

Toggling ropemacs-mode off; better pass an explicit argument.

Anyone met with such problem? Thanks.


It appears from your description, that, jython-mode has its own hooks that are run after running the hooks for python-mode. This is what M-x describe-function jython-mode shows as well. It is likely that this function is executed through these two hooks.

Entering a comment the first line of the file to indicate the mode of the file should help Emacs in selecting a major mode that is most suited for your purposes, and, stop the warning.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号