~a-roehler/python-mode/XEmacs-compat-test

« back to all changes in this revision

Viewing changes to python-mode.el

  • Committer: Andreas Roehler
  • Date: 2012-01-16 13:11:27 UTC
  • Revision ID: andreas.roehler@online.de-20120116131127-ain2yuke3rgzs19o
some progress with TAB completion in Ipython buffers, lp:916869

Thanks Fabián E. Gallina commenting at the issue
https://github.com/fgallina/python.el






Show diffs side-by-side

added added

removed removed

Lines of Context:
5053
5053
With optional \\[universal-argument] user is prompted
5054
5054
for options to pass to the IPython interpreter. "
5055
5055
  (interactive)
5056
 
  (let ((py-shell-name "ipython"))
 
5056
  (let* ((py-shell-name "ipython")
 
5057
         (ipython-version (string-to-number (substring (shell-command-to-string "ipython -V") 2 -1))))
 
5058
    (setq ipython-completion-command-string (if (< ipython-version 11) ipython0.10-completion-command-string ipython0.11-completion-command-string))
5057
5059
    (local-unset-key [tab])
5058
5060
    (define-key py-shell-map [tab] 'ipython-complete)
5059
5061
    (py-shell argprompt)))
8872
8874
;; see also
8873
8875
;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-01/msg00076.html
8874
8876
 
8875
 
(defvar ipython-completion-command-string
 
8877
(defvar ipython-completion-command-string nil
 
8878
  "Either ipython0.10-completion-command-string or ipython0.11-completion-command-string.
 
8879
 
 
8880
ipython0.11-completion-command-string also covers version 0.12")
 
8881
;; (make-variable-buffer-local 'ipython-completion-command-string)
 
8882
 
 
8883
(defvar ipython0.10-completion-command-string
 
8884
  "print(';'.join(__IP.Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n"
 
8885
  "The string send to ipython to query for all possible completions")
 
8886
 
 
8887
;; (setq ipython0.10-completion-command-string "print(';'.join(__IP.Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n")
 
8888
 
 
8889
(defvar ipython0.11-completion-command-string
8876
8890
  "print(';'.join(get_ipython().Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n"
8877
8891
  "The string send to ipython to query for all possible completions")
8878
8892
 
8879
 
(setq ipython-completion-command-string                                   "print(';'.join(__IP.Completer.all_completions('%s'))) #PYTHON-MODE SILENT\n")
8880
 
 
8881
8893
(defun ipython-complete ()
8882
8894
  "Complete the python symbol before point.
8883
8895