515 |
|
|
516 |
(defun ses-create-cell-variable-range (minrow maxrow mincol maxcol) |
(defun ses-create-cell-variable-range (minrow maxrow mincol maxcol) |
517 |
"Create buffer-local variables for cells. This is undoable." |
"Create buffer-local variables for cells. This is undoable." |
518 |
(push `(ses-destroy-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol) |
(push `(apply ses-destroy-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol) |
519 |
buffer-undo-list) |
buffer-undo-list) |
520 |
(let (sym xrow xcol) |
(let (sym xrow xcol) |
521 |
(dotimes (row (1+ (- maxrow minrow))) |
(dotimes (row (1+ (- maxrow minrow))) |
536 |
(dotimes (col (1+ (- maxcol mincol))) |
(dotimes (col (1+ (- maxcol mincol))) |
537 |
(setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol))) |
(setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol))) |
538 |
(if (boundp sym) |
(if (boundp sym) |
539 |
(push `(ses-set-with-undo ,sym ,(symbol-value sym)) |
(push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) |
540 |
buffer-undo-list)) |
buffer-undo-list)) |
541 |
(kill-local-variable sym)))) |
(kill-local-variable sym)))) |
542 |
(push `(ses-create-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol) |
(push `(apply ses-create-cell-variable-range ,minrow ,maxrow ,mincol ,maxcol) |
543 |
buffer-undo-list)) |
buffer-undo-list)) |
544 |
|
|
545 |
(defun ses-reset-header-string () |
(defun ses-reset-header-string () |
546 |
"Flags the header string for update. Upon undo, the header string will be |
"Flags the header string for update. Upon undo, the header string will be |
547 |
updated again." |
updated again." |
548 |
(push '(ses-reset-header-string) buffer-undo-list) |
(push '(apply ses-reset-header-string) buffer-undo-list) |
549 |
(setq ses--header-hscroll -1)) |
(setq ses--header-hscroll -1)) |
550 |
|
|
551 |
;;Split this code off into a function to avoid coverage-testing difficulties |
;;Split this code off into a function to avoid coverage-testing difficulties |
1325 |
(equal (symbol-value sym) newval) |
(equal (symbol-value sym) newval) |
1326 |
(not (stringp newval))) |
(not (stringp newval))) |
1327 |
(push (if (boundp sym) |
(push (if (boundp sym) |
1328 |
`(ses-set-with-undo ,sym ,(symbol-value sym)) |
`(apply ses-set-with-undo ,sym ,(symbol-value sym)) |
1329 |
`(ses-unset-with-undo ,sym)) |
`(apply ses-unset-with-undo ,sym)) |
1330 |
buffer-undo-list) |
buffer-undo-list) |
1331 |
(set sym newval) |
(set sym newval) |
1332 |
t)) |
t)) |
1334 |
(defun ses-unset-with-undo (sym) |
(defun ses-unset-with-undo (sym) |
1335 |
"Set SYM to be unbound. This is undoable." |
"Set SYM to be unbound. This is undoable." |
1336 |
(when (1value (boundp sym)) ;;Always bound, except after a programming error |
(when (1value (boundp sym)) ;;Always bound, except after a programming error |
1337 |
(push `(ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list) |
(push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list) |
1338 |
(makunbound sym))) |
(makunbound sym))) |
1339 |
|
|
1340 |
(defun ses-aset-with-undo (array idx newval) |
(defun ses-aset-with-undo (array idx newval) |
1341 |
"Like aset, but undoable. Result is t if element has changed" |
"Like aset, but undoable. Result is t if element has changed" |
1342 |
(unless (equal (aref array idx) newval) |
(unless (equal (aref array idx) newval) |
1343 |
(push `(ses-aset-with-undo ,array ,idx ,(aref array idx)) buffer-undo-list) |
(push `(apply ses-aset-with-undo ,array ,idx ,(aref array idx)) buffer-undo-list) |
1344 |
(aset array idx newval) |
(aset array idx newval) |
1345 |
t)) |
t)) |
1346 |
|
|
2066 |
(dotimes (col ses--numcols) |
(dotimes (col ses--numcols) |
2067 |
(aset newrow col (ses-make-cell))) |
(aset newrow col (ses-make-cell))) |
2068 |
(setq ses--cells (ses-vector-insert ses--cells row newrow)) |
(setq ses--cells (ses-vector-insert ses--cells row newrow)) |
2069 |
(push `(ses-vector-delete ses--cells ,row 1) buffer-undo-list) |
(push `(apply ses-vector-delete ses--cells ,row 1) buffer-undo-list) |
2070 |
(insert ses--blank-line)) |
(insert ses--blank-line)) |
2071 |
;;Insert empty lines in cell data area (will be replaced by |
;;Insert empty lines in cell data area (will be replaced by |
2072 |
;;ses-relocate-all) |
;;ses-relocate-all) |