From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: display-completion-list should not strip text properties Date: Mon, 22 Jan 2007 09:23:10 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1169486637 30910 80.91.229.12 (22 Jan 2007 17:23:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Jan 2007 17:23:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 22 18:23:55 2007 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.50) id 1H92tU-0003a8-5m for ged-emacs-devel@m.gmane.org; Mon, 22 Jan 2007 18:23:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H92tT-000114-Lg for ged-emacs-devel@m.gmane.org; Mon, 22 Jan 2007 12:23:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H92tF-0000z6-Kf for emacs-devel@gnu.org; Mon, 22 Jan 2007 12:23:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H92tE-0000ya-Qh for emacs-devel@gnu.org; Mon, 22 Jan 2007 12:23:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H92tE-0000yX-MR for emacs-devel@gnu.org; Mon, 22 Jan 2007 12:23:28 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H92tE-0007vG-2i for emacs-devel@gnu.org; Mon, 22 Jan 2007 12:23:28 -0500 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l0MHNOUN007111 for ; Mon, 22 Jan 2007 11:23:25 -0600 Original-Received: from rcsmt250.oracle.com (rcsmt250.oracle.com [148.87.90.195]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l0MEuHLv011478 for ; Mon, 22 Jan 2007 10:23:24 -0700 Original-Received: from dhcp-4op11-4op12-west-130-35-178-179.us.oracle.com by rcsmt250.oracle.com with ESMTP id 2386712201169486591; Mon, 22 Jan 2007 10:23:11 -0700 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Importance: Normal X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= 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:65381 Archived-At: You might want to consider this as a bug, albeit an old one. If not, you might want to consider it for TODO after the release. I mention it now in hopes of the former. It calls for a trivial code change. `display-completion-list' uses `princ', not `insert', which effectively strips all text properties from the completions it is passed. It has probably always done so, but it should no longer do so, IMO. The other functions involved in completing (`all-completions', `try-completions', etc.) already DTRT in this regard. A `princ'-to-`insert' substitution in `display-completion-list' is the only change needed to allow faces and other text properties in buffer *Completions*. Users could then pass propertized strings to, for example, `completing-read' and have them displayed as defined. For my own purposes, I transcribed the C-code definition of `display-completion-list' into Lisp and then substituted `insert' for `princ'. Here is one use of this feature (or bug fix): http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Text_Properties_in_Completio ns. This example uses faces, but other text properties (e.g. `help-echo', `keymap', `display', `invisible') could also be usefully applied to individual completions for various purposes. I also wonder why `display-completion-list' is coded in C, not Lisp. The Lisp version is straightforward, and it doesn't seem slow. I don't think this code is critical in terms of time, anyway. Coding this in Lisp would give users (programmers) more flexibility. Also, I haven't yet done so for my own Lisp version, but I think that the measures 35 and 45 for the column width, which are currently hard-coded, could usefully be made into either parameters to the function or global variables. Different uses of a completion display might call for different column widths, and I see no reason to hard-code this choice.