From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org Date: Fri, 11 Feb 2011 18:08:39 -0500 Message-ID: References: <87r5bhysp6.fsf@keller.adm.naquadah.org> <878vxovsym.fsf@keller.adm.naquadah.org> <87k4h7ua23.fsf@member.fsf.org> <87vd0romky.fsf@keller.adm.naquadah.org> <87mxm2na63.fsf@member.fsf.org> <87vd0qfhu3.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297465747 26911 80.91.229.12 (11 Feb 2011 23:09:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 11 Feb 2011 23:09:07 +0000 (UTC) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 12 00:09:03 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 1Po26p-0002Ga-32 for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2011 00:09:03 +0100 Original-Received: from localhost ([127.0.0.1]:33875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Po26o-0000Vo-7z for ged-emacs-devel@m.gmane.org; Fri, 11 Feb 2011 18:09:02 -0500 Original-Received: from [140.186.70.92] (port=40940 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Po26h-0000Vh-On for emacs-devel@gnu.org; Fri, 11 Feb 2011 18:08:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Po26g-00036K-QQ for emacs-devel@gnu.org; Fri, 11 Feb 2011 18:08:55 -0500 Original-Received: from tomts36-srv.bellnexxia.net ([209.226.175.93]:37683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Po26g-000368-Ge; Fri, 11 Feb 2011 18:08:54 -0500 Original-Received: from toip3.srvr.bell.ca ([209.226.175.86]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20110211230841.TAXQ2196.tomts36-srv.bellnexxia.net@toip3.srvr.bell.ca>; Fri, 11 Feb 2011 18:08:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAIlKVU1GH/vA/2dsb2JhbAClfHO7IoVdBIUBikc Original-Received: from unknown (HELO ceviche.home) ([70.31.251.192]) by toip3.srvr.bell.ca with ESMTP; 11 Feb 2011 18:08:39 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 65655660C9; Fri, 11 Feb 2011 18:08:39 -0500 (EST) In-Reply-To: <87vd0qfhu3.fsf@member.fsf.org> (Tassilo Horn's message of "Fri, 11 Feb 2011 21:15:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 8 (1) X-Received-From: 209.226.175.93 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:135919 gmane.emacs.orgmode:37502 Archived-At: >>> So the question is: how can the completion-ignore-case value be >>> propagated from the completion gathering function in >>> `completion-at-point-functions' to the function that actually applies >>> this completion, without having to modify the global or buffer local >>> value of `completion-ignore-case'? >> >> Assuming you have a completion table in variable `table', you should >> be able to construct a new completion table that's case-insensitive >> with something like the untested code below: >> >> (defun completion-table-case-fold (table string pred action) >> (let ((completion-ignore-case t)) >> (complete-with-action action table string pred))) >> >> [...] >> (let ((newtable >> (apply-partially #'completion-table-case-fold table))) >> [...]) >> >> where completion-table-case-fold is an auxiliary function which >> (c|sh)ould be added to minibuffer.el. > Hm, why not simply add a property :ignore-case to the PROPS a function > in `completion-at-point-functions' may return in addition to the > existing :predicate and :annotation-function? Then > `completion-at-point' could simply bind `completion-ignore-case' > according to that property when calling `completion-in-region'. That could work as well, but it's more complexity in completion-at-point, compared to completion-table-case-fold which can be added without touching any existing code. Another reason why doing it inside the completion table is right is because of the comment I quoted: in your case, it is really a property of the completion table you return, rather than some user preference that's locally overridden. For more complex cases, there is also the issue of what to do when some parts of the completion are case-sensitive and other parts aren't (e.g. completion of case-sensitive envvars in case-insensitive file names), although this is less important for completion-at-point than for minibuffer completion since you don't have to return a table that covers the completion of the whole field (composed of file names and env-vars, for example), and instead you can just limit the completion to the particular subfield. Stefan