Function: calc-add-to-register
calc-add-to-register is a byte-compiled function defined in
calc-yank.el.gz.
Signature
(calc-add-to-register REGISTER START END PREPEND DELETE-FLAG)
Documentation
Add the lines in the region to register REGISTER.
If PREPEND is non-nil, add them to the beginning of the register, otherwise the end. If DELETE-FLAG is non-nil, also delete the region.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-yank.el.gz
(defun calc-add-to-register (register start end prepend delete-flag)
"Add the lines in the region to register REGISTER.
If PREPEND is non-nil, add them to the beginning of the register,
otherwise the end. If DELETE-FLAG is non-nil, also delete the region."
(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))
(calcval (calc-top-list num bot-num))
(cval (cdr (assq register calc-register-alist))))
(if (not cval)
(calc-set-register register str calcval)
(if prepend
(calc-set-register
register
(concat str (car cval))
(append calcval (cdr cval)))
(calc-set-register
register
(concat (car cval) str)
(append (cdr cval) calcval))))
(if delete-flag
(calc-wrapper
(calc-pop-stack num bot-num)))))