From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#63300: 29.0.90; Tramp keeps customizing variables on every connection Date: Tue, 06 Jun 2023 13:46:52 +0200 Message-ID: <87y1kwq0cz.fsf@gmx.de> References: <87h6rnsiup.fsf@gmx.de> <871qirsbcd.fsf@gmx.de> <666e41e6-b1fc-4dd3-a190-187a73c868f8@Spark> <87sfb7qvoh.fsf@gmx.de> <814039a1-20ea-4068-b950-1cd9ed594e21@Spark> <87o7lvquy2.fsf@gmx.de> <3aba5090-3ed7-4a2b-b65c-872880e2bf76@Spark> 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="18674"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63300@debbugs.gnu.org To: Jimmy Wong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 06 13:48:27 2023 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 1q6VAo-0004h6-Pn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Jun 2023 13:48:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6VAS-0006HY-RF; Tue, 06 Jun 2023 07:48:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6VAR-0006Gs-7f for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:48:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6VAQ-0002jk-UM for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q6VAQ-0001pg-1S for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Jun 2023 11:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63300 X-GNU-PR-Package: emacs Original-Received: via spool by 63300-submit@debbugs.gnu.org id=B63300.16860520256858 (code B ref 63300); Tue, 06 Jun 2023 11:48:02 +0000 Original-Received: (at 63300) by debbugs.gnu.org; 6 Jun 2023 11:47:05 +0000 Original-Received: from localhost ([127.0.0.1]:51099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6V9V-0001mY-95 for submit@debbugs.gnu.org; Tue, 06 Jun 2023 07:47:05 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:46681) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6V9P-0001lt-Hz for 63300@debbugs.gnu.org; Tue, 06 Jun 2023 07:47:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1686052013; x=1686656813; i=michael.albinus@gmx.de; bh=vVCqes8rbyQYK+SK+KFf8ArnL2yz/cXnTr+FmasuPpw=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=ptMXQalUkInGDXpuk1LRjbayAiVqll+jTT1UlBhu5ZOZtDt+ZzKroOIJ8qtuEGZvIlu9Mp6 +HmZIVeHPAiKFOhsj/4ZsQGrTEJcVyeU1XHQDwXM7L/pl5bJCghD16dEaZK6pkVh03FfwwJGB U9OibhN8UW4C8ggc+XMzLBi06dfaQQcfRcdsyV+eNT1MImq6ua/qw7gFvW98gGI/MJYrLbjGY Ed92EJOqJiRcheETS2Pm9POnfFavOlcjon/J4LIe95GAu/Z/aWFtwEjjgXzbqiVF1tEdCh/vb juqed104TP4c7MOSJuRCP9Ndof2lmUVysqJS9tchogTSbHg64rgA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.13]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MpDNf-1qOWHK03Vn-00qhgf; Tue, 06 Jun 2023 13:46:53 +0200 In-Reply-To: <3aba5090-3ed7-4a2b-b65c-872880e2bf76@Spark> (Jimmy Wong's message of "Sun, 4 Jun 2023 17:55:42 +0100") X-Provags-ID: V03:K1:r9V/uQ5VwmsVhAl0yHbXq0aF4h9CkWW85JXrkRBmFcGIP2X9Wkf tkIJbme8OFX5sddP68zf7WJbWPBuFn6cDF1egtYlgeP9XdoWYrvFdk1a4THFEnsHzepWbo2 VgoGnKYfomQGn0DzKuxllKkSy/lR+lEB/Bq8YWPuuw00Gjm3PHFHtRaYviSHAz8lsbNiIn2 /FzyUnzwUzu3+m6P5fc6g== UI-OutboundReport: notjunk:1;M01:P0:V3pnIWhM3+I=;e0KZ7/ZCgfNB5f/8LsJtfOhBwoK uWztxhv+SFz4VEKjTuHnK8z3oS+XBAFN88mFnK1nUPkaAfPsH0Wqd8a/EV9Jla+KLvuLMgzFV +Opb+JiKsp7RGGS4wgLH2mye9rIcr3I3qGhHMkYbZvnFpsPDvu2Q3klhyX4addnFTj83CoZ3s jngRwaQfbbGiFXikJwxZ2oy7Qkor2Zvp0O37mmYiioDixRH1pr/YQweHw7YQQjcO1YFKBYxu7 0xif1QYeoaITjKTuP+uWk6pyZGAuhtVqVYcNnjVSCpcC7Pc6sbKfunTv0OjYX0me7PJHecv41 NYdYeAHm8/XpCyKPR/LkSXnzuKydFLXpRX9PtoZW3TisKW8urHwwfui5CTXGBq6jmefihZ0pn 081JjEwobSeqI+Za4m6q3D/bHJrzziAWl98iRcPQm0lv62cbQd5rgZoAC8m/FaFzYoIgFsql9 0G94vW4QqmIc8KXtGp2GnwLqxfcSQzpIo1e8BcQII2EHSgc05fVC8bdIPS3Mgm/5pGcTb8gv6 hSot5iNQdHBMHAEkoSZh2ih14wYuBK6Z+2JniivJqsgGGVYC2/OFh0mTaEqNpsP8Z78gvaVv8 uc0VX/M0guieL52VdekLa5kP7//IgGq+HDufRxBtk6QCKO25zW/UtebpGG00XAMQGwfs5phW2 Nm85MMh4WmI3Ubs3W5Wsv9Res4sn12VP3lFvk0RPz0CZRm0lxMJMebycvkCLgR8MEu9clqPbK JYq5WGTO4HL+x5hAaMmhK82fHMKMDFgA1T8PEN7VhfGXdJnUvf6WMdS+X80u8JBwT+5+gtE+ 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263052 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jimmy Wong writes: Hi, > Actually, I take it back. customize-save-variable only saves variables > that have the saved-value symbol property set. This property is > normally set by customize when it is saved to the custom file. > Something in Tramp is setting this property without saving the > variable values to the custom file or going through customize. In > fact, you can see it via M-x customize-option > connection-local-criteria-alist. The value will be shown as SAVED. This property is set as well in custom-set-variables. > In addition, setting `enable-connection-local-variables` to nil early > in early-init.el has no effect, the variable is still set on load. This is a different game. enable-connection-local-variables has no effect on setting / saving connection-local-criteria-alist and connection-local-profile-alist. e-c-l-v is used only in hack-connection-local-variables in order to control, whether connection-local variables shall be set as buffer-local variables. And the documentation is clear about, that it isn't intended to be used on user level, see (info "(elisp) Applying Connection Local Variables") --8<---------------cut here---------------start------------->8--- -- Variable: enable-connection-local-variables If =E2=80=98nil=E2=80=99, connection-local variables are ignored. Thi= s variable shall be changed temporarily only in special modes. --8<---------------cut here---------------end--------------->8--- > Both of this behavior violate what is documented in the docstring and > https://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Proper= ties.html. No. > If you must, enable-conneciton-local-variables should be respected, > and if you must, set the theme-value property on these > connection-local variables instead of saved-value so custom-save-all > will not save them. No. In connection-local-set-profiles and connection-local-set-profile-variables it should be checked, whether the saved-value property is set. If not, it shall be reset to nil, after custom-set-variables has been called. The appended patch shall do the trick. Could you, please, test? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/files-x.el b/lisp/files-x.el index 548d9efc193..bae535da550 100644 =2D-- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -674,15 +674,18 @@ connection-local-set-profiles (dolist (profile profiles) (unless (assq profile connection-local-profile-alist) (error "No such connection profile `%s'" (symbol-name profile)))) - (let* ((criteria (connection-local-normalize-criteria criteria)) + (let* ((saved-value (get 'connection-local-criteria-alist 'saved-value)= ) + (criteria (connection-local-normalize-criteria criteria)) (slot (assoc criteria connection-local-criteria-alist))) (if slot (setcdr slot (delete-dups (append (cdr slot) profiles))) (setq connection-local-criteria-alist (cons (cons criteria (delete-dups profiles)) - connection-local-criteria-alist)))) - (custom-set-variables - `(connection-local-criteria-alist ',connection-local-criteria-alist no= w))) + connection-local-criteria-alist))) + (custom-set-variables + `(connection-local-criteria-alist ',connection-local-criteria-alist = now)) + (unless saved-value + (put 'connection-local-criteria-alist 'saved-value nil)))) (defsubst connection-local-get-profile-variables (profile) "Return the connection-local variable list for PROFILE." @@ -701,9 +704,12 @@ connection-local-set-profile-variables variables are set in the server's process buffer according to the VARIABLES list of the connection profile. The list is processed in order." - (setf (alist-get profile connection-local-profile-alist) variables) - (custom-set-variables - `(connection-local-profile-alist ',connection-local-profile-alist now)= )) + (let ((saved-value (get 'connection-local-profile-alist 'saved-value))) + (setf (alist-get profile connection-local-profile-alist) variables) + (custom-set-variables + `(connection-local-profile-alist ',connection-local-profile-alist no= w)) + (unless saved-value + (put 'connection-local-profile-alist 'saved-value nil)))) ;;;###autoload (defun connection-local-update-profile-variables (profile variables) --=-=-=--