Function: backtrace-print

backtrace-print is a byte-compiled function defined in backtrace.el.gz.

Signature

(backtrace-print &optional REMEMBER-POS)

Documentation

Populate the current Backtrace mode buffer.

This erases the buffer and inserts printed representations of the frames. Optional argument REMEMBER-POS, if non-nil, means to move point to the entry with the same ID element as the current line and recenter window line accordingly.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/backtrace.el.gz
;; Print backtrace frames

(defun backtrace-print (&optional remember-pos)
  "Populate the current Backtrace mode buffer.
This erases the buffer and inserts printed representations of the
frames.  Optional argument REMEMBER-POS, if non-nil, means to
move point to the entry with the same ID element as the current
line and recenter window line accordingly."
  (let ((inhibit-read-only t)
	entry-index saved-pt window-line)
    (and remember-pos
	 (setq entry-index (backtrace-get-index))
         (when (eq (window-buffer) (current-buffer))
           (setq window-line
                 (count-screen-lines (window-start) (point)))))
    (erase-buffer)
    (when backtrace-insert-header-function
      (funcall backtrace-insert-header-function))
    (dotimes (idx (length backtrace-frames))
      (let ((beg (point))
            (elt (nth idx backtrace-frames)))
        (and entry-index
             (equal entry-index idx)
             (setq entry-index nil
                   saved-pt (point)))
        (backtrace-print-frame elt backtrace-view)
        (add-text-properties
         beg (point)
         `(backtrace-index ,idx backtrace-view ,backtrace-view))))
    (set-buffer-modified-p nil)
    ;; If REMEMBER-POS was specified, move to the "old" location.
    (if saved-pt
	(progn (goto-char saved-pt)
	       (when window-line
                 (recenter window-line)))
      (goto-char (point-min)))))