Function: tramp-reporter-dump-variable

tramp-reporter-dump-variable is a byte-compiled function defined in tramp-cmds.el.gz.

Signature

(tramp-reporter-dump-variable VARSYM MAILBUF)

Documentation

Pretty-print the value of the variable in symbol VARSYM.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-cmds.el.gz
(defun tramp-reporter-dump-variable (varsym mailbuf)
  "Pretty-print the value of the variable in symbol VARSYM."
  (let* ((reporter-eval-buffer (symbol-value 'reporter-eval-buffer))
	 (val (with-current-buffer reporter-eval-buffer
		(symbol-value varsym))))

    (if (hash-table-p val)
	;; Pretty print the cache.
	(set varsym (read (format "(%s)" (tramp-cache-print val))))
      ;; There are non-7bit characters to be masked.
      (when (and (stringp val)
		 (string-match-p
		  (concat "[^" (bound-and-true-p mm-7bit-chars) "]") val))
	(with-current-buffer reporter-eval-buffer
	  (set varsym
	       `(decode-coding-string
		 (base64-decode-string
		  ,(base64-encode-string (encode-coding-string val 'raw-text)))
		 'raw-text)))))

    ;; Dump variable.
    (reporter-dump-variable varsym mailbuf)

    (unless (hash-table-p val)
      ;; Remove string quotation.
      (forward-line -1)
      (when (looking-at
	     (concat "\\(^.*\\)" "\""                       ;; \1 "
		     "\\((base64-decode-string \\)" "\\\\"  ;; \2 \
		     "\\(\".*\\)" "\\\\"                    ;; \3 \
		     "\\(\")\\)" "\"$"))                    ;; \4 "
	(replace-match "\\1\\2\\3\\4")
	(beginning-of-line)
	(insert " ;; Variable encoded due to non-printable characters.\n"))
      (forward-line 1))

    ;; Reset VARSYM to old value.
    (with-current-buffer reporter-eval-buffer
      (set varsym val))))