Function: calc-copy-to-register

calc-copy-to-register is an autoloaded, interactive and byte-compiled function defined in calc-yank.el.gz.

Signature

(calc-copy-to-register REGISTER START END &optional DELETE-FLAG)

Documentation

Copy the lines in the region into register REGISTER.

With prefix arg, delete as well.

Interactively, reads the register using register-read-with-preview.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-yank.el.gz
(defun calc-copy-to-register (register start end &optional delete-flag)
  "Copy the lines in the region into register REGISTER.
With prefix arg, delete as well.

Interactively, reads the register using `register-read-with-preview'."
  (interactive (list (register-read-with-preview "Copy to register: ")
		     (region-beginning) (region-end)
		     current-prefix-arg))
  (if (eq major-mode 'calc-mode)
      (let* ((top-num (calc-locate-cursor-element start))
             (top-pos (save-excursion
                        (calc-cursor-stack-index top-num)
                        (point)))
             (bot-num (calc-locate-cursor-element (1- end)))
             (bot-pos (save-excursion
                        (calc-cursor-stack-index (max 0 (1- bot-num)))
                        (point)))
             (num (- top-num bot-num -1))
             (str (buffer-substring top-pos bot-pos)))
        (calc-set-register register str (calc-top-list num bot-num))
        (if delete-flag
            (calc-wrapper
             (calc-pop-stack num bot-num))))
    (copy-to-register register start end delete-flag)))