From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Sun, 09 Nov 2008 21:11:30 -0800 Subject: [sup-talk] [PATCH] show matching aliases before email addresses in auto complete In-Reply-To: <1226091602-sup-7664@sgoldmanlinux.tower-research.com> References: <1226091602-sup-7664@sgoldmanlinux.tower-research.com> Message-ID: <1226293522-sup-862@entry> Hi Steve, Thanks for the patch! A couple comments: Reformatted excerpts from Steve Goldman's message of 2008-11-07: > Suppose I have an alias "william" for "William Morgan > ". It might be nice to put this helpful explanatory text in the commit message itself, so that it gets recorded along with the patch. > + sort { |x,y| x_is_c = ContactManager.contact_for(x); y_is_c > = ContactManager.contact_for(y); x_is_c && !y_is_c ? -1 : !x_is_c && y_is_c ? 1 I think you can express this more succinctly with something like sort_by { |c| [ContactManager.contact_for(c) ? 1 : 0, c] } which makes use of both sort_by (Ruby's answer to the Schwartizan transform) and the fact that arrays are sorted element-by-element. Other than that, looks good and I like the idea. -- William