Function: calc-finish-stack-edit

calc-finish-stack-edit is an autoloaded and byte-compiled function defined in calc-yank.el.gz.

Signature

(calc-finish-stack-edit NUM)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-yank.el.gz
(defun calc-finish-stack-edit (num)
  (let ((buf (current-buffer))
	(str (buffer-substring calc-edit-top (point-max)))
	(start (point))
	pos)
    (if (and (integerp num) (> num 1))
	(while (setq pos (string-match "\n." str))
	  (aset str pos ?\,)))
    (switch-to-buffer calc-original-buffer)
    (let ((vals (let ((calc-language nil)
		      (math-expr-opers (math-standard-ops)))
		  (and (string-match "[^\n\t ]" str)
		       (math-read-exprs str)))))
      (when (eq (car-safe vals) 'error)
	(switch-to-buffer buf)
	(goto-char (+ start (nth 1 vals)))
	(error (nth 2 vals)))
      (calc-wrapper
       (if (symbolp num)
	   (progn
	     (set num (car vals))
	     (calc-refresh-evaltos num))
	 (if calc-edit-disp-trail
	     (calc-trail-display 1 t))
	 (and vals
	      (let ((calc-simplify-mode (if (eq last-command-event ?\C-j)
					    'none
					  calc-simplify-mode)))
		(if (>= num 0)
		    (calc-enter-result num "edit" vals)
		  (calc-enter-result 1 "edit" vals (- num))))))))))