Function: view-lossage

view-lossage is an interactive and byte-compiled function defined in help.el.gz.

Signature

(view-lossage &optional AUTO-REFRESH)

Documentation

Display last few input keystrokes and the commands run.

For convenience this uses the same format as edit-last-kbd-macro. See lossage-size to update the number of recorded keystrokes.

With argument, auto-refresh the lossage buffer for each new input keystroke, see also view-lossage-auto-refresh.

To record all your input, use open-dribble-file.

View in manual

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/help.el.gz
(defun view-lossage (&optional auto-refresh)
  "Display last few input keystrokes and the commands run.
For convenience this uses the same format as
`edit-last-kbd-macro'.
See `lossage-size' to update the number of recorded keystrokes.

With argument, auto-refresh the lossage buffer for each new input
keystroke, see also `view-lossage-auto-refresh'.

To record all your input, use `open-dribble-file'."
  (interactive "P")
  (let ((help-buffer-under-preparation t)
        (view-lossage-auto-refresh
         (if auto-refresh t view-lossage-auto-refresh)))
    (unless view-lossage-auto-refresh
      ;; `view-lossage-auto-refresh' conflicts with xref buttons, add
      ;; them if `view-lossage-auto-refresh' is nil.
      (help-setup-xref (list #'view-lossage)
		       (called-interactively-p 'interactive)))
    (with-help-window (help-buffer)
      (princ " ")
      (insert (help--lossage-make-recent-keys))
      (with-current-buffer standard-output
	(goto-char (point-min))
        (setq-local comment-start ";; "
                    ;; Prevent 'comment-indent' from handling a single
                    ;; semicolon as the beginning of a comment.
                    comment-start-skip ";; "
                    comment-use-syntax nil
                    comment-column 24)
	(while (not (eobp))
          (comment-indent)
	  (forward-line 1))
	;; Show point near the end of "lossage", as we did in Emacs 24.
	(set-marker help-window-point-marker (point))

        (when view-lossage-auto-refresh
          (setq-local help--lossage-update t)
          (add-hook 'post-command-hook #'help--refresh-lossage-buffer))))

    ;; `help-make-xrefs' adds a newline at the end of the buffer, which
    ;; makes impossible to reposition point in `with-help-window'.
    (when view-lossage-auto-refresh
      (set-window-point (get-buffer-window (help-buffer)) (point-max)))))