From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrHOvM6vzrTOsc+C?= Newsgroups: gmane.emacs.devel Subject: Re: Recent read-face patch breaks `M-x customize-face' Date: Sat, 06 Apr 2013 17:50:46 +0200 Message-ID: <87obdr1wvd.fsf@kobe.laptop> References: <20130405175032.GA29138@saturn> <20831.7759.573008.165973@gargle.gargle.HOWL> <20832.3369.138812.620060@gargle.gargle.HOWL> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365278436 27177 80.91.229.3 (6 Apr 2013 20:00:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Apr 2013 20:00:36 +0000 (UTC) Cc: Roland Winkler , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 06 22:00:34 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UOZHg-0007UX-NU for ged-emacs-devel@m.gmane.org; Sat, 06 Apr 2013 22:00:20 +0200 Original-Received: from localhost ([::1]:53953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOVOU-0001FF-Fr for ged-emacs-devel@m.gmane.org; Sat, 06 Apr 2013 11:51:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOVOK-0001E6-L3 for emacs-devel@gnu.org; Sat, 06 Apr 2013 11:51:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UOVOG-0006OS-Gk for emacs-devel@gnu.org; Sat, 06 Apr 2013 11:50:56 -0400 Original-Received: from mail-ee0-f50.google.com ([74.125.83.50]:48882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOVOG-0006ON-9f; Sat, 06 Apr 2013 11:50:52 -0400 Original-Received: by mail-ee0-f50.google.com with SMTP id e53so1759035eek.37 for ; Sat, 06 Apr 2013 08:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=R7FdKsygSMfqgp77VufNjaIoNWQMwVvHgd9mZKqILUo=; b=qV72WTCQX/sqFDevMB4opnxISafXIm/MbhmuTSSSE2e0urstcusOFI9jj3gV+RfRWg 3vT45EXd501cEL0RxYCPX2swxtTgaGmOI/y3d2T6Q3vx4nPnqk0UFaCy/xX2l3IAg5we uiJlDXy0WvLf5w9v6u/ma4r3FrdbP/JYYgkz7U/MQeADRhZHPUo5M5kcf9C9eQ/l9rZ1 5qFeNc2axb+oygfSMmGlhjGnmoVCnj0GHcTfH9SQCIH3cd0CAt2vWoISWC4eNWD/l28r XI9ObMuUT17dY/DewCh6MZZQVaW1I/FP6Ymdsgenebj30JTYK/nEO330NGE4A4w8zBpN VUIA== X-Received: by 10.15.111.202 with SMTP id cj50mr30565511eeb.6.1365263451334; Sat, 06 Apr 2013 08:50:51 -0700 (PDT) Original-Received: from saturn.gmail.com (217-162-217-29.dynamic.hispeed.ch. [217.162.217.29]) by mx.google.com with ESMTPS id s3sm21588541eem.4.2013.04.06.08.50.49 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 06 Apr 2013 08:50:50 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 06 Apr 2013 10:02:52 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.83.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158689 Archived-At: On Sat, 06 Apr 2013 10:02:52 -0400, Stefan Monnier wrote: >>> It would be safer to simply turn any non-list value of `default' into >>> a one-element list. >> Makes sense. Yet the problem here is that customize-face calls >> read-face-name with DEFAULT having the bogus value "all faces". >> So customize-face should still be fixed. > > Just for the record: the reason for this "all faces" argument is so that > M-x customize-face prompts with "Customize face (default `all faces'):" Ah, that's where that message came from! I see now that no message about (default `xxx') is displayed at the M-x prompt. Maybe we have to change read-face-name a bit. Right now the doc string of read-face-name says things in two places that when combined together seem to imply that what customize-face expects is ok: (read-face-name PROMPT &optional DEFAULT MULTIPLE) Read one or more face names, defaulting to the face(s) at point. PROMPT should be a prompt string; it should not end in a space or a colon. : The optional argument DEFAULT specifies the default face name(s) : to return if the user just types RET. If its value is non-nil, : it should be a list of face names (symbols or strings); in that case, : the default return value is the `car' of DEFAULT (if the argument : MULTIPLE is non-nil), or DEFAULT (if MULTIPLE is nil). See below : for the meaning of MULTIPLE. If DEFAULT is nil, the list of default face names is taken from the symbol at point and the `read-face-name' property of the text at point, or, if that is nil, from the `face' property of the text at point. This function uses `completing-read-multiple' with "[ \t]*,[ \t]*" as the separator regexp. Thus, the user may enter multiple face : names, separated by commas. The optional argument MULTIPLE : specifies the form of the return value. If MULTIPLE is non-nil, : return a list of face names; if the user entered just one face : name, the return value would be a list of one face name. : Otherwise, return a single face name; if the user entered more : than one face name, return only the first one. If we read together the two marked parts they seem to translate to what customize-face expects, that when DEFAULT is nil and, at the same time, MULTIPLE is non-nil, a list of all faces is returned. What `read-face-name' does when DEFAULT is non-nil makes, of course, sense: display the current value of DEFAULT in the prompt. But maybe we should change it to also work correctly if MULTIPLE is non-nil and DEFAULT is not the name of a symbol. What was failing was this part of `read-face-name': : ;; If we only want one, and the default is more than one, : ;; discard the unwanted ones now. : (if (and default (not multiple)) : (setq default (list (car default)))) : : (if default : (setq default (mapconcat (lambda (f) : (if (symbolp f) (symbol-name f) f)) : default ", "))) Maybe we just need to account for the case of: (if (and multiple default (not (symbolp default)) (not (consp default))) just-use-default-value-as-prompt) Because what happened here was that `default' was passed as "all faces", and mapconcat happily tried to filter the string through the lambda function, resulting in a list of character values, resulting in a call like this: (mapconcat (lambda (x) x) (list 97 108 108 32 102 97 99 101 115) ", ") Which of course throws a traceback, when mapconcat tries to look at the character value `97' as a sequence to concatenate it with the rest.