Function: calc-do-quick-calc
calc-do-quick-calc is an autoloaded and byte-compiled function defined
in calc-aent.el.gz.
Signature
(calc-do-quick-calc &optional INSERT)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-aent.el.gz
;;;###autoload
(defun calc-do-quick-calc (&optional insert)
(require 'calc-ext)
(calc-check-defines)
(if (eq major-mode 'calc-mode)
(calc-algebraic-entry t)
(let (buf shortbuf)
(save-excursion
(calc-create-buffer)
(let* ((calc-command-flags nil)
(calc-dollar-values calc-quick-prev-results)
(calc-dollar-used 0)
(enable-recursive-minibuffers t)
(calc-language (if (memq calc-language '(nil big))
'flat calc-language))
(entry (calc-do-alg-entry "" "Quick calc: " t 'calc-quick-calc-history))
(alg-exp (mapcar 'math-evaluate-expr entry)))
(when (and (= (length alg-exp) 1)
(eq (car-safe (car alg-exp)) 'calcFunc-assign)
(= (length (car alg-exp)) 3)
(eq (car-safe (nth 1 (car alg-exp))) 'var))
(set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
(calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
(setq alg-exp (list (nth 2 (car alg-exp)))))
(setq calc-quick-prev-results alg-exp
buf (mapconcat (lambda (x)
(math-format-value x 1000))
alg-exp
" ")
shortbuf buf)
(if (and (= (length alg-exp) 1)
(memq (car-safe (car alg-exp)) '(nil))
(< (length buf) 20)
(= calc-number-radix 10))
(setq buf (concat buf " ("
(let ((calc-number-radix 16))
(math-format-value (car alg-exp) 1000))
", "
(let ((calc-number-radix 8))
(math-format-value (car alg-exp) 1000))
", "
(let ((calc-number-radix 2))
(math-format-value (car alg-exp) 1000))
(if (and (integerp (car alg-exp))
(> (car alg-exp) 0)
(< (car alg-exp) 127))
(format ", \"%c\"" (car alg-exp))
"")
")")))
(if (and (< (length buf) (frame-width)) (= (length entry) 1)
(featurep 'calc-ext))
(let ((long (concat (math-format-value (car entry) 1000)
" => " buf)))
(if (<= (length long) (- (frame-width) 8))
(setq buf long))))
(calc-handle-whys)
(message "Result: %s" buf)))
(if (or insert
(eq last-command-event 10))
(insert shortbuf)
(kill-new shortbuf)))))