Function: backtrace-toggle-locals

backtrace-toggle-locals is an interactive and byte-compiled function defined in backtrace.el.gz.

Signature

(backtrace-toggle-locals &optional ALL)

Documentation

Toggle the display of local variables for the backtrace frame at point.

With prefix argument ALL, toggle the value of :show-locals in backtrace-view, which affects all of the backtrace frames in the buffer.

Key Bindings

Aliases

debugger-toggle-locals (obsolete since 28.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/backtrace.el.gz
(defun backtrace-toggle-locals (&optional all)
  "Toggle the display of local variables for the backtrace frame at point.
With prefix argument ALL, toggle the value of :show-locals in
`backtrace-view', which affects all of the backtrace frames in
the buffer."
  (interactive "P")
  (if all
      (let ((pos (make-marker))
            (visible (not (plist-get backtrace-view :show-locals))))
        (setq backtrace-view (plist-put backtrace-view :show-locals visible))
        (set-marker-insertion-type pos t)
        (set-marker pos (point))
        (goto-char (point-min))
        ;; Skip the header.
        (unless (backtrace-get-index)
          (goto-char (backtrace-get-frame-end)))
        (while (< (point) (point-max))
          (backtrace--set-frame-locals-visible visible)
          (goto-char (backtrace-get-frame-end)))
        (goto-char pos)
        (when (invisible-p pos)
          (goto-char (backtrace-get-frame-start))))
    (let ((index (backtrace-get-index)))
      (unless index
        (user-error "Not in a stack frame"))
      (backtrace--set-frame-locals-visible
       (not (plist-get (backtrace-get-view) :show-locals))))))