From: Michael Albinus Date: Thu, 8 Jun 2023 07:59:06 +0000 (+0200) Subject: Fix connection-local user options handling (bug#63300) X-Git-Tag: emacs-29.0.92~44 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a3a69ec23421dd65671be37f829d5a29c8c0ef89;p=emacs.git 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) --- 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)