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: RE: read-face-name PROMPT arg should be self-contained, including ": " Date: Sat, 17 Mar 2007 12:13:27 -0700 Message-ID: References: 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 1174158973 18527 80.91.229.12 (17 Mar 2007 19:16:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 17 Mar 2007 19:16:13 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 17 20:16:04 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 1HSeNo-00046O-7S for ged-emacs-devel@m.gmane.org; Sat, 17 Mar 2007 20:16:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HSeP4-0006Ci-7r for ged-emacs-devel@m.gmane.org; Sat, 17 Mar 2007 14:17:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HSeOZ-00060z-DZ for emacs-devel@gnu.org; Sat, 17 Mar 2007 15:16:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HSeOY-00060f-O3 for emacs-devel@gnu.org; Sat, 17 Mar 2007 15:16:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HSeOY-00060c-Jf for emacs-devel@gnu.org; Sat, 17 Mar 2007 14:16:50 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HSeNI-00045a-6V for emacs-devel@gnu.org; Sat, 17 Mar 2007 15:15:32 -0400 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l2HJFSBL013754 for ; Sat, 17 Mar 2007 13:15:28 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l2HJ9Ol1029509 for ; Sat, 17 Mar 2007 13:15:28 -0600 Original-Received: from 141.144.73.0 by acsmt351.oracle.com with ESMTP id 2540222211174158815; Sat, 17 Mar 2007 12:13:35 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 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:68028 Archived-At: `read-face-name' still blindly appends ": " to the prompt it is supplied. This means that it doesn't conform to what other functions, such as `completing-read' do. It also means that code that is intended to work with Emacs 20 as well must have two separate calls to `read-face-name', just to work around the change in prompt behavior, one with a prompt arg that includes the ": " and one with a prompt arg that doesn't include it. Can we please change this exceptional prompt treatment of `read-face-name', to make it compatible with `completing-read' behavior and with the previous `read-face-name' behavior? Nothing important is gained by having the function tweak the prompt blindly this way. Please let user code decide what prompt to use, rather than having `read-file-name' try to second-guess what prompt is needed. If it is insisted that `read-file-name' try to be smart this way, then at least have it check the prompt arg to first strip any trailing ": ", before it appends ": ". That will let most programs that use it work with any Emacs version. Something as simple as this, for example: (when (string-match ": $" prompt) (setq prompt (substring prompt 0 -2))) (It would still be better to let user programs control the prompt, with no second-guessing.) P.S. I suggest this for Emacs, not for myself. I've already redefined `read-face-name' in my own code to undo this prompt intelligence. > From: Drew Adams Sent: Tuesday, January 23, 2007 10:32 AM > To: Emacs-Pretest-Bug > > emacs -Q > > `read-face-name' has changed the meaning and behavior of its PROMPT > arg since Emacs 20, and it is now unconventional, conflicting with > standard Emacs treatment of PROMPT args. It should not append ": ". > Instead, calling functions should do that themselves as they deem > appropriate. > > This change was made in Emacs 21, but it is not a good change. It is > presumably an attempt to be smart, but it reduces flexibility for > calling functions. `read-face-name' should treat its PROMPT arg the > same way that other Emacs prompting functions, such as > `completing-read', treat their PROMPT args. ... > There is at least one other function that is [also] non-standard wrt > tacking on ": " instead of expecting the PROMPT arg to include it if > needed: `bookmark-completing-read'. This problem should be fixed for > `bookmark-completing-read' also. It's better to leave ": " to the > calling function.