Function: backtrace--toggle-feature

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

Signature

(backtrace--toggle-feature FEATURE ALL)

Documentation

Toggle FEATURE for the current backtrace frame or for the buffer.

FEATURE should be one of the options in backtrace-view. If ALL is non-nil, toggle FEATURE for all frames in the buffer. After toggling the feature, reprint the affected frame(s). Afterwards position point at the start of the frame it was in before.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/backtrace.el.gz
(defun backtrace--toggle-feature (feature all)
  "Toggle FEATURE for the current backtrace frame or for the buffer.
FEATURE should be one of the options in `backtrace-view'.  If ALL
is non-nil, toggle FEATURE for all frames in the buffer.  After
toggling the feature, reprint the affected frame(s).  Afterwards
position point at the start of the frame it was in before."
  (if all
      (let ((index (backtrace-get-index))
            (pos (point))
            (at-end (= (point) (point-max)))
            (value (not (plist-get backtrace-view feature))))
        (setq backtrace-view (plist-put backtrace-view feature value))
        (goto-char (point-min))
        ;; Skip the header.
        (unless (backtrace-get-index)
          (goto-char (backtrace-get-frame-end)))
        (while (< (point) (point-max))
          (backtrace--set-feature feature value)
          (goto-char (backtrace-get-frame-end)))
        (if (not index)
            (goto-char (if at-end (point-max) pos))
          (goto-char (point-min))
          (while (and (not (eql index (backtrace-get-index)))
                      (< (point) (point-max)))
            (goto-char (backtrace-get-frame-end))))
        (message "%s is now %s for all frames"
                 (substring (symbol-name feature) 1) value))
    (unless (backtrace-get-index)
      (user-error "Not in a stack frame"))
    (let ((value (not (plist-get (backtrace-get-view) feature))))
      (backtrace--set-feature feature value)
      (message "%s is now %s for this frame"
               (substring (symbol-name feature) 1) value))))