[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager f

From: Stefan Monnier
Subject: Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
Date: Fri, 11 Feb 2011 18:08:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]