Next: Nonrelocatable references, Up: For Gurus [Contents][Index]

### 5.1 Deferred updates

To save time by avoiding redundant computations, cells that need recalculation due to changes in other cells are added to a set. At the end of the command, each cell in the set is recalculated once. This can create a new set of cells that need recalculation. The process is repeated until either the set is empty or it stops changing (due to circular references among the cells). In extreme cases, you might see progress messages of the form “Recalculating... (nnn cells left)”. If you interrupt the calculation using `C-g`, the spreadsheet will be left in an inconsistent state, so use `C-_` or `C-c C-l` to fix it.

To save even more time by avoiding redundant writes, cells that have changes are added to a set instead of being written immediately to the data area. Each cell in the set is written once, at the end of the command. If you change vast quantities of cells, you might see a progress message of the form “Writing... (nnn cells left)”. These deferred cell-writes cannot be interrupted by `C-g`, so you’ll just have to wait.

SES uses `run-with-idle-timer` to move the cell underline when Emacs will be scrolling the buffer after the end of a command, and also to narrow and underline after `C-x C-v`. This is visible as a momentary glitch after C-x C-v and certain scrolling commands. You can type ahead without worrying about the glitch.