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))
  `(let* ((key (tramp-file-name-unify ,key))
	  (hash (tramp-get-hash-table key))
	  (values
	   (mapcar
	    (lambda (property)
	      (cons property (gethash property hash tramp-cache-undefined)))
	    ,properties))
	  ;; Avoid superfluous debug buffers during host name completion.
	  (tramp-verbose (if minibuffer-completing-file-name 0 tramp-verbose)))
     (tramp-message key 7 "Saved %s" values)
     (unwind-protect (progn ,@body)
       ;; Reset PROPERTIES.  Recompute hash, it could have been flushed.
       (tramp-message key 7 "Restored %s" values)
       (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))))))