Function: with-connection-local-variables

with-connection-local-variables is an autoloaded macro defined in files-x.el.gz.

Signature

(with-connection-local-variables &rest BODY)

Documentation

Apply connection-local variables according to default-directory.

Execute BODY, and unwind connection-local variables.

Probably introduced at or before Emacs version 27.1.

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;;###autoload
(defmacro with-connection-local-variables (&rest body)
  "Apply connection-local variables according to `default-directory'.
Execute BODY, and unwind connection-local variables."
  (declare (debug t))
  `(if (file-remote-p default-directory)
       (let ((enable-connection-local-variables t)
             (old-buffer-local-variables (buffer-local-variables))
	     connection-local-variables-alist)
	 (hack-connection-local-variables-apply
	  (connection-local-criteria-for-default-directory))
	 (unwind-protect
             (progn ,@body)
	   ;; Cleanup.
	   (dolist (variable connection-local-variables-alist)
	     (let ((elt (assq (car variable) old-buffer-local-variables)))
	       (if elt
		   (set (make-local-variable (car elt)) (cdr elt))
		 (kill-local-variable (car variable)))))))
     ;; No connection-local variables to apply.
     ,@body))