Function: math-format-nice-expr

math-format-nice-expr is a byte-compiled function defined in calc-ext.el.gz.

Signature

(math-format-nice-expr X W)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-ext.el.gz
(defun math-format-nice-expr (x w)
  (cond ((and (eq (car-safe x) 'vec)
	      (cdr (cdr x))
	      (let ((ops '(vec calcFunc-assign calcFunc-condition
			       calcFunc-schedule calcFunc-iterations
			       calcFunc-phase)))
		(or (memq (car-safe (nth 1 x)) ops)
		    (memq (car-safe (nth 2 x)) ops)
		    (memq (car-safe (nth 3 x)) ops)
		    calc-break-vectors)))
	 (concat "[ " (math-format-flat-vector (cdr x) ",\n  " 0) " ]"))
	(t
	 (let ((str (math-format-flat-expr x 0))
	       (pos 0) p)
	   (or (string-search "\"" str)
	       (while (<= (setq p (+ pos w)) (length str))
		 (while (and (> (setq p (1- p)) pos)
			     (not (= (aref str p) ? ))))
		 (if (> p (+ pos 5))
		     (setq str (concat (substring str 0 p)
				       "\n "
				       (substring str p))
			   pos (1+ p))
		   (setq pos (+ pos w)))))
	   str))))