From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Vitalie Spinu <spinuvit@gmail.com>
Newsgroups: gmane.emacs.devel
Subject: Re: Completion with (:exclusive 'no) is called twice,
	and doesn't pass over on sole completion.
Date: Fri, 16 Mar 2012 13:18:55 +0100
Organization: EUR
Message-ID: <87bonwyc0g.fsf@gmail.com>
References: <87haxoyff9.fsf@gmail.com>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: dough.gmane.org 1331900372 9245 80.91.229.3 (16 Mar 2012 12:19:32 GMT)
X-Complaints-To: usenet@dough.gmane.org
NNTP-Posting-Date: Fri, 16 Mar 2012 12:19:32 +0000 (UTC)
To: emacs-devel@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 16 13:19:31 2012
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1S8W7w-0005IB-NK
	for ged-emacs-devel@m.gmane.org; Fri, 16 Mar 2012 13:19:24 +0100
Original-Received: from localhost ([::1]:45361 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1S8W7w-0003aw-0j
	for ged-emacs-devel@m.gmane.org; Fri, 16 Mar 2012 08:19:24 -0400
Original-Received: from eggs.gnu.org ([208.118.235.92]:39470)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ged-emacs-devel@m.gmane.org>) id 1S8W7o-0003Yc-6M
	for emacs-devel@gnu.org; Fri, 16 Mar 2012 08:19:21 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ged-emacs-devel@m.gmane.org>) id 1S8W7h-0002Op-Ut
	for emacs-devel@gnu.org; Fri, 16 Mar 2012 08:19:15 -0400
Original-Received: from plane.gmane.org ([80.91.229.3]:37796)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ged-emacs-devel@m.gmane.org>) id 1S8W7h-0002Og-OP
	for emacs-devel@gnu.org; Fri, 16 Mar 2012 08:19:09 -0400
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <ged-emacs-devel@m.gmane.org>) id 1S8W7f-00051D-UT
	for emacs-devel@gnu.org; Fri, 16 Mar 2012 13:19:07 +0100
Original-Received: from e138158.upc-e.chello.nl ([213.93.138.158])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <emacs-devel@gnu.org>; Fri, 16 Mar 2012 13:19:07 +0100
Original-Received: from spinuvit by e138158.upc-e.chello.nl with local (Gmexim 0.1
	(Debian)) id 1AlnuQ-0007hv-00
	for <emacs-devel@gnu.org>; Fri, 16 Mar 2012 13:19:07 +0100
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 47
Original-X-Complaints-To: usenet@dough.gmane.org
X-Gmane-NNTP-Posting-Host: e138158.upc-e.chello.nl
User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.94 (gnu/linux)
Cancel-Lock: sha1:3neroVKWNOWoXxWzkyAFX0q4WJY=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 80.91.229.3
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:149097
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/149097>

>>>> Vitalie Spinu <spinuvit@gmail.com>
>>>> on Fri, 16 Mar 2012 12:05:14 +0100 wrote:

  > Hi,

  > The completion in emacs 24 is called twice. For example

  > (defun foo-completion ()
  >   (when (save-excursion (re-search-backward "\\<\\w*" (point-at-bol) t))
  >     (let ((token (match-string-no-properties 0))
  > 	  (beg (match-beginning 0))
  > 	  (end (match-end 0)))
  >       (message "%s:" token)
  >       (when (= end (point))
  > 	(list beg end (list "aaaa" "aaaaaaa" "bbbb" "truncat") :exclusive 'no)))))

  > (add-to-list 'completion-at-point-functions 'foo-completion)
  > ;; it is now (foo-completion lisp-completion-at-point t)

  > Place your point at the end of 'aaaa and you try to complete. I am
  > getting

  > aaa:
  > aaaa:

  > in my message buffer. Which means the completion is called twice. I hope
  > this is not an intended behavior, as it might seriously interfere with
  > custom completion. For example I might want to have a different behavior
  > on the second consequent invocation of the completion (give a message,
  > modify the candidates etc).

A related issue. Position after 'aaaa, try to complete. You will get a
"Sole completion" message. Press "space" or "M-b", or whatever, you will
get a message "aaaa:" which means that completion is repeated after any
other command. This is really bad, as my completion is calling an
external process and stalls emacs for a second, badly interfering with
the editing.

  > Second problem is that if the completion is sole, the handling is not
  > passed over. For example after 'truncat I am getting a message "Sole
  > completion" and the lisp-completion-at-point is not reached at all. I
  > believe it's not how it should work.

  > In all the rest, new completion system is virtually perfect, thanks.

  > Vitalie.