From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#38812: 28.0.50; Custom: Problem with reverting some session's customizations Date: Tue, 31 Dec 2019 14:21:09 -0300 Message-ID: References: <83o8volbvf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004fbac0059b033073" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="211727"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38812@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 31 18:22:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1imLDg-000ssQ-8p for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Dec 2019 18:22:12 +0100 Original-Received: from localhost ([::1]:44898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imLDe-0003OA-VJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Dec 2019 12:22:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58117) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imLDW-0003O3-VM for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2019 12:22:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imLDV-0007JB-Rm for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2019 12:22:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imLDV-0007Ip-Oh for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2019 12:22:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1imLDV-0004hl-Kx for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2019 12:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Dec 2019 17:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 38812-submit@debbugs.gnu.org id=B38812.157781288818042 (code B ref 38812); Tue, 31 Dec 2019 17:22:01 +0000 Original-Received: (at 38812) by debbugs.gnu.org; 31 Dec 2019 17:21:28 +0000 Original-Received: from localhost ([127.0.0.1]:35051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imLCy-0004gv-Ik for submit@debbugs.gnu.org; Tue, 31 Dec 2019 12:21:28 -0500 Original-Received: from mail-lj1-f171.google.com ([209.85.208.171]:40068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imLCx-0004gi-BH for 38812@debbugs.gnu.org; Tue, 31 Dec 2019 12:21:27 -0500 Original-Received: by mail-lj1-f171.google.com with SMTP id u1so36825454ljk.7 for <38812@debbugs.gnu.org>; Tue, 31 Dec 2019 09:21:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I6aFiMPX8dkXla5XB/qD5nR2WF3jdWFBalyuXupMP8U=; b=mT20OcLPFRHr7yEqtk4OvjplxA//qPQuwwTCpBdB9pBzkVtWk5tGYnXWWAXIxNGOk6 GtLXTe/kSVbn7nBjNoPpPQmV4BZLibfzK9f9WYw0m0ntLImDMnhVaX/wTcyfXbiztI+1 tu8FPdbWmlPPj0Zb5MCgE+1GKl95MhvEJ+faLbbqSfHYs6tRKXTLtfw2y2vFo4bR6xwl twmZO5fAiR19VGV50cPDgjZ/LANCSKId0FCDv8acpvVVpiZO1NDKM+h73k9ScQkwNuH3 wvKHic67hr7MGQ1m2Fom+DhY5o/RXbvrJjH5r/I8GKd+U5QXkaSPuUgDpxhfAv5QqIma VDaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I6aFiMPX8dkXla5XB/qD5nR2WF3jdWFBalyuXupMP8U=; b=BcA0kD061Pq6t6Iuof6J7vNdLmuRAuKbiAaoByaX1x5hj/4xJue5glUyNFPN+TRCCH 8aa4pmkRX/tA903/Yw84w1P5Ry9ep1r3zIEbLj8zWXeikihE+hxN+YHse7kS4ZtLQlbN Gl8J/yhUJRYQeKdtTwV/mLPuvFa3ePrcg6nBvUrL6GMRcIqMSP+S7j6J+eA5oxHWGmpN PJZQUe/Vwu1fNIQtTSD8UGYb4/jfoKytF8gi/Ye+3HygQAckaYrMZTuiWPXaOOK8sc+0 ahTLkZNHZO7saSMEYTMD3oLQoA/yNq8O+h+tBCHBLwS6Mra9d9CbPED5qkoyvMfH0x03 ZeAw== X-Gm-Message-State: APjAAAWiVMMcuaXFOrIT5k/nu7V1WcY/MmAB6fMMaTRnJ3OmfuVp+HWG VW80bgLA9V14+/8AfiqONkzYd14lBHRpTWms4MVbJBv0u6E= X-Google-Smtp-Source: APXvYqxKijZiJZ8gaV1vBlecNjB3fRwKZwLf880uD0b6i1tiTXrPzO9nTbFL9S6n/MkjzpMARJWoB0dstGZ/gD2UUxw= X-Received: by 2002:a2e:93c5:: with SMTP id p5mr41372978ljh.192.1577812881290; Tue, 31 Dec 2019 09:21:21 -0800 (PST) In-Reply-To: <83o8volbvf.fsf@gnu.org> 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: 209.51.188.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:173989 Archived-At: --0000000000004fbac0059b033073 Content-Type: text/plain; charset="UTF-8" Eli Zaretskii writes: >> This function returns nil if no custom theme specifies a value for VARIABLE." >> (let ((theme-value (get variable 'theme-value))) >> - (if theme-value >> - (cdr (car theme-value))))) >> + (if theme-value ; ((THEME VALUE)) >> + (list (cadar theme-value))))) > > This will look strange without some comment explaining why we do this. True. I can add that comment. > And I have a question is: isn't it better not to use setcar in > custom-push-theme instead? I thought of doing that, and use setf with alist-get to make the change instead. But I think we'll be better off if we avoid sharing the cons cell inadvertedly, since that is prone to have bugs like this one. Alternatively, we could create the list in custom-theme-recalc-variable, to accomplish the same thing without changing the return value of custom-variable-theme-value. In that case, I think it would be convenient to change the doc string of custom-variable-theme-value, to say it returns some cdr. To me, either the patch I posted (with an additional explanatory comment, of course) or the latter option sound better, but I won't argue too much if you think otherwise. Best regards, Mauro. --0000000000004fbac0059b033073 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Eli Zaretskii <eliz@gnu= .org> writes:

>> =C2=A0This function returns nil if no = custom theme specifies a value for VARIABLE."
>> =C2=A0 =C2= =A0(let ((theme-value (get variable 'theme-value)))
>> - =C2= =A0 =C2=A0(if theme-value
>> - (cdr (car theme-value)))))
>&= gt; + =C2=A0 =C2=A0(if theme-value ; ((THEME VALUE))
>> + (list (c= adar theme-value)))))
>
> This will look strange without some c= omment explaining why we do this.

True.=C2=A0 I can add that comment= .

> And I have a question is: isn't it better not to use setc= ar in
> custom-push-theme instead?

I thought of doing that, an= d use setf with alist-get to make the change
instead.=C2=A0 But I think = we'll be better off if we avoid sharing the cons
cell inadvertedly, = since that is prone to have bugs like this one.

Alternatively, we co= uld create the list in custom-theme-recalc-variable,
to accomplish the s= ame thing without changing the return value of
custom-variable-theme-val= ue.=C2=A0 In that case, I think it would be
convenient to change the doc= string of custom-variable-theme-value, to
say it returns some cdr.
<= br>To me, either the patch I posted (with an additional explanatory
comm= ent, of course) or the latter option sound better, but I won't argue
too much if you think otherwise.

Best regards,Mauro.
--0000000000004fbac0059b033073--