fix python keybindings, auto cleanup python imports on save
[emacs-init.git] / python / init_python.el
index 38131c7..9a6e117 100644 (file)
@@ -10,7 +10,7 @@
         (define-key py-mode-map (kbd "RET") 'newline-and-indent)
         ;(define-key py-mode-map [tab] 'yas/expand)
         ;(setq yas/after-exit-snippet-hook 'indent-according-to-mode)
-        (smart-operator-mode-on)
+        ;(smart-operator-mode-on)
         ))
 ;; pymacs
 (autoload 'pymacs-apply "pymacs")
 ;;  '(add-to-list 'pymacs-load-path YOUR-PYMACS-DIRECTORY"))
 (pymacs-load "ropemacs" "rope-")
 (setq ropemacs-enable-autoimport t)
+
+;; M-/               rope-code-assist
+;; C-c g             rope-goto-definition
+;; C-c d             rope-show-doc
+;; C-c f             rope-find-occurrences
+;; M-?               rope-lucky-assist
+
+(define-key ropemacs-local-keymap "\M-/" 'hippie-expand)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Auto-completion
 ;;;  Integrates:
                '("\\.py\\'" flymake-pyflakes-init)))
 (add-hook 'find-file-hook 'flymake-find-file-hook)
 
-(defun py-cleanup-imports ()
+(defun py-cleanup-imports (&optional nowait)
   (interactive)
   (let (beg end)
     (if (region-active-p)
             (insert "\n" prefix))
           (forward-line 1)))
       (sort-lines nil b (point))
-      (if (boundp flymake-is-running)
+      (if (and (not nowait) (boundp flymake-is-running))
           (progn
             (while flymake-is-running (sit-for .1))
             (flymake-start-syntax-check)
@@ -192,5 +201,3 @@ is ignored (Those are the file local variables and local words)."
   (flyspell-mode t))
 
 (provide 'init_python)
-
-