all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#10546: completion-at-point bug
@ 2012-01-18 18:50 Andreas Röhler
  2012-01-18 21:22 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2012-01-18 18:50 UTC (permalink / raw)
  To: 10546

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

Hi,

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.

;;;;;;;;;
bug pertains to Emacs-23 and 24
patch attached

thanks all,

Andreas

[-- Attachment #2: completion-at-point.patch --]
[-- Type: text/x-patch, Size: 1091 bytes --]

--- emacs-23.3.90/lisp/minibuffer.el	2012-01-11 13:35:01.000000000 +0100
+++ minibuffer.el	2012-01-18 18:57:37.561110910 +0100
@@ -1198,15 +1198,16 @@
               'completion-at-point-functions)))
     (cond
      ((functionp res) (funcall res))
-     (res
-      (let* ((plist (nthcdr 3 res))
-             (start (nth 0 res))
-             (end (nth 1 res))
-             (completion-annotate-function
-              (or (plist-get plist :annotation-function)
-                  completion-annotate-function)))
-        (completion-in-region start end (nth 2 res)
-                              (plist-get plist :predicate)))))))
+     (unless (numberp res)
+       (res
+        (let* ((plist (nthcdr 3 res))
+               (start (nth 0 res))
+               (end (nth 1 res))
+               (completion-annotate-function
+                (or (plist-get plist :annotation-function)
+                    completion-annotate-function)))
+          (completion-in-region start end (nth 2 res)
+                                (plist-get plist :predicate))))))))
 
 ;;; Key bindings.
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10546: completion-at-point bug
  2012-01-18 18:50 bug#10546: completion-at-point bug Andreas Röhler
@ 2012-01-18 21:22 ` Stefan Monnier
  2012-01-22 14:10   ` Andreas Röhler
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-01-18 21:22 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 10546

> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10546: completion-at-point bug
  2012-01-18 21:22 ` Stefan Monnier
@ 2012-01-22 14:10   ` Andreas Röhler
  2012-01-22 21:22     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2012-01-22 14:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 10546

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/






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10546: completion-at-point bug
  2012-01-22 14:10   ` Andreas Röhler
@ 2012-01-22 21:22     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-01-22 21:22 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 10546

> 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.

That's because python-mode.AL has a bug:

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

The doc of completion-at-point-functions says:

  Each function on this hook is called in turn without any argument and should
  return either nil to mean that it is not applicable at point,
  or a function of no argument to perform completion (discouraged),
  or a list of the form (START END COLLECTION &rest PROPS) where
   START and END delimit the entity to complete and should include point,
   COLLECTION is the completion table to use to complete it, and
   PROPS is a property list for additional information.
            

-- Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-22 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 18:50 bug#10546: completion-at-point bug Andreas Röhler
2012-01-18 21:22 ` Stefan Monnier
2012-01-22 14:10   ` Andreas Röhler
2012-01-22 21:22     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.