            (beg (save-excursion (skip-chars-backward "a-z0-9A-Z_./" (point-at-bol))
                                 (point)))
            (end (point))
+	   (line (buffer-substring-no-properties (point-at-bol) end))
            (pattern (buffer-substring-no-properties beg end))
            (completions nil)
            (completion-table nil)

      (setq completion (try-completion pattern completion-table))
      (cond ((eq completion t))
            ((null completion)
             (message "Can't find completion for \"%s\"" pattern)
             (ding))
            ((not (string= pattern completion))
             (delete-region beg end)
             (insert completion))
            (t
             (message "Making completion list...")

        (replace-match "" t nil)))))

(defvar ipython-completion-command-string
  "print(';'.join(get_ipython().complete('%s', '%s')[1])) #PYTHON-MODE SILENT\n"
  "The string send to ipython to query for all possible completions")


