From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#51469: [External] : Re: bug#51469: 27.2; Mismatch: `set-face-attribute' and `face-all-attributes' Date: Fri, 29 Oct 2021 18:01:26 +0000 Message-ID: References: <87h7d0ynxz.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6894"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "51469@debbugs.gnu.org" <51469@debbugs.gnu.org> To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 29 20:03:32 2021 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 1mgWE0-0001bD-7f for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Oct 2021 20:03:32 +0200 Original-Received: from localhost ([::1]:45920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgWDy-00083f-44 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Oct 2021 14:03:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgWCZ-00073R-4G for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 14:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgWCY-0000fC-FX for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 14:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mgWCY-0005z3-D3 for bug-gnu-emacs@gnu.org; Fri, 29 Oct 2021 14:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Oct 2021 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51469 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 51469-submit@debbugs.gnu.org id=B51469.163553049422952 (code B ref 51469); Fri, 29 Oct 2021 18:02:02 +0000 Original-Received: (at 51469) by debbugs.gnu.org; 29 Oct 2021 18:01:34 +0000 Original-Received: from localhost ([127.0.0.1]:55845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgWC6-0005y8-84 for submit@debbugs.gnu.org; Fri, 29 Oct 2021 14:01:34 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:4010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgWC2-0005xx-Jc for 51469@debbugs.gnu.org; Fri, 29 Oct 2021 14:01:32 -0400 Original-Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19THHN3C004532; Fri, 29 Oct 2021 18:01:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=i7RyNxXJJfyukQBKmKxM8W1z3OjanGbAfQ68Mb82mKU=; b=Vl1c5IrPzdYXRtIxwV9THBwc3WoxNaLAytqlca1rJJy6Vn3RkEu96HeW91xqb8/lz9sE RF3rYZe3QtqtIgf0o8VFV3fqaYXno+dbV/JgJAT6uJouHbCeiun8+MYQ7mmoD3gmKy+i iecgAY4tZ3zPQidrfvfKBkRsuOJV1g90wVXvH6Ae85HtF4Dt+I0Rb1IIZtsaJ6v2mFOa 6VhtyH+5TSr3Uhykd+xN4EytOgrlrTYuQ2WsNEBDJHLaD1qRjKk5RnvtsN8is3IwOP/4 yffHXCJ426f/JMipnEAENL7IEbkuXWPJkQiZZNW/Xw6d8+bTUhE1p4/qqc6HGEdpj06w /g== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3byja2hevk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Oct 2021 18:01:29 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 19THpfGK051329; Fri, 29 Oct 2021 18:01:28 GMT Original-Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by aserp3020.oracle.com with ESMTP id 3bx4gg93jb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Oct 2021 18:01:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GO+GH3QxgcWWTfG2zngDIrmWsFokfAh+MPrjxZRilYd9N/Wn5u9NfXf7LA4s3NgjbgOSdz6SFn4PPZ8/qAQGMDM+ECPE4E0hn6/3/NNUNxXJ4usix19jomdou/Ym582x6q+pW8fwqBofDUXhauJRUsaES8W4rEINRb8XV8Qk6O4w6yTaJTDCuQ5NROFp4i2gr0Shh8Zs/keB1z4AfDkbOBTpjo9V8E0xy/DXI0oqprakThxxZ9Zp0jCZ5SccI2EI0mSiOsZt/TNFq7MGdjXbLLRHPnShI9nNENo5ANicLhbTkYEcUH582cx3vI/5ZvMR+6lsjHwQjs3uPh4H0CkUTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i7RyNxXJJfyukQBKmKxM8W1z3OjanGbAfQ68Mb82mKU=; b=YaRYRmDokdlZtgkK/TRwk9+RkDcZp0RhDeTMZS8YTyyzwSWJSjyrk8bw47J04Sv6gtIzMmAlJ0Tv8CjdT5WdBXf/ExpxMucz+F7D6y4v3TYxqyQKVz4J9aQ2b6ffG1oD2KwhLU+bi+2yCUVOHdvS2QR2ap3ZZxrdHPr7Nu/6xvN2n4mcG5yDNfwR7hf2NB7P9CTiy8Ohk0JoNqrqvuD4Qq49d3afOsW3lVjmPvL3yUiJJT68IsOiC8dmA2/xTzeAewlv5ijJmErcoGsD5wW/NpZNWXvMSjqDy0gtsXQVIQnB6tJN9Gd/6IIQ/wdLSKzSFLa9dGdmq9Cf+3CZKevIyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i7RyNxXJJfyukQBKmKxM8W1z3OjanGbAfQ68Mb82mKU=; b=LsgCwqQQmawPzseUm/cb0HwkEd05KT19XeLUrexSNHet+e5TN+LNhOUTgSyqA6V5qRjpPLS6U3F9VslTOSU0+3Yx9J6ZtI/xjTji2IdxPAkjh866Jtbz71qB9lF0Z06SQvDpfzXVgTEJ9rKTUiXp2os7GGupK6e/LNTbaINqEkM= Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com (2603:10b6:5:355::21) by MWHPR1001MB2287.namprd10.prod.outlook.com (2603:10b6:301:31::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Fri, 29 Oct 2021 18:01:26 +0000 Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::d0fa:fa4b:7c65:ddd6]) by CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::d0fa:fa4b:7c65:ddd6%6]) with mapi id 15.20.4649.015; Fri, 29 Oct 2021 18:01:26 +0000 Thread-Topic: [External] : Re: bug#51469: 27.2; Mismatch: `set-face-attribute' and `face-all-attributes' Thread-Index: AdfMT9s6eNjzRjfmSr6dxm5NMTOY6wAdtKkxAAimImA= In-Reply-To: <87h7d0ynxz.fsf@gnus.org> Accept-Language: en-US Content-Language: en-US authentication-results: gnus.org; dkim=none (message not signed) header.d=none;gnus.org; dmarc=none action=none header.from=oracle.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 504f0484-e225-4661-7464-08d99b062057 x-ms-traffictypediagnostic: MWHPR1001MB2287: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tfaV3mLMXMgsoS4M9HO0Yc+b+uQUWXQ7V2VYKC22OFZhgIeawreHHMZ/z6YA3ZYR6T5MASnANnOtaauDweek9aaQ81mWEIFLrSZcYZMmDV3Qz3J0YNKKcwHr91PrI8y6mZHlc9wJlKc6nh1Pt/gn5jSPGXiXVg290K6KtMMNtJXEhf/odiQgGUs2iZJGNnnKfOpBf24J0/zZqXE4UUgrbSYKc6UGT4yHvdpVTQLakIl6C2f/q/BLdQE2Y7f1TJfGOFiR5tdl76Mgb+2tX3jMou+wtO106iXlsttHt3yWURb/GHoUiU8DJ/O4lp6RsDYaNIoEiVKGcbSDzhkXMnEaR33q+i7QphiveDXkVvLVJBt/3pn8PJsQK9Zj/DD8fLcBR8e2x1q5HhZ46GXFLyGF9Ndxhl/3u3PyYITdUl7a44P+DkSjpUQHWh1OQPtt2xwhac1SYer04v+bCG/kD7K6S0jLyITIONeZqb/NAaqh+7kZVkuUEY0qGnkfRZa0JGxegBjs26Ei72blFDXn6fWiUqdGP71tLfDZCGFEejibj0UyP7LKUUtKxL8R5LD98tjtEA1/xCTuFAMBDPSs6/lrCsEj+YlNafReb0Z0kdS5mdOZwfem6VbD02QCsLXoXCCE9Kh/fYt0AhfwUaZRh3m1r7F7NDDL13bQuQdCKxYQD3IB2BVRNrmRBqXOhY2RXFwqIEtbhEC9m9Vwh8DRkHKC9SJhdDvcDv4qROVJ1m9h9+M= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5473.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(33656002)(66476007)(6506007)(7696005)(52536014)(44832011)(66556008)(38100700002)(8936002)(83380400001)(8676002)(4326008)(186003)(86362001)(5660300002)(122000001)(508600001)(71200400001)(2906002)(38070700005)(316002)(6916009)(55016002)(9686003)(64756008)(66946007)(66446008)(26005)(76116006)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: /RKbB1CBq45HBNYZP+qEZT9J5L1YCjDuQc8kl44uTUHzZbFfsj5HBshLe/rRF9cMdtlOARmKqIR+NHNHtwYbaZ2Ez1ACjOyUlnA95RoARRwtm41c0ZsdVYmNy9VtWrCIAUYBDBBBwA6UpZlm5Ljv/8WoWa62r/d/8xT1k5OZz1GJkLbybthR+j1iZwjWC7a74cAMscY7KIBYmlmPzZCqOO6KEpq3xOXLQo6FDlIgb0iwFEIjhFUthHfoOYw9XGV0lDjVtX34NOYvnjyQu1nOIIEEoCirjMtRGXlF5AtT5zybDAk5XyCcdRxwrtoqf+knPujBwOzlj2APNJD4AN/zmE2NpZqqRCE7mvqjV6MMnKjlTP74YCknhh1SAJL6CNCZpQK1eZCCFVeFDxpvFm8dAAWNaMg1eHe+cR/y2m4Wh4IdLTwTG6UHcRShdIlgWO+D9V5W9AIO3zzjv8OTZ55vSOU5fjHrAUaoWJKw4NmZ8W+UQP3oOvnIz1okOO7qsXGsiwjGTL1sjgq9Mv1PHqItv1OHfjaySKEeV2W+tj67qUUcw/VKZgsK5LJclq/65jdOiVOY5u06qUjTQfG+Fgb0scvbZOLGdw6Fvc6MbV6P0gEPKC+KYmjlUg42CHLS7m9K/Vo4hCUQzJqLnXDaJCcRlPaTjvqZ0SgIcDb34oEMnXcVUbCjiMMdspsG5Jl+Y7OPhuYv347A3DwqKskOU1+KXbB+fz73STFKiK6YNfJRAWwBDBdGI+L3xc9ZBJ Iy7CGH8+9+4IWap8qwYu3yTdIDr8DFPPtagDEpzp8D6hDSF+6we9JruTmVbRRuAShlKrSTZzzNBemHjSxbA/Gxm0w/X6Jupc2x X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5473.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 504f0484-e225-4661-7464-08d99b062057 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2021 18:01:26.3092 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cMhuTEqeXqxyVguvIkwYsHHnAyopUD4M6ruiQIF/l9qCy4dxI5EoMEbYM3ag0mJJVFWV96p99mh+oLh7fp/9hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2287 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10152 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110290098 X-Proofpoint-GUID: 69LKnB-6eI6Tqdw2xpdH6lSXXze0rR0r X-Proofpoint-ORIG-GUID: 69LKnB-6eI6Tqdw2xpdH6lSXXze0rR0r 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:218581 Archived-At: > face-all-attributes could return such a plist, but we usually prefer to > return alists from functions instead of plists. >=20 > > Is there a good reason for this status quo? If not, can we change it > > to get a better fit and not require conversion? >=20 > We can't change the output of face-all-attributes (because that would > break code), so I don't think there's anything to do here, and I'm > closing this bug report. Do as you like (you already did), but FTR, I disagree. ___ We could certainly allow another optional arg that specifies that the result be a plist. All that's lacking is the will (so far). If you want a patch for that, and if you'll actually use it, let me know. The definition below is what the patch would do. But I have a comment and a question first. A comment is that if you prefer to move the test for PLIST that's inside the loop outside of it, let me know. A question is why `face-all-attributes' excludes `:font' from the list of attributes it returns. More generally, shouldn't attribute `:font' be included in the value of defconst `face-attribute-name-alist'? If it should, then the code would be simpler, as would use by users (no special value needed for arg PLIST, to include `:font' for use by `set-face-attribute'). However, that's a "constant", and existing (3rd-party) code might now depend on `:font' not being included. So a 2nd part of the question is why we use `defconst'. If Emacs later adds an attribute (as it did with `:extend') then the "constant" is effectively broken. `defconst' is supposed to mean that neither program nor programmer is expected to change the value. ___ (defun face-all-attributes (face &optional frame plist) "Return an alist or plist of the attributes of FACE. By default, return an alist, with elements of the form \(ATTR-NAME . ATTR-VALUE). By default, ATTR-VALUE is the value provided by default for ATTR-NAME of FACE before it is defined with `defface', which means it is typically the symbol `unspecified'. But non-nil FRAME means ATTR-VALUE is the value of ATTR-NAME for FACE as it is defined for FRAME. Non-nil PLIST means return a plist, not an alist: \( ATTR-NAME-1 ATTR-VALUE-1 ATTR-NAME-2 ATTR-VALUE-2...). If PLIST is `font-also' then include attribute `:font'. In that case, the result includes all attributes valid as arguments to function `set-face-attribute'." (let ((names (if (eq plist 'font-also) (cons (cons :font "font") face-attribute-name-alist) face-attribute-name-alist)) (result ()) att val) (while names (setq att (caar names) val (face-attribute face att (or frame t)) names (cdr names)) (if (not plist) (push (cons att val) result) (push att result) (push val result))) (when plist (setq result (nreverse result))) result)) Eli recently made some kind of improvement to the doc of this function for bug #51465, to clarify what "default" attribute values mean for this when FRAME is nil. Dunno just what change he made, but the doc I show here can be changed to say whatever he said or whatever you like. Let me know the text you prefer, before I send any patch.