[Python-mode] patch to allow file completion in py-shell

Rodrigo Ventura yoda at isr.ist.utl.pt
Tue Apr 29 20:24:53 CEST 2008


I'm sending this this tiny patch to python-mode.el so that py-shell  
supports file completion after hiting the TAB key (and M-TAB lists  
possible completions):

--------------------- cut here ----------------------------
--- python-mode.el.orig 2008-04-29 16:42:04.000000000 +0100
+++ python-mode.el      2008-04-29 16:46:08.000000000 +0100
@@ -708,9 +708,10 @@
  (if py-shell-map
    (setq py-shell-map (copy-keymap comint-mode-map))
-  (define-key py-shell-map [tab]   'tab-to-tab-stop)
    (define-key py-shell-map "\C-c-" 'py-up-exception)
    (define-key py-shell-map "\C-c=" 'py-down-exception)
+  (define-key py-shell-map "\t"    'comint-dynamic-complete-filename)
+  (define-key py-shell-map "\e\t"  'comint-dynamic-list-filename- 

  (defvar py-mode-syntax-table nil
--------------------- cut here ----------------------------


Rodrigo Ventura
Institute for Systems and Robotics
Instituto Superior Técnico
Lisbon, Portugal

More information about the Python-mode mailing list