From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dario Gjorgjevski Newsgroups: gmane.emacs.bugs Subject: bug#44852: [PATCH] Fix modification check when custom-form is 'lisp Date: Tue, 24 Nov 2020 19:51:38 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2815"; mail-complaints-to="usenet@ciao.gmane.io" To: 44852@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 24 19:52:50 2020 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 1khdQo-0000df-4B for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Nov 2020 19:52:50 +0100 Original-Received: from localhost ([::1]:51892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khdQn-0001f3-6X for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Nov 2020 13:52:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khdQ2-0000y2-9n for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2020 13:52:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khdQ1-0006I4-Vs for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2020 13:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1khdQ1-00087j-VC for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2020 13:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dario Gjorgjevski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Nov 2020 18:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44852 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.160624390731202 (code B ref -1); Tue, 24 Nov 2020 18:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Nov 2020 18:51:47 +0000 Original-Received: from localhost ([127.0.0.1]:32996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1khdPn-00087C-Dk for submit@debbugs.gnu.org; Tue, 24 Nov 2020 13:51:47 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1khdPl-000874-8n for submit@debbugs.gnu.org; Tue, 24 Nov 2020 13:51:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khdPk-0000g6-V5 for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2020 13:51:44 -0500 Original-Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:38724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khdPi-0006Gq-Ul for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2020 13:51:44 -0500 Original-Received: by mail-ed1-x536.google.com with SMTP id y4so21995842edy.5 for ; Tue, 24 Nov 2020 10:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=Hb3i68C96dbLJZ/xjlbr07e7y3GIAa4+Vma7fYpegO8=; b=PjZI2L9tBCyt4iHi0s57ss/mF4wO79MHaebGpf42dOS/BsBBVIzJNZ/kB36qSxQQNx WCQ3njfSLA2+R7EOaXfRZp5dBIqmkV4bdm6V+yyP0v7o3e2wG7z0p8AySd6bvCGjG3S6 xakmrrVRwNiKd9NulhBfNv+9KIdNuwGSrg/7FLKU+lkVJPEN+3Mtn8QdyM/mFjuuezfC Jk9FvS3gcsKK2crWHdXGbFnsY+JdEmWoTjsE3gXIxmmWa//7WAqTqmbP9F+Fm8DT6Qnh RTU8IqasiEZHyL7DDlZG+M1um7t7RyYqNcMklVgLHLuS79bfnX7L9v9ZDl3mITcLnFHA 5lPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Hb3i68C96dbLJZ/xjlbr07e7y3GIAa4+Vma7fYpegO8=; b=XFqu7Tgg/dB4JAaA5xIc2KGQKIvO4yjehdaHUXmlJnCMa134qTuASTHYihoqGwj+ew IVF6FwRx4GjncTXt18sVDN42hLbCKUcLpdQtdZ8ClrPebdYC5fZCsZGPt1cy6K0BZ4Kb U9HWWoYpzsjgY3zIiNQ0Lnrz3FAW5hZyNcvDNn6ohWAytr21koxaha5pP7rcOG4c809O bD3urSx4RgIT1rq0Gdjck3Dqy6gItlNhax0sclUc0CZy88vq2Ptqq7reGoE7RKSUI7+3 AFQ0xGQVpojJfGCamPcK3Jjqq+Q8z96HDFMnhHuP4ayqkT/0dUVLO4uD41Kg/H1WGXee bukQ== X-Gm-Message-State: AOAM530sCEUFuFwLEvvP4+HFCJORhUR2cNfyGNU9534rDw5+YNC5nyz3 gpQE85khTYs3A+VILW+TdCP8ss19EVI= X-Google-Smtp-Source: ABdhPJzXH0DwWC8bLc45mLxsV47q0EvMuP+wyY3mMZFXrKt8wTJWWfixY3hF+arZDhHYDTq9UNr5XA== X-Received: by 2002:a50:d742:: with SMTP id i2mr5154387edj.154.1606243900274; Tue, 24 Nov 2020 10:51:40 -0800 (PST) Original-Received: from ZALANDO-31298 ([79.140.123.205]) by smtp.gmail.com with ESMTPSA id g13sm7603681edy.7.2020.11.24.10.51.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Nov 2020 10:51:39 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=dario.gjorgjevski@gmail.com; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:194102 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable When a variable=E2=80=99s custom-form is 'lisp (or 'mismatch), `custom-variable-value-create' will quote its value prior to storing it inside the widget. Afterwards, `custom-variable-modified-p' will try to compare this quoted form to the (unquoted) value and think that the variable has been modified. To reproduce, fire up emacs -Q and do: 1. (setq custom-variable-default-form 'lisp) 2. M-x customize-variable RET auto-save-file-name-transforms RET You will notice that Customize thinks that the variable has been modified even though that is not true. If step 1. is omitted, everything is fine. The patch attached below fixes that. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-modification-check-when-custom-form-is-lisp.patch Content-Description: Fix modification check when custom-form is 'lisp >From 1e2b5ce115d67d350e27d7d3bd33ef5131cc59fa Mon Sep 17 00:00:00 2001 From: Dario Gjorgjevski Date: Tue, 24 Nov 2020 17:34:08 +0100 Subject: [PATCH] Fix modification check when custom-form is 'lisp * lisp/cus-edit.el (custom-variable-modified-p): Quote the value when custom form is 'lisp (or 'mismatch) prior to comparing in order to accommodate `custom-variable-value-create'. --- lisp/cus-edit.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index eceba8fa4d..27c0147f58 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -2900,14 +2900,19 @@ custom-variable-modified-p in a customize buffer. To check for other states, call `custom-variable-state'." (catch 'get-error - (let* ((symbol (widget-get widget :value)) + (let* ((form (widget-get widget :custom-form)) + (symbol (widget-get widget :value)) (get (or (get symbol 'custom-get) 'default-value)) (value (if (default-boundp symbol) (condition-case nil (funcall get symbol) (error (throw 'get-error t))) - (symbol-value symbol)))) - (not (equal value (widget-value (car (widget-get widget :children)))))))) + (symbol-value symbol))) + (orig-value (widget-value (car (widget-get widget :children))))) + (not (equal (if (memq form '(lisp mismatch)) + (custom-quote value) ; Mimic `custom-variable-value-create'. + value) + orig-value))))) (defun custom-variable-state-set (widget &optional state) "Set the state of WIDGET to STATE. -- 2.28.0 --=-=-= Content-Type: text/plain Best regards, Dario -- $ keyserver=hkps://hkps.pool.sks-keyservers.net $ keyid=744A4F0B4F1C9371 $ gpg --keyserver $keyserver --search-keys $keyid --=-=-=--