From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#57499: Documentation bug in the docstring of set-face-attribute? Date: Thu, 01 Sep 2022 09:02:50 +0000 Message-ID: References: <534c9018d2adffda3e53@heytings.org> <831qswu0p4.fsf@gnu.org> <534c9018d2f372cd7462@heytings.org> <83tu5ssi35.fsf@gnu.org> <534c9018d222586a161c@heytings.org> <83r10wsgu8.fsf@gnu.org> <534c9018d2952b7a6bd0@heytings.org> <83pmggs89x.fsf@gnu.org> <534c9018d2597d4fd752@heytings.org> <83fshcrzth.fsf@gnu.org> <534c9018d2c911550778@heytings.org> <83czcgry5f.fsf@gnu.org> <534c9018d2f901e88b93@heytings.org> <837d2nshh7.fsf@gnu.org> <834jxrscu7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1919"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57499-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 01 11:43:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTgjI-0000Lm-OS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Sep 2022 11:43:20 +0200 Original-Received: from localhost ([::1]:48968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTgjH-0003he-Pn for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Sep 2022 05:43:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTg6L-0004Ca-24 for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 05:03:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTg6K-0005es-OZ for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 05:03:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTg6K-0008Qn-JD for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 05:03:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Sep 2022 09:03:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57499 X-GNU-PR-Package: emacs Original-Received: via spool by 57499-done@debbugs.gnu.org id=D57499.166202297532337 (code D ref 57499); Thu, 01 Sep 2022 09:03:04 +0000 Original-Received: (at 57499-done) by debbugs.gnu.org; 1 Sep 2022 09:02:55 +0000 Original-Received: from localhost ([127.0.0.1]:41203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTg6A-0008PV-PH for submit@debbugs.gnu.org; Thu, 01 Sep 2022 05:02:55 -0400 Original-Received: from heytings.org ([95.142.160.155]:49956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTg67-0008PK-E9 for 57499-done@debbugs.gnu.org; Thu, 01 Sep 2022 05:02:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1662022970; bh=UmP+aINPZD/WHPKjIgDgAT7DGQjfsm6h5v84hRwUWhg=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=pz088QbpEUsYt6DNTpFTWywDH2utC5vvzujZUatMnSRMwASUuo1y+ElZpB/49r75K r6VuoANopvbUfrRGbd3GSbm+dfHKItZ0cCHAIoYtljJ0AymJxShkvRsD0Aw28xEBMv U2kFqe/dJj+qyapFC238najwEVa/GhjnFfsGmVTCS0wgMuctaxK6XkXase/Ls76SSX Is6klyF42jGSbl8G7egd9CPnX/fyjByEM+DNmKjmBu0THrboQF7n1At5ud6gGnssp3 zaQ5NKDEoVFIhaHPfxRlMTyHhnb/w00owCkhRh6gkG1iLHm4Cq11bMmF3pVfsO8WCZ jZgWduDC1650w== In-Reply-To: <834jxrscu7.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241241 Archived-At: >> So this call is already included in the previous one. Why should we >> tell users to add such a redundant call in their code? > > The new text doesn't say the call with FRAME = t should be an additional > call. > It doesn't say so explicitly indeed, but without reading the code of set-face-attribute everyone understands that it should be an additional call. >> As far as I understand, the actual and real problem here is some users >> use nil when they should use 'unspecified, because they are not aware >> that nil and 'unspecified are subtly different. The subtle difference >> is that using nil works for frame = # ... #, but does >> not work with frame = t. > > That is a backward-compatibility feature that I don't want to mention in > the doc string. Lisp programs should only use valid values that are > documented in the doc string. > I wasn't suggesting to mention this. I was suggesting to add a mention that the symbol 'unspecified should be used for the value `unspecified', which might be clear to you and me but is evidently not clear for users. > > I've installed the last text I proposed, and I'm closing this bug with > that. > Would the patch below be okay? This would be another way to clarify the matter. diff --git a/src/xfaces.c b/src/xfaces.c index 70d5cbeb4c..2dfba51f74 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3390,6 +3390,8 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, } else if (EQ (attr, QCforeground)) { + if (NILP (value) && EQ (frame, Qt)) + signal_error ("Invalid foreground face attribute value", value); /* Compatibility with 20.x. */ if (NILP (value)) value = Qunspecified; @@ -3410,6 +3412,8 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, else if (EQ (attr, QCdistant_foreground)) { /* Compatibility with 20.x. */ + if (NILP (value) && EQ (frame, Qt)) + signal_error ("Invalid distant-foreground face attribute value", value); if (NILP (value)) value = Qunspecified; if (!UNSPECIFIEDP (value) @@ -3428,6 +3432,8 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, } else if (EQ (attr, QCbackground)) { + if (NILP (value) && EQ (frame, Qt)) + signal_error ("Invalid background face attribute value", value); /* Compatibility with 20.x. */ if (NILP (value)) value = Qunspecified;