]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix connection-local variables settings
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 13 Mar 2023 17:02:36 +0000 (18:02 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 13 Mar 2023 17:02:36 +0000 (18:02 +0100)
; * etc/NEWS: Fix typos.

* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables): Use NOW when calling
`custom-set-variables'.

* test/lisp/files-x-tests.el
(files-x-test-connection-local-set-profile-variables)
(files-x-test-connection-local-update-profile-variables)
(files-x-test-connection-local-set-profiles)
(files-x-test-hack-connection-local-variables-apply)
(files-x-test-with-connection-local-variables)
(files-x-test-setq-connection-local): Fix tests.

* test/lisp/net/tramp-tests.el (tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name): Fix tests.

etc/NEWS
lisp/files-x.el
test/lisp/files-x-tests.el
test/lisp/net/tramp-tests.el

index 4774671a46d66f6115d37db7e5875c96aaf5a1e6..a5f9f8c6ec1b0806284116c804fa1a99a16ed3fa 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3215,7 +3215,7 @@ Emacs now comes with the Eglot package, which enhances various Emacs
 features, such as completion, documentation, error detection, etc.,
 based on data provided by language servers using the Language Server
 Protocol (LSP).  See the new Info manual "(eglot) Top" for more.  Also
-see etc/EGLOT-NEWS.
+see "etc/EGLOT-NEWS".
 
 +++
 ** use-package: Declarative package configuration.
@@ -4889,7 +4889,7 @@ two buttons: "Yes" and "No".
 
 +++
 *** The 'ns-popup-font-panel' command has been removed.
-Use the general command "M-x menu-set-font" instead.
+Use the general command 'M-x menu-set-font' instead.
 
 \f
 ----------------------------------------------------------------------
index be27aedf2e21fca3d48fef326304d5b554d71e80..548d9efc193af01fbcd4f300c264f2a0a036730e 100644 (file)
@@ -682,7 +682,7 @@ variables for a connection profile are defined using
             (cons (cons criteria (delete-dups profiles))
                  connection-local-criteria-alist))))
   (custom-set-variables
-   `(connection-local-criteria-alist ',connection-local-criteria-alist)))
+   `(connection-local-criteria-alist ',connection-local-criteria-alist now)))
 
 (defsubst connection-local-get-profile-variables (profile)
   "Return the connection-local variable list for PROFILE."
@@ -703,7 +703,7 @@ 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)))
+   `(connection-local-profile-alist ',connection-local-profile-alist now)))
 
 ;;;###autoload
 (defun connection-local-update-profile-variables (profile variables)
index f79118fd564a8685be6ec042817d3e8ea6efe903..4e14ae68fb85f6583e5777e5833f376d564c49c8 100644 (file)
@@ -66,7 +66,9 @@
   "Test setting connection-local profile variables."
 
   ;; Declare (PROFILE VARIABLES) objects.
-  (let (connection-local-profile-alist connection-local-criteria-alist)
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
+        connection-local-profile-alist connection-local-criteria-alist)
     (connection-local-set-profile-variables
      'remote-bash files-x-test--variables1)
     (should
     (should
      (equal
       (connection-local-get-profile-variables 'remote-nullfile)
-      files-x-test--variables4))))
+      files-x-test--variables4))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (ert-deftest files-x-test-connection-local-update-profile-variables ()
   "Test updating connection-local profile variables."
 
   ;; Declare (PROFILE VARIABLES) objects.
-  (let (connection-local-profile-alist connection-local-criteria-alist)
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
+        connection-local-profile-alist connection-local-criteria-alist)
     (connection-local-set-profile-variables
      'remote-bash (copy-alist files-x-test--variables1))
     (should
      (equal
       (connection-local-get-profile-variables 'remote-bash)
       (cons (car files-x-test--variables2)
-            (cdr files-x-test--variables1))))))
+            (cdr files-x-test--variables1))))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (ert-deftest files-x-test-connection-local-set-profiles ()
   "Test setting connection-local profiles."
 
   ;; Declare (CRITERIA PROFILES) objects.
-  (let (connection-local-profile-alist connection-local-criteria-alist)
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
+        connection-local-profile-alist connection-local-criteria-alist)
     (connection-local-set-profile-variables
      'remote-bash files-x-test--variables1)
     (connection-local-set-profile-variables
       '(remote-bash remote-ksh remote-nullfile)))
 
     ;; A criteria other than plist is wrong.
-    (should-error (connection-local-set-profiles 'dummy))))
+    (should-error (connection-local-set-profiles 'dummy))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (ert-deftest files-x-test-hack-connection-local-variables-apply ()
   "Test setting connection-local variables."
 
-  (let (connection-local-profile-alist connection-local-criteria-alist)
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
+        connection-local-profile-alist connection-local-criteria-alist)
 
     (connection-local-set-profile-variables
      'remote-bash files-x-test--variables1)
         (hack-connection-local-variables-apply nil)
         (should-not connection-local-variables-alist)
         (should-not (local-variable-p 'remote-shell-file-name))
-        (should-not (boundp 'remote-shell-file-name))))))
+        (should-not (boundp 'remote-shell-file-name))))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (ert-deftest files-x-test-with-connection-local-variables ()
   "Test setting connection-local variables."
 
-  (let ((connection-local-profile-alist connection-local-profile-alist)
-        (connection-local-criteria-alist connection-local-criteria-alist))
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist))
     (connection-local-set-profile-variables
      'remote-bash files-x-test--variables1)
     (connection-local-set-profile-variables
        (should-not (local-variable-p 'remote-null-device))
        ;; The variable values are reset.
        (should-not (boundp 'remote-shell-file-name))
-       (should (string-equal (symbol-value 'remote-null-device) "null"))))))
+       (should (string-equal (symbol-value 'remote-null-device) "null"))))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (defun files-x-test--get-lazy-var ()
   "Get the connection-local value of `remote-lazy-var'.
@@ -405,7 +438,9 @@ If it's not initialized yet, initialize it."
 
 (ert-deftest files-x-test-setq-connection-local ()
   "Test dynamically setting connection local variables."
-  (let (connection-local-profile-alist connection-local-criteria-alist)
+  (let ((clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
+        connection-local-profile-alist connection-local-criteria-alist)
     (connection-local-set-profile-variables
      'remote-lazy files-x-test--variables5)
     (connection-local-set-profiles
@@ -440,7 +475,12 @@ If it's not initialized yet, initialize it."
       (should (equal (files-x-test--get-lazy-var) "there"))
       (with-connection-local-application-variables
           (cadr files-x-test--application)
-        (should (equal remote-null-device "null"))))))
+        (should (equal remote-null-device "null"))))
+
+    ;; Cleanup.
+    (custom-set-variables
+     `(connection-local-profile-alist ',clpa now)
+     `(connection-local-criteria-alist ',clca now))))
 
 (provide 'files-x-tests)
 ;;; files-x-tests.el ends here
index ff0fc56043e26685f5f1dbeaafdb719617fcdb95..0a777617c1d32c799d56bab6e7b2bfdd3af8c006 100644 (file)
@@ -5819,6 +5819,8 @@ INPUT, if non-nil, is a string sent to the process."
         (enable-remote-dir-locals t)
          (inhibit-message t)
         kill-buffer-query-functions
+        (clpa connection-local-profile-alist)
+        (clca connection-local-criteria-alist)
         connection-local-profile-alist connection-local-criteria-alist)
     (unwind-protect
        (progn
@@ -5867,6 +5869,9 @@ INPUT, if non-nil, is a string sent to the process."
            (kill-buffer (current-buffer))))
 
       ;; Cleanup.
+      (custom-set-variables
+       `(connection-local-profile-alist ',clpa now)
+       `(connection-local-criteria-alist ',clca now))
       (ignore-errors (delete-directory tmp-name1 'recursive)))))
 
 (ert-deftest tramp-test34-explicit-shell-file-name ()
@@ -5881,6 +5886,8 @@ INPUT, if non-nil, is a string sent to the process."
 
   (let ((default-directory ert-remote-temporary-file-directory)
        explicit-shell-file-name kill-buffer-query-functions
+       (clpa connection-local-profile-alist)
+       (clca connection-local-criteria-alist)
        connection-local-profile-alist connection-local-criteria-alist)
     (unwind-protect
        (progn
@@ -5915,6 +5922,9 @@ INPUT, if non-nil, is a string sent to the process."
 
       ;; Cleanup.
       (put 'explicit-shell-file-name 'permanent-local nil)
+      (custom-set-variables
+       `(connection-local-profile-alist ',clpa now)
+       `(connection-local-criteria-alist ',clca now))
       (kill-buffer "*shell*"))))
 
 ;; `exec-path' was introduced in Emacs 27.1.  `executable-find' has