From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#27238: 24.5; Rename `face-spec-set-2' and give it a better doc string Date: Mon, 5 Jun 2017 08:55:06 -0700 (PDT) Message-ID: <139eede5-534a-47ad-805a-bad9995526eb@default> References: <<<<06a7cc83-a2a8-45a0-97d4-bd3a478aab92@default>>>> <<<<83wp8ra9g6.fsf@gnu.org>>>> <<<26a213b3-908e-43b1-a009-b8a18f0a1c23@default>>> <<<83tw3v9njh.fsf@gnu.org>>> <> <<83lgp6a257.fsf@gnu.org>> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1496678175 10688 195.159.176.226 (5 Jun 2017 15:56:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Jun 2017 15:56:15 +0000 (UTC) Cc: 27238@debbugs.gnu.org To: Eli Zaretskii , Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 05 17:56:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHuMV-0002Tw-1d for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Jun 2017 17:56:11 +0200 Original-Received: from localhost ([::1]:34003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHuMY-0003uO-MA for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Jun 2017 11:56:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHuMQ-0003tw-1B for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 11:56:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHuMM-0008R6-Gv for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 11:56:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHuMM-0008Ql-Bt for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 11:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dHuMM-0002g4-6H for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 11:56: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: Mon, 05 Jun 2017 15:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27238-submit@debbugs.gnu.org id=B27238.149667812110237 (code B ref 27238); Mon, 05 Jun 2017 15:56:02 +0000 Original-Received: (at 27238) by debbugs.gnu.org; 5 Jun 2017 15:55:21 +0000 Original-Received: from localhost ([127.0.0.1]:57921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHuLh-0002f3-7b for submit@debbugs.gnu.org; Mon, 05 Jun 2017 11:55:21 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:47067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHuLf-0002eq-FU for 27238@debbugs.gnu.org; Mon, 05 Jun 2017 11:55:20 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v55FtAWp016582 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jun 2017 15:55:11 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v55FtAII022148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jun 2017 15:55:10 GMT Original-Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v55Ft8eF016078; Mon, 5 Jun 2017 15:55:09 GMT In-Reply-To: <<83lgp6a257.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6767.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133304 Archived-At: > > > > (face-spec-set-2 TARGET-FACE > > > > FRAME > > > > (face-spec-choose > > > > (get SOURCE-FACE 'face-defface-spec) > > > > FRAME)) > > > > > > Why can't you do this by calling a higher-level function? > > > > What higher-level function would you suggest? >=20 > face-spec-recalc and face-spec-set come to mind, for example. I don't see how either of those can be used to do the same thing. If you think otherwise, please show how. > > How would _you_ set one face (`fringe' or whatever), in > > only a given frame, to the spec of another face (or to > > a spec that isn't yet used for any face)? >=20 > I asked whether the higher-level functions can do the job. If they > cannot, please explain why, and please provide specific details about > the difficulties. Answering my question by another question doesn't > help, since I'm sure I don't know enough about the job you wanted to > do. I don't know of any that could do the job, as I've said. I described the situation with `face-spec-set', and said that I tried to use it. You can, I think, see that it is not frame-specific. The job to do is shown in the code I gave above. And it is described in the description I gave: "set one face (`fringe' or whatever), in only a given frame, ^^^^^^^^^^^^^^^^^^^^^ to the spec of another face (or to a spec that isn't yet used for any face)" I don't see a "higher-level function" that does that. I don't see any function that does, apart from `face-spec-2'. > > But perhaps you have some other higher-level function in > > mind to do this job? If so, I wonder why `face-set-recalc' > > doesn't use it, instead of `face-spec-set-2. >=20 > There are many documented functions that set face attributes in > various forms and for various sets of frames. My question is > precisely whether any of them can do this job. If I thought that any of them could then I would not have used `face-spec-set-2'. If you know of one that can do the job (see above), please enlighten me. > If not, perhaps we could extend one of them to support > whatever you need to do. That'd be an alternative to renaming > face-spec-set-2 and making it public. Perhaps. Please consider letting, for example, `face-spec-set' take an optional FRAME argument. That would work for what I wanted to do. But that would not directly help someone who wants to pass, not a full face SPEC but the kind of non-spec "SPEC" arg that `face-spec-set-2' accepts, which is the kind of thing that `face-spec-choose' returns. IOW, in a use case where what you have to start with is not a face spec but a face-attribute plist. Not a big deal, but worth mentioning; `face-spec-set-2' accepts such a plist directly. In any case: (1) the name of `face-spec-2' is not very meaningful, and more importantly, the doc is wrong and the argument name "SPEC" is wrong. The "SPEC" arg is the kind of thing that `face-spec-choose' returns: a plist of face attributes - it is not a face spec. It's easy to see the difference when you check the definition of something like `face-spec-match-p' (or other uses of `face-spec-choose'). Its whole job is to just use `face-spec-choose' to convert a full face SPEC to a list of attributes for the given frame, so that it can then call `face-attr-match-p'. The doc for a function such as `face-spec-set-2' should, just like that for `face-attr-match-p', refer to the "SPEC" argument as ATTRS, not "SPEC", and it should say explicitly that it is a plist of face attributes and their values. Similar cleanup is called for in the code and comments of `face-spec-set-recalc', where `face-spec-set-2' is used: The variable "SPEC" there should be given another name, and the comments should talk about it appropriately - it is not a face spec. A face-attribute plist is not a face spec.