Subject: [Patch] Enable completion in inferior-python-mode

From: Андрей Парамонов<[email-masked]>
Date: Fri, 12 Nov 2010 23:08:19 +0300

Hello!

I've managed to enable completion in Python interpreter buffer, patch
attached. The change in python-check-comint-prompt also fixes
completion in Python buffer when prompt in interpreter buffer is not
clear (a command is entered but not yet executed).

I didn't notice any regressions yet, but maybe the "\\="-thingy was
actually meaning something :-)  Please review my patch, I'm ready to
improve it if needed.

Best wishes,
Andrey Paramonov
--- /home/pent/python.el.orig	2010-11-12 21:55:47.000000000 +0300
+++ /home/pent/python.el	2010-11-12 21:51:26.000000000 +0300
@@ -1412,6 +1412,8 @@
   (set (make-local-variable 'comint-input-filter) 'python-input-filter)
   (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter
 	    nil t)
+  (add-hook 'completion-at-point-functions
+            'python-completion-at-point nil 'local)
   ;; Still required by `comint-redirect-send-command', for instance
   ;; (and we need to match things like `>>> ... >>> '):
   (set (make-local-variable 'comint-prompt-regexp)
@@ -1814,7 +1816,7 @@
 information etc.  If PROC is non-nil, check the buffer for that process."
   (with-current-buffer (process-buffer (or proc (python-proc)))
     (save-excursion
-      (save-match-data (re-search-backward ">>> \\=" nil t)))))
+      (save-match-data (re-search-backward "^>>> " nil t)))))
 
 ;; Fixme:  Is there anything reasonable we can do with random methods?
 ;; (Currently only works with functions.)