From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Trying to get rid of completion-string in completion.el Date: Mon, 11 Apr 2011 13:56:43 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1302523060 1339 80.91.229.12 (11 Apr 2011 11:57:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2011 11:57:40 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 11 13:57:34 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9FkJ-0006wR-Qg for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 13:57:32 +0200 Original-Received: from localhost ([127.0.0.1]:54402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9FkH-0006im-Nh for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 07:57:29 -0400 Original-Received: from [140.186.70.92] (port=50908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9FkD-0006hF-4w for emacs-devel@gnu.org; Mon, 11 Apr 2011 07:57:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9FkB-0002Nv-Sn for emacs-devel@gnu.org; Mon, 11 Apr 2011 07:57:24 -0400 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:63922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9FkB-0002Nk-QG for emacs-devel@gnu.org; Mon, 11 Apr 2011 07:57:23 -0400 Original-Received: by gyd8 with SMTP id 8so2681736gyd.0 for ; Mon, 11 Apr 2011 04:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=EbAOZmOy+kYRodJ9l6R7px1Y4yAdPrWPAXxtXv0RTLY=; b=lf8PGmnkdL24Jhw5OddJylncMdzhYCYADfFX+OEbMH0g6x88fo5XXLx5tZ2olqUJ4c P+A5BpklFpZ4nATzQyFeld/NMnKZGN54tZZnH8Ew/SZykcdA7aysAsd6NtMhGlfsPUJ3 JEK45nBfSDK1sdv7/nbDfWh7tJUh30QehtAx8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=opssd4ZObxNcQiGU2iDa30GwJ1SNibUdUIWsWcefSjqHZAJ3buGpaqwM5gFqw/5Z1P TE49tohSKeGDgat9vXZV8PNpk4bo2Y9ZtAyCSLrJe8Vpn9ufUmUGZWDXLOr399RXzda4 ODMGyt4YNIY+1kggD3nDfgg9l7vd+jhYJ5Ckw= Original-Received: by 10.236.187.97 with SMTP id x61mr5918466yhm.476.1302523043225; Mon, 11 Apr 2011 04:57:23 -0700 (PDT) Original-Received: by 10.147.182.17 with HTTP; Mon, 11 Apr 2011 04:56:43 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138384 Archived-At: This question is for people with experience in completion.el. While trying to compile completion.el under lexical-binding, I came across the dynamic variable completion-string, which is shadowed by the COMPLETION-STRING parameter of a couple of functions (`add-completion-to-head' and `delete-completion', to be precise). AFAICS all references to the completion-string variable through completion.el are really references to the parameters, not to the dynamic variable, except this clause of `cond' in `locate-completion-entry': (cmpl-db-debug-p ;; not found, error if debug mode (error "Completion entry exists but not on prefix list - %s" completion-string)) which is the only place where the dynamic binding comes into effect. Now, as locate-completion-entry is only called from places where completion-string comes from a parameter COMPLETION-STRING (namely, the two functions mentioned above, and as a recursive call from locate-completion-entry-retry), that means that it would be possible to rename the dynamic variable and just let-bind it from inside the two relevant functions. Problem solved. The question is: perhaps it would be better to change that error call and get rid of the variable, if possible. The message talks about the completion entry and the prefix list, but it displays the completion string. I cannot really say that I understand what it is trying to tell the user. Isn't completion-entry or prefix-list what would be expected there? Comments? Juanma