Subject: bug#10546: completion-at-point bug

From: Andreas Röhler <[email-masked]>
Date: Sun, 22 Jan 2012 15:10:18 +0100

Am 18.01.2012 22:22, schrieb Stefan Monnier:
>> get wrong error messages like
>
>> let*: Wrong type argument: listp, 16
>
>> from `completion-at-point' in cases `tab-to-tab-stop'
>> sends back a number - the column reached.
>
> Can you give us the context: what did you do in order for
> completion-at-point to call tab-to-tab-stop?
>
>
>          Stefan
>

Hi Stefan,

bug seen from forms in python-mode.el
http://launchpad.net/python-mode

when `py-completion-at-point' doesn't see a completion,
the feature is to insert a TAB then.

In result a number is returned by `tab-to-tab-stop',
which seems to confuse `completion-at-point', sending
the wrong error message.

(defun py-completion-at-point ()
   (interactive "*")
   (let* ((start (when (skip-chars-backward "[[:alnum:]_]")(point)))
          (end (progn (skip-chars-forward "[[:alnum:]_]")(point)))
          (completion (when start
                        (python-symbol-completions 
(buffer-substring-no-properties start end)))))
     (if completion
         (progn
           (delete-region start end)
           (insert (car completion)))
       (tab-to-tab-stop))))

;;;;;;;;;

`py-completion-at-point' is called by a var `py-complete-function', 
whilst `python-mode' runs

   (add-hook 'completion-at-point-functions
             py-complete-function nil 'local)

So far,

thanks developing our tool-of-pleasure :)

Andreas

--
http://launchpad.net/python-mode
http://launchpad.net/s-x-emacs-werkstatt/