##// END OF EJS Templates
Fix Emacs tab-completion support....
Fernando Perez -
Show More
@@ -321,7 +321,7 b' class IPCompleter(Completer):'
321 comp_append = completions.append
321 comp_append = completions.append
322 try:
322 try:
323 for i in xrange(sys.maxint):
323 for i in xrange(sys.maxint):
324 res = self.complete(text, i)
324 res = self.complete(text, i, text)
325 if not res:
325 if not res:
326 break
326 break
327 comp_append(res)
327 comp_append(res)
@@ -583,7 +583,7 b' class IPCompleter(Completer):'
583
583
584 return None
584 return None
585
585
586 def complete(self, text, state,line_buffer=None):
586 def complete(self, text, state, line_buffer=None):
587 """Return the next possible completion for 'text'.
587 """Return the next possible completion for 'text'.
588
588
589 This is called successively with state == 0, 1, 2, ... until it
589 This is called successively with state == 0, 1, 2, ... until it
@@ -6,8 +6,8 b''
6 ;; URL: http://ipython.scipy.org
6 ;; URL: http://ipython.scipy.org
7 ;; Compatibility: Emacs21, XEmacs21
7 ;; Compatibility: Emacs21, XEmacs21
8 ;; FIXME: #$@! INPUT RING
8 ;; FIXME: #$@! INPUT RING
9 (defconst ipython-version "$Revision: 2927 $"
9 (defconst ipython-version "0.11"
10 "VC version number.")
10 "Tied to IPython main version number.")
11
11
12 ;;; Commentary
12 ;;; Commentary
13 ;; This library makes all the functionality python-mode has when running with
13 ;; This library makes all the functionality python-mode has when running with
@@ -36,7 +36,7 b''
36 ;; always in ``pylab`` mode with hardcoded light-background colors, you can
36 ;; always in ``pylab`` mode with hardcoded light-background colors, you can
37 ;; use::
37 ;; use::
38 ;;
38 ;;
39 ;; (setq py-python-command-args '("-pylab" "-colors" "LightBG"))
39 ;; (setq py-python-command-args '("-pylab" "--colors" "LightBG"))
40 ;;
40 ;;
41 ;;
41 ;;
42 ;; NOTE: This mode is currently somewhat alpha and although I hope that it
42 ;; NOTE: This mode is currently somewhat alpha and although I hope that it
@@ -217,10 +217,10 b' the second for a \'normal\' command, and the third for a multiline command.")'
217 (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
217 (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
218 py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" )
218 py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" )
219 ;; select a suitable color-scheme
219 ;; select a suitable color-scheme
220 (unless (member "-colors" py-python-command-args)
220 (unless (member "--colors" py-python-command-args)
221 (setq py-python-command-args
221 (setq py-python-command-args
222 (nconc py-python-command-args
222 (nconc py-python-command-args
223 (list "-colors"
223 (list "--colors"
224 (cond
224 (cond
225 ((eq frame-background-mode 'dark)
225 ((eq frame-background-mode 'dark)
226 "Linux")
226 "Linux")
@@ -311,7 +311,7 b' gets converted to:'
311 (replace-match "" t nil)))))
311 (replace-match "" t nil)))))
312
312
313 (defvar ipython-completion-command-string
313 (defvar ipython-completion-command-string
314 "print(';'.join(__IP.Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n"
314 "print(';'.join(get_ipython().Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n"
315 "The string send to ipython to query for all possible completions")
315 "The string send to ipython to query for all possible completions")
316
316
317
317
@@ -347,11 +347,12 b' in the current *Python* session."'
347 (setq ugly-return (concat ugly-return string))
347 (setq ugly-return (concat ugly-return string))
348 (delete-region comint-last-output-start
348 (delete-region comint-last-output-start
349 (process-mark (get-buffer-process (current-buffer)))))))))
349 (process-mark (get-buffer-process (current-buffer)))))))))
350 ;(message (format "#DEBUG pattern: '%s'" pattern))
350 ;(message (format "#DEBUG pattern: '%s'" pattern))
351 (process-send-string python-process
351 (process-send-string python-process
352 (format ipython-completion-command-string pattern))
352 (format ipython-completion-command-string pattern))
353 (accept-process-output python-process)
353 (accept-process-output python-process)
354 ;(message (format "DEBUG return: %s" ugly-return))
354
355 ;(message (format "DEBUG return: %s" ugly-return))
355 (setq completions
356 (setq completions
356 (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
357 (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
357 (setq completion-table (loop for str in completions
358 (setq completion-table (loop for str in completions
General Comments 0
You need to be logged in to leave comments. Login now