Function: ses-yank-resize

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

Signature

(ses-yank-resize NEEDROWS NEEDCOLS)

Documentation

If this yank will require inserting rows and/or columns, ask for confirmation and then insert them. Result is (row,col) for top left of yank spot, or error signal if user requests cancel.

Source Code

;; Defined in /usr/src/emacs/lisp/ses.el.gz
(defun ses-yank-resize (needrows needcols)
  "If this yank will require inserting rows and/or columns, ask for
confirmation and then insert them.  Result is (row,col) for top left of yank
spot, or error signal if user requests cancel."
  (ses-begin-change)
  (let ((rowcol (if ses--curcell
		    (ses-sym-rowcol ses--curcell)
		  (cons ses--numrows 0)))
	rowbool colbool)
    (setq needrows (- (+ (car rowcol) needrows) ses--numrows)
	  needcols (- (+ (cdr rowcol) needcols) ses--numcols)
	  rowbool  (> needrows 0)
	  colbool  (> needcols 0))
    (when (or rowbool colbool)
      ;;Need to insert.  Get confirm
      (or (y-or-n-p (format "Yank will insert %s%s%s.  Continue? "
			    (if rowbool (format "%d rows" needrows) "")
			    (if (and rowbool colbool) " and " "")
			    (if colbool (format "%d columns" needcols) "")))
	  (error "Canceled"))
      (when rowbool
	(let (ses--curcell)
	  (save-excursion
	    (ses-goto-print ses--numrows 0)
	    (ses-insert-row needrows))))
      (when colbool
	  (ses-insert-column needcols
			     ses--numcols
			     (ses-col-width (1- ses--numcols))
			     (ses-col-printer (1- ses--numcols)))))
    rowcol))