Function: calc--edit-mode

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

Signature

(calc--edit-mode HANDLER &optional ALLOW-RET TITLE)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-yank.el.gz
(defun calc--edit-mode (handler &optional allow-ret title)
  (unless handler
    (error "This command can be used only indirectly through calc-edit"))
  (let ((oldbuf (current-buffer))
	(buf (get-buffer-create "*Calc Edit*")))
    (set-buffer buf)
    (calc-edit-mode)
    (setq-local calc-original-buffer oldbuf)
    (setq-local calc-return-buffer oldbuf)
    (setq-local calc-one-window (and (one-window-p t) pop-up-windows))
    (setq-local calc-edit-handler handler)
    (setq-local calc-restore-trail (get-buffer-window (calc-trail-buffer)))
    (setq-local calc-allow-ret allow-ret)
    (let ((inhibit-read-only t))
      (erase-buffer))
    (add-hook 'kill-buffer-hook (lambda ()
                                  (let ((calc-edit-handler nil))
                                    (calc-edit-finish t))
                                  (message "(Canceled)"))
              t t)
    (insert (propertize
             (concat
              (or title title "Calc Edit Mode. ")
              (substitute-command-keys "Press \\`C-c C-c'")
              (if allow-ret "" " or RET")
              (substitute-command-keys " to finish, \\`C-x k RET' to cancel.\n\n"))
             'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t))
    (setq-local calc-edit-top (point))))