Function: ses-yank-one

ses-yank-one is a byte-compiled function defined in ses.el.gz.

Signature

(ses-yank-one ROWCOL TEXT FROM TO ARG)

Documentation

Insert the substring [FROM,TO] of TEXT as the formula for cell ROWCOL (a cons of ROW and COL). Treat plain symbols as strings unless ARG is a list.

Source Code

;; Defined in /usr/src/emacs/lisp/ses.el.gz
(defun ses-yank-one (rowcol text from to arg)
  "Insert the substring [FROM,TO] of TEXT as the formula for cell ROWCOL (a
cons of ROW and COL).  Treat plain symbols as strings unless ARG is a list."
  (let ((val (condition-case nil
		 (read-from-string text from to)
	       (error (cons nil from)))))
    (cond
     ((< (cdr val) (or to (length text)))
      ;; Invalid sexp --- leave it as a string.
      (setq val (substring text from to)))
     ((and (car val) (symbolp (car val)))
      (setq val (if (consp arg)
		    (list 'quote (car val))   ; Keep symbol.
		  (substring text from to)))) ; Treat symbol as text.
     (t
      (setq val (car val))))
    (let ((row (car rowcol))
	  (col (cdr rowcol)))
      (or (atom val)
	  (setq val `(ses-safe-formula ,val)))
      (ses-cell-set-formula row col val))))