;; This buffer is created when `tramp-verbose' is greater than or
;; equal 4. It contains all messages with a level up to `tramp-verbose'.
;;
-;; When `tramp-debug-command-messages' is non-nil and
-;; `tramp-verbose' is greater than or equal 6, the buffer contains
-;; all messages with level 6 and the entry/exit messages of
+;; When `tramp-debug-command-messages' is non-nil, the buffer
+;; contains all messages with level 6 and the entry/exit messages of
;; `tramp-file-name-handler'. This is intended to analyze which
;; remote commands are sent for a given file name operation.
;;
(defcustom tramp-debug-command-messages nil
"Whether to write only command messages to the debug buffer.
-This has only effect if `tramp-verbose' is greater than or equal 6."
+This increases `tramp-verbose' to 6 if necessary."
:group 'tramp
:version "30.1"
:type 'boolean)
applicable)."
;; (declare (tramp-suppress-trace t))
(ignore-errors
- (when (<= level tramp-verbose)
- ;; Display only when there is a minimum level, and the progress
- ;; reporter doesn't suppress further messages.
- (when (and (<= level 3) (null tramp-inhibit-progress-reporter))
- (apply #'message
- (concat
- (cond
- ((= level 0) "")
- ((= level 1) "")
- ((= level 2) "Warning: ")
- (t "Tramp: "))
- fmt-string)
- arguments))
- ;; Log only when there is a minimum level.
- (when (>= tramp-verbose 4)
- (let ((tramp-verbose 0))
- ;; Append connection buffer for error messages, if exists.
- (when (= level 1)
- (ignore-errors
- (setq fmt-string (concat fmt-string "\n%s")
- arguments
- (append
- arguments
- `(,(tramp-get-buffer-string
- (if (processp vec-or-proc)
- (process-buffer vec-or-proc)
- (tramp-get-connection-buffer
- vec-or-proc 'dont-create))))))))
- ;; Translate proc to vec.
- (when (processp vec-or-proc)
- (setq vec-or-proc (process-get vec-or-proc 'tramp-vector))))
- ;; Do it.
- (when (and (tramp-file-name-p vec-or-proc)
- (or (null tramp-debug-command-messages) (= level 6)))
- (apply #'tramp-debug-message
- vec-or-proc
- (concat (format "(%d) # " level) fmt-string)
- arguments))))))
+ (let ((tramp-verbose
+ (if tramp-debug-command-messages
+ (max tramp-verbose 6) tramp-verbose)))
+ (when (<= level tramp-verbose)
+ ;; Display only when there is a minimum level, and the
+ ;; progress reporter doesn't suppress further messages.
+ (when (and (<= level 3) (null tramp-inhibit-progress-reporter))
+ (apply #'message
+ (concat
+ (cond
+ ((= level 0) "")
+ ((= level 1) "")
+ ((= level 2) "Warning: ")
+ (t "Tramp: "))
+ fmt-string)
+ arguments))
+ ;; Log only when there is a minimum level.
+ (when (>= tramp-verbose 4)
+ (let ((tramp-verbose 0))
+ ;; Append connection buffer for error messages, if exists.
+ (when (= level 1)
+ (ignore-errors
+ (setq fmt-string (concat fmt-string "\n%s")
+ arguments
+ (append
+ arguments
+ `(,(tramp-get-buffer-string
+ (if (processp vec-or-proc)
+ (process-buffer vec-or-proc)
+ (tramp-get-connection-buffer
+ vec-or-proc 'dont-create))))))))
+ ;; Translate proc to vec.
+ (when (processp vec-or-proc)
+ (setq vec-or-proc (process-get vec-or-proc 'tramp-vector))))
+ ;; Do it.
+ (when (and (tramp-file-name-p vec-or-proc)
+ (or (null tramp-debug-command-messages) (= level 6)))
+ (apply #'tramp-debug-message
+ vec-or-proc
+ (concat (format "(%d) # " level) fmt-string)
+ arguments)))))))
;; We cannot use the `declare' form for `tramp-suppress-trace' in
;; autoloaded functions, because the tramp-loaddefs.el generation
If BODY does not raise a debug message, MESSAGE is ignored."
(declare (indent 2) (debug t))
(let ((result (make-symbol "result")))
- `(if (and tramp-debug-command-messages (>= tramp-verbose 6))
+ `(if tramp-debug-command-messages
(save-match-data
(let ((tramp-debug-nesting
(concat tramp-debug-nesting "#"))