Domanda

I would like to get pep8 formating in emacs and so I added to my .emacs file:

(when (load "flymake" t)
 (defun flymake-pylint-init ()
   (let* ((temp-file (flymake-init-create-temp-buffer-copy
                      'flymake-create-temp-inplace))
          (local-file (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
     (list "pep8" (list "--repeat" local-file))))
 (add-to-list 'flymake-allowed-file-name-masks
              '("\\.py\\'" flymake-pylint-init)))

(if (file-exists-p "~/ml/.emacs.d/emacs-for-python/epy-init.el")
    (load "emacs-for-python/epy-init"))

Now the problem is that ropemacs makes a lot of stuffs which stops me from typing. I would like to disable it so that I can just get the pep8 formating. How can I do this. I was trying to add

(ropemacs-mode nil)

to the above lines, but it didn't help. How can I do it?

È stato utile?

Soluzione

Well, I found the following solution, by not using emacs-for-python and activating flymake on load of Python files with the 'find-file-hook:

(when (load "flymake" t)
 (defun flymake-pylint-init ()
   (let* ((temp-file (flymake-init-create-temp-buffer-copy
                      'flymake-create-temp-inplace))
          (local-file (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
     (list "pep8" (list "--repeat" local-file))))
 (add-to-list 'flymake-allowed-file-name-masks
              '(".py$" flymake-pylint-init)))

(add-hook 'find-file-hook 'flymake-find-file-hook)

Altri suggerimenti

Simply comment out all the ropemacs-related bits from epy-python.el will do the trick. ;-)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top