Function: erc-toggle-debug-irc-protocol
erc-toggle-debug-irc-protocol is an interactive and byte-compiled
function defined in erc.el.gz.
Signature
(erc-toggle-debug-irc-protocol &optional ARG)
Documentation
Toggle the value of erc-debug-irc-protocol.
If ARG is non-nil, show the *erc-protocol* buffer.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-toggle-debug-irc-protocol (&optional arg)
"Toggle the value of `erc-debug-irc-protocol'.
If ARG is non-nil, show the *erc-protocol* buffer."
(interactive "P")
(let* ((buf (get-buffer-create "*erc-protocol*")))
(with-current-buffer buf
(view-mode-enter)
(when (null (current-local-map))
(let ((inhibit-read-only t)
(msg (list
(concat "Version: " erc-debug-irc-protocol-version)
(concat "ERC-Version: " erc-version)
(concat "Emacs-Version: " emacs-version)
(erc-make-notice
(concat "This buffer displays all IRC protocol "
"traffic exchanged with servers."))
(erc-make-notice "Kill it to disable logging.")
(erc-make-notice (substitute-command-keys
"Press \\`t' to toggle.")))))
(insert (string-join msg "\r\n")))
(use-local-map (make-sparse-keymap))
(local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol))
(add-hook 'kill-buffer-hook
(lambda () (setq erc-debug-irc-protocol nil))
nil 'local)
(goto-char (point-max))
(let ((inhibit-read-only t))
(insert (if erc-debug-irc-protocol "\r\n" "")
(erc-make-notice
(format "IRC protocol logging %s at %s"
(if erc-debug-irc-protocol "disabled" "enabled")
(current-time-string)))
(if erc-debug-irc-protocol "\r\n" "\r\n\r\n"))))
(setq erc-debug-irc-protocol (not erc-debug-irc-protocol))
(if (and arg
(not (get-buffer-window "*erc-protocol*" t)))
(display-buffer buf t))
(message "IRC protocol traffic logging %s (see buffer *erc-protocol*)."
(if erc-debug-irc-protocol "enabled" "disabled"))))