Function: data-debug-eval-expression

data-debug-eval-expression is an interactive and byte-compiled function defined in data-debug.el.gz.

Signature

(data-debug-eval-expression EXPR)

Documentation

Evaluate EXPR and display the value.

If the result is something simple, show it in the echo area. If the result is a list or vector, then use the data debugger to display it.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/data-debug.el.gz
(defun data-debug-eval-expression (expr)
  "Evaluate EXPR and display the value.
If the result is something simple, show it in the echo area.
If the result is a list or vector, then use the data debugger to display it."
  (interactive
   (list (read-from-minibuffer "Eval: "
                               nil read-expression-map t
                               'read-expression-history)))

  (let (result)
    (if (null eval-expression-debug-on-error)
        (setq result (values--store-value (eval expr t)))
      (let ((old-value (make-symbol "t")) new-value)
        ;; Bind debug-on-error to something unique so that we can
        ;; detect when evalled code changes it.
        (let ((debug-on-error old-value))
	  (setq result (values--store-value (eval expr t)))
	  (setq new-value debug-on-error))
        ;; If evalled code has changed the value of debug-on-error,
        ;; propagate that change to the global binding.
        (unless (eq old-value new-value)
	  (setq debug-on-error new-value))))

    (if (or (consp result) (vectorp result))
        (let ((v result))
	  (data-debug-show-stuff v "Expression"))
      ;; Old style
      (prog1
	  (prin1 result t)
        (let ((str (eval-expression-print-format result)))
	  (if str (princ str t)))))))