Function: with-tramp-saved-connection-properties

with-tramp-saved-connection-properties is an autoloaded macro defined in tramp-cache.el.gz.

Signature

(with-tramp-saved-connection-properties KEY PROPERTIES &rest BODY)

Documentation

Save PROPERTIES, run BODY, reset PROPERTIES.

PROPERTIES is a list of file properties (strings).

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-cache.el.gz
;;;###tramp-autoload
(defmacro with-tramp-saved-connection-properties (key properties &rest body)
  "Save PROPERTIES, run BODY, reset PROPERTIES.
PROPERTIES is a list of file properties (strings)."
  (declare (indent 2) (debug t))
  `(progn
     (setf ,key (tramp-file-name-unify ,key))
     (let* ((hash (tramp-get-hash-table ,key))
	    (values
	     (mapcar
	      (lambda (property)
		(cons property (gethash property hash tramp-cache-undefined)))
	      ,properties)))
       (unwind-protect (progn ,@body)
       ;; Reset PROPERTIES.  Recompute hash, it could have been flushed.
       (setq hash (tramp-get-hash-table ,key))
       (dolist (value values)
	 (if (not (eq (cdr value) tramp-cache-undefined))
	     (puthash (car value) (cdr value) hash)
	   (remhash (car value) hash)))))))