Function: calc-quit
calc-quit is an interactive and byte-compiled function defined in
calc.el.gz.
Signature
(calc-quit &optional NON-FATAL INTERACTIVE)
Documentation
Quit the Calculator in an appropriate manner.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc.el.gz
(defun calc-quit (&optional non-fatal interactive)
"Quit the Calculator in an appropriate manner."
(interactive "i\np")
(and calc-standalone-flag (not non-fatal)
(save-buffers-kill-emacs nil))
(if (and (equal (buffer-name) "*Gnuplot Trail*")
(> (recursion-depth) 0))
(exit-recursive-edit))
(if (derived-mode-p 'calc-edit-mode)
(calc-edit-cancel)
(if (and interactive
calc-embedded-info
(eq (current-buffer) (aref calc-embedded-info 0)))
(calc-embedded nil)
(unless (derived-mode-p 'calc-mode)
(calc-create-buffer))
(run-hooks 'calc-end-hook)
(if (integerp calc-undo-length)
(cond
((= calc-undo-length 0)
(setq calc-undo-list nil calc-redo-list nil))
((> calc-undo-length 0)
(let ((tail (nthcdr (1- calc-undo-length) calc-undo-list)))
(if tail (setcdr tail nil)))
(setq calc-redo-list nil))))
(mapc (lambda (v) (set-default v (symbol-value v)))
calc-local-var-list)
(let ((buf (current-buffer))
(win (get-buffer-window (current-buffer)))
(kbuf (get-buffer "*Calc Keypad*")))
(delete-windows-on (calc-trail-buffer))
;; The next few lines will set `calc-window-height' so that the
;; next time Calc is called, the window will be the same size
;; as the current window.
(if (and win
(not (window-full-height-p win))
(window-full-width-p win) ; avoid calc-keypad
(not (get-buffer-window "*Calc Keypad*")))
(setq calc-window-height (- (window-height win) 2)))
(progn
(delete-windows-on buf)
(and kbuf (delete-windows-on kbuf)))
(bury-buffer buf)
(bury-buffer calc-trail-buffer)
(and kbuf (bury-buffer kbuf))))))