emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 a3a69ec2342: Fix connection-local user options handling (bug#63


From: Michael Albinus
Subject: emacs-29 a3a69ec2342: Fix connection-local user options handling (bug#63300)
Date: Thu, 8 Jun 2023 03:59:18 -0400 (EDT)

branch: emacs-29
commit a3a69ec23421dd65671be37f829d5a29c8c0ef89
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Fix connection-local user options handling (bug#63300)
    
    * lisp/files-x.el (connection-local-set-profiles)
    (connection-local-set-profile-variables): Avoid saving the changed
    user option to file unless triggered explicitly by user.  (Bug#63300)
---
 lisp/files-x.el | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index 548d9efc193..9b1a7a17902 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -674,15 +674,21 @@ variables for a connection profile are defined using
   (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))
+  ;; Avoid saving the changed user option to file unless triggered
+  ;; explicitly by user.  This workaround can be removed once there is
+  ;; a solution for bug#63891.
+  (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 now)))
+                 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 +707,15 @@ connection profile using `connection-local-set-profiles'.  
Then
 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)))
+  ;; Avoid saving the changed user option to file unless triggered
+  ;; explicitly by user.  This workaround can be removed once there is
+  ;; a solution for bug#63891.
+  (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 now))
+    (unless saved-value
+      (put 'connection-local-profile-alist 'saved-value nil))))
 
 ;;;###autoload
 (defun connection-local-update-profile-variables (profile variables)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]