Function: with-tramp-saved-connection-property

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

Signature

(with-tramp-saved-connection-property KEY PROPERTY &rest BODY)

Documentation

Save PROPERTY, run BODY, reset PROPERTY.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-cache.el.gz
;;;###tramp-autoload
(defmacro with-tramp-saved-connection-property (key property &rest body)
  "Save PROPERTY, run BODY, reset PROPERTY."
  (declare (indent 2) (debug t))
  `(progn
     (setf ,key (tramp-file-name-unify ,key))
     (let* ((hash (tramp-get-hash-table ,key))
	    (cached (and (hash-table-p hash)
			 (gethash ,property hash tramp-cache-undefined))))
       (unwind-protect (progn ,@body)
	 ;; Reset PROPERTY.  Recompute hash, it could have been flushed.
         (setq hash (tramp-get-hash-table ,key))
	 (if (not (eq cached tramp-cache-undefined))
	     (puthash ,property cached hash)
	   (remhash ,property hash))))))