I use ropemacs to write python source and here is the related portion of .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)
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.