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: default for read-face-name Date: Tue, 22 Jun 2010 18:31:38 -0700 Message-ID: <185018306ABA436BB6313CD88A023B70@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1277256784 31157 80.91.229.12 (23 Jun 2010 01:33:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 23 Jun 2010 01:33:04 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 23 03:33:03 2010 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 1OREpq-000289-9i for ged-emacs-devel@m.gmane.org; Wed, 23 Jun 2010 03:33:02 +0200 Original-Received: from localhost ([127.0.0.1]:45140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OREpp-0008Hy-5u for ged-emacs-devel@m.gmane.org; Tue, 22 Jun 2010 21:33:01 -0400 Original-Received: from [140.186.70.92] (port=43927 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OREpi-0008Hs-5W for emacs-devel@gnu.org; Tue, 22 Jun 2010 21:32:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OREpF-0005CU-3x for emacs-devel@gnu.org; Tue, 22 Jun 2010 21:32:54 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:28975) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OREpE-0005CJ-TB for emacs-devel@gnu.org; Tue, 22 Jun 2010 21:32:25 -0400 Original-Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o5N1WLbt026731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Jun 2010 01:32:23 GMT Original-Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5N1WKdv013025 for ; Wed, 23 Jun 2010 01:32:21 GMT Original-Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 348717871277256696; Tue, 22 Jun 2010 18:31:36 -0700 Original-Received: from dradamslap1 (/141.144.160.27) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Jun 2010 18:31:35 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcsSc9MD4XoaW6q0S2KALStizGzNSg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: rcsinet15.oracle.com [148.87.113.117] X-CT-RefId: str=0001.0A090209.4C216427.00C5:SCFMA4539811,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:126330 Archived-At: `read-face-name' accepts an optional arg STRING-DESCRIBING-DEFAULT, which is used only if (ahem) no real defaulting can be done (!) - a catch-all description such as "all faces" is passed and added to the prompt. Normally, however, default faces are picked up, from all of these sources (and then STRING-DESCRIBING-DEFAULT is ignored): 1. face symbols named at point (using thing-at-point) 2. a `read-face-name' text property on the char at point 3. a `face' text property on the char at point I think we should also let callers specify a default face to use: Change STRING-DESCRIBING-DEFAULT to DEFAULT, and give it precedence over the other ways of defaulting. If the calling code knows the best default, let it easily DTRT. We could add DEFAULT as an additional arg, but the current STRING-DESCRIBING-DEFAULT is pretty useless anyway, as the doc string suggests: "you can omit it". So I'd suggest just replacing it with a new DEFAULT arg. Reason for a DEFAULT arg: Sometimes a significant default face is known to the calling code, and it should be possible to specify it (pass it to the user). For example, if a face is saved somewhere as the current face to use for something, and the code calls `read-face-name' to let you enter a different face to override that, it can be helpful to provide the old face as the default, in order to: (a) show you what it is and (b) let you edit it to a similar face name (or confirm its use by hitting RET). The current design pretty much assumes that such a "current" face would in fact be used already at point, so the `face' property would pick it up. But that is not always the case - it is a bad assumption. And it seems silly to have to temporarily add a text property (`read-face-name') at point, just to be able to provide a proper default. That kind of thing can make sense for a static display such as `list-faces-display' but it is silly as a general way to pass a default value to the function. In sum, a read function deserves a default, and it is reasonable to be able to provide the default as an arg. The code change needed would be straightforward. And there seem to be only a couple of places in the existing source files where STRING-DESCRIBING-DEFAULT is used. My guess is that the change I'm suggesting would not have a negative impact. WDOT?