Function: with-connection-local-variables-1

with-connection-local-variables-1 is an autoloaded and byte-compiled function defined in files-x.el.gz.

Signature

(with-connection-local-variables-1 BODY-FUN)

Documentation

Apply connection-local variables according to default-directory.

Call BODY-FUN with no args, and then unwind connection-local variables.

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;;###autoload
(defun with-connection-local-variables-1 (body-fun)
  "Apply connection-local variables according to `default-directory'.
Call BODY-FUN with no args, and then unwind connection-local variables."
  (if (file-remote-p default-directory)
      (let* ((enable-connection-local-variables t)
             (connection-local-criteria
              (connection-local-criteria-for-default-directory))
             (connection-local-profile-name-for-setq
              (connection-local-profile-name-for-criteria
               connection-local-criteria))
             (old-buffer-local-variables (buffer-local-variables))
	     connection-local-variables-alist)
	(hack-connection-local-variables-apply connection-local-criteria)
	(unwind-protect
            (funcall body-fun)
	  ;; 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.
    (funcall body-fun)))