Function: describe-text-sexp

describe-text-sexp is a byte-compiled function defined in descr-text.el.gz.

Signature

(describe-text-sexp SEXP)

Documentation

Insert a short description of SEXP in the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/descr-text.el.gz
(defun describe-text-sexp (sexp)
  "Insert a short description of SEXP in the current buffer."
  (let ((pp (condition-case signal
		(pp-to-string sexp)
	      (error (prin1-to-string signal)))))
    (when (string-match-p "\n\\'" pp)
      (setq pp (substring pp 0 (1- (length pp)))))

    (if (and (not (string-search "\n" pp))
             (<= (length pp) (- (window-width) (current-column))))
	(insert pp)
      (insert-text-button
       "[Show]"
       'follow-link t
       'action (lambda (&rest _ignore)
                 (with-output-to-temp-buffer
                     "*Pp Eval Output*"
                   (princ pp)))
       'help-echo "mouse-2, RET: pretty print value in another buffer"))))