1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../../info/ses
4 @settitle SES: Simple Emacs Spreadsheet
12 This file documents SES: the Simple Emacs Spreadsheet.
14 Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007, 2008
15 Free Software Foundation, Inc.
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.2 or
20 any later version published by the Free Software Foundation; with no
21 Invariant Sections, with the Front-Cover texts being ``A GNU
22 Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the
23 license is included in the section entitled ``GNU Free Documentation
24 License'' in the Emacs manual.
26 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
27 this GNU Manual, like GNU software. Copies published by the Free
28 Software Foundation raise funds for GNU development.''
30 This document is part of a collection distributed under the GNU Free
31 Documentation License. If you want to distribute this document
32 separately from the collection, you can do so by adding a copy of the
33 license to the document, as described in section 6 of the license.
39 * SES: (ses). Simple Emacs Spreadsheet
46 @subtitle Simple Emacs Spreadsheet
47 @author Jonathan A. Yavner
48 @author @email{jyavner@@member.fsf.org}
51 @vskip 0pt plus 1filll
57 @c ===================================================================
60 @node Top, Sales Pitch, (dir), (dir)
61 @comment node-name, next, previous, up
62 @top SES: Simple Emacs Spreadsheet
65 SES is a major mode for GNU Emacs to edit spreadsheet files, which
66 contain a rectangular grid of cells. The cells' values are specified
67 by formulas that can refer to the values of other cells.
71 To report bugs, send email to @email{jyavner@@member.fsf.org}.
74 * Sales Pitch:: Why use SES?
75 * The Basics:: Basic spreadsheet commands
76 * Advanced Features:: Want to know more?
77 * For Gurus:: Want to know @emph{even more}?
78 * Index:: Concept, Function and Variable Index
79 * Acknowledgements:: Acknowledgements
80 * GNU Free Documentation License:: The license for this documentation.
83 @c ===================================================================
85 @node Sales Pitch, The Basics, Top, Top
86 @comment node-name, next, previous, up
91 @item Create and edit simple spreadsheets with a minimum of fuss.
92 @item Full undo/redo/autosave.
93 @item Immune to viruses in spreadsheet files.
94 @item Cell formulas are straight Emacs Lisp.
95 @item Printer functions for control of cell appearance.
96 @item Intuitive keystroke commands: C-o = insert row, M-o = insert column, etc.
97 @item ``Spillover'' of lengthy cell values into following blank cells.
98 @item Header line shows column letters or a selected row.
99 @item Completing-read for entering symbols as cell values.
100 @item Cut, copy, and paste can transfer formulas and printer functions.
101 @item Import and export of tab-separated values or tab-separated formulas.
102 @item Plaintext, easily-hacked file format.
105 @c ===================================================================
107 @node The Basics, Advanced Features, Sales Pitch, Top
108 @comment node-name, next, previous, up
110 @cindex basic commands
113 @findex ses-mark-column
114 @findex ses-mark-whole-buffer
115 @findex set-mark-command
116 @findex keyboard-quit
118 To create a new spreadsheet, visit a nonexistent file whose name ends
119 with ".ses". For example, @kbd{C-x C-f test.ses RET}.
122 A @dfn{cell identifier} is a symbol with a column letter and a row
123 number. Cell B7 is the 2nd column of the 7th row. For very wide
124 spreadsheets, there are two column letters: cell AB7 is the 28th
125 column of the 7th row. Super wide spreadsheets get AAA1, etc.
129 Moves point to cell, specified by identifier (@code{ses-jump}).
132 Point is always at the left edge of a cell, or at the empty endline.
133 When mark is inactive, the current cell is underlined. When mark is
134 active, the range is the highlighted rectangle of cells (SES always
135 uses transient mark mode). Drag the mouse from A1 to A3 to create the
136 range A1-A2. Many SES commands operate only on single cells, not
142 Set mark at point (@code{set-mark-command}).
145 Turn off the mark (@code{keyboard-quit}).
148 Highlight current row (@code{ses-mark-row}).
151 Highlight current column (@code{ses-mark-column}).
154 Highlight all cells (@code{mark-whole-buffer}).
160 * Printer functions::
166 @node Formulas, Resizing, The Basics, The Basics
167 @section Cell formulas
169 @cindex formulas, entering
170 @findex ses-read-cell
171 @findex ses-read-symbol
172 @findex ses-edit-cell
173 @findex ses-recalculate-cell
174 @findex ses-recalculate-all
176 To enter a number into the current cell, just start typing:
180 Self-insert a digit (@code{ses-read-cell}).
183 Self-insert a negative number (@code{ses-read-cell}).
186 Self-insert a fractional number (@code{ses-read-cell}).
189 Self-insert a quoted string. The ending double-quote
190 is inserted for you (@code{ses-read-cell}).
193 Self-insert an expression. The right-parenthesis is inserted for you
194 (@code{ses-read-cell}). To access another cell's value, just use its
195 identifier in your expression. Whenever the other cell is changed,
196 this cell's formula will be reevaluated. While typing in the
197 expression, you can use @kbd{M-@key{TAB}} to complete symbol names.
199 @item ' @r{(apostrophe)}
200 Enter a symbol (ses-read-symbol). SES remembers all symbols that have
201 been used as formulas, so you can type just the beginning of a symbol
202 and use @kbd{@key{SPC}}, @kbd{@key{TAB}}, and @kbd{?} to complete it.
205 To enter something else (e.g., a vector), begin with a digit, then
206 erase the digit and type whatever you want.
210 Edit the existing formula in the current cell (@code{ses-edit-cell}).
213 Force recalculation of the current cell or range (@code{ses-recalculate-cell}).
216 Recalculate the entire spreadsheet (@code{ses-recalculate-all}).
219 @node Resizing, Printer functions, Formulas, The Basics
220 @section Resizing the spreadsheet
221 @cindex resizing spreadsheets
222 @findex ses-insert-row
223 @findex ses-insert-column
224 @findex ses-delete-row
225 @findex ses-delete-column
226 @findex ses-set-column-width
227 @findex ses-forward-or-insert
228 @findex ses-append-row-jump-first-column
235 (@code{ses-insert-row})
238 (@code{ses-insert-column})
241 (@code{ses-delete-row})
244 (@code{ses-delete-column})
247 (@code{ses-set-column-width})
250 Moves point to the next rightward cell, or inserts a new column if
251 already at last cell on line, or inserts a new row if at endline
252 (@code{ses-forward-or-insert}).
255 Linefeed inserts below the current row and moves to column A
256 (@code{ses-append-row-jump-first-column}).
259 Resizing the spreadsheet (unless you're just changing a column width)
260 relocates all the cell-references in formulas so they still refer to
261 the same cells. If a formula mentioned B1 and you insert a new first
262 row, the formula will now mention B2.
264 If you delete a cell that a formula refers to, the cell-symbol is
265 deleted from the formula, so @code{(+ A1 B1 C1)} after deleting the third
266 column becomes @code{(+ A1 B1)}. In case this is not what you wanted:
271 Undo previous action (@code{(undo)}).
275 @node Printer functions, Clearing cells, Resizing, The Basics
276 @section Printer functions
277 @cindex printer functions
278 @findex ses-read-cell-printer
279 @findex ses-read-column-printer
280 @findex ses-read-default-printer
282 @findex ses-center-span
284 @findex ses-dashfill-span
285 @findex ses-tildefill-span
288 Printer functions convert binary cell values into the print forms that
289 Emacs will display on the screen.
291 A printer can be a format string, like @samp{"$%.2f"}. The result
292 string is right-aligned within the print cell. To get left-alignment,
293 use parentheses: @samp{("$%.2f")}. A printer can also be a
294 one-argument function (a symbol or a lambda), whose result is a string
295 (right-aligned) or list of one string (left-aligned). While typing in
296 a lambda, you can use @kbd{M-@key{TAB}} to complete the names of symbols.
298 Each cell has a printer. If @code{nil}, the column-printer for the cell's
299 column is used. If that is also @code{nil}, the default-printer for the
304 Enter a printer for current cell or range (@code{ses-read-cell-printer}).
307 Enter a printer for the current column (@code{ses-read-column-printer}).
310 Enter the default printer for the spreadsheet
311 (@code{ses-read-default-printer}).
314 The @code{ses-read-@r{XXX}-printer} commands have their own minibuffer
315 history, which is preloaded with the set of all printers used in this
316 spreadsheet, plus the standard printers.
318 The standard printers are suitable only for cells, not columns or
319 default, because they format the value using the column-printer (or
320 default-printer if @code{nil}) and then center the result:
326 @item ses-center-span
327 Centering with spill-over to following blank cells.
330 Centering using dashes (-) instead of spaces.
332 @item ses-dashfill-span
333 Centering with dashes and spill-over.
335 @item ses-tildefill-span
336 Centering with tildes (~) and spill-over.
340 @node Clearing cells, Copy/cut/paste, Printer functions, The Basics
341 @section Clearing cells
342 @cindex clearing commands
343 @findex ses-clear-cell-backward
344 @findex ses-clear-cell-forward
346 These commands set both formula and printer to @code{nil}:
350 Clear cell and move left (@code{ses-clear-cell-backward}).
353 Clear cell and move right (@code{ses-clear-cell-forward}).
357 @node Copy/cut/paste, Customizing SES, Clearing cells, The Basics
358 @section Copy, cut, and paste
362 @findex kill-ring-save
363 @findex mouse-set-region
364 @findex mouse-set-secondary
365 @findex ses-kill-override
367 @findex clipboard-yank
368 @findex mouse-yank-at-click
369 @findex mouse-yank-at-secondary
372 The copy functions work on rectangular regions of cells. You can paste the
373 copies into non-SES buffers to export the print text.
379 Copy the highlighted cells to kill ring and primary clipboard
380 (@code{kill-ring-save}).
383 Mark a region and copy it to kill ring and primary clipboard
384 (@code{mouse-set-region}).
386 @item [M-drag-mouse-1]
387 Mark a region and copy it to kill ring and secondary clipboard
388 (@code{mouse-set-secondary}).
393 The cut functions do not actually delete rows or columns---they copy
394 and then clear (@code{ses-kill-override}).
398 Paste from kill ring (@code{yank}). The paste functions behave
399 differently depending on the format of the text being inserted:
402 When pasting cells that were cut from a SES buffer, the print text is
403 ignored and only the attached formula and printer are inserted; cell
404 references in the formula are relocated unless you use @kbd{C-u}.
406 The pasted text overwrites a rectangle of cells whose top left corner
407 is the current cell. If part of the rectangle is beyond the edges of
408 the spreadsheet, you must confirm the increase in spreadsheet size.
410 Non-SES text is usually inserted as a replacement formula for the
411 current cell. If the formula would be a symbol, it's treated as a
412 string unless you use @kbd{C-u}. Pasted formulas with syntax errors
413 are always treated as strings.
417 Paste from primary clipboard or kill ring (@code{clipboard-yank}).
420 Set point and paste from primary clipboard (@code{mouse-yank-at-click}).
423 Set point and paste from secondary clipboard (@code{mouse-yank-secondary}).
426 Immediately after a paste, you can replace the text with a preceding
427 element from the kill ring (@code{ses-yank-pop}). Unlike the standard
428 Emacs yank-pop, the SES version uses @code{undo} to delete the old
429 yank. This doesn't make any difference?
432 @node Customizing SES, , Copy/cut/paste, The Basics
433 @section Customizing SES
435 @vindex enable-local-eval
436 @vindex ses-mode-hook
437 @vindex safe-functions
438 @vindex enable-local-eval
441 By default, a newly-created spreadsheet has 1 row and 1 column. The
442 column width is 7 and the default printer is @samp{"%.7g"}. Each of these
443 can be customized. Look in group ``ses''.
445 After entering a cell value, point normally moves right to the next
446 cell. You can customize @code{ses-after-entry-functions} to move left or
447 up or down. For diagonal movement, select two functions from the
450 @code{ses-mode-hook} is a normal mode hook (list of functions to
451 execute when starting SES mode for a buffer).
453 The variable @code{safe-functions} is a list of possibly-unsafe
454 functions to be treated as safe when analysing formulas and printers.
455 @xref{Virus protection}. Before customizing @code{safe-functions},
456 think about how much you trust the person who's suggesting this
457 change. The value @code{t} turns off all anti-virus protection. A
458 list-of-functions value might enable a ``gee whiz'' spreadsheet, but it
459 also creates trapdoors in your anti-virus armor. In order for virus
460 protection to work, you must always press @kbd{n} when presented with
461 a virus warning, unless you understand what the questionable code is
462 trying to do. Do not listen to those who tell you to customize
463 @code{enable-local-eval}---this variable is for people who don't wear
467 @c ===================================================================
469 @node Advanced Features, For Gurus, The Basics, Top
470 @chapter Advanced Features
471 @cindex advanced features
472 @findex ses-read-header-row
477 (@code{ses-set-header-row}). The header line at the top of the SES
478 window normally shows the column letter for each column. You can set
479 it to show a copy of some row, such as a row of column titles, so that
480 row will always be visible. Default is to set the current row as the
481 header; use C-u to prompt for header row. Set the header to row 0 to
482 show column letters again.
483 @item [header-line mouse-3]
484 Pops up a menu to set the current row as the header, or revert to
490 * Ranges in formulas::
491 * Sorting by column::
492 * Standard formula functions::
493 * More on cell printing::
494 * Import and export::
496 * Spreadsheets with details and summary::
499 @node The print area, Ranges in formulas, Advanced Features, Advanced Features
500 @section The print area
503 @findex ses-renarrow-buffer
504 @findex ses-reprint-all
506 A SES file consists of a print area and a data area. Normally the
507 buffer is narrowed to show only the print area. The print area is
508 read-only except for special SES commands; it contains cell values
509 formatted by printer functions. The data area records the formula and
510 printer functions, etc.
514 Show print and data areas (@code{widen}).
517 Show only print area (@code{ses-renarrow-buffer}).
521 Recreate print area by reevaluating printer functions for all cells
522 (@code{ses-reprint-all}).
525 @node Ranges in formulas, Sorting by column, The print area, Advanced Features
526 @section Ranges in formulas
528 @findex ses-insert-range-click
529 @findex ses-insert-range
530 @findex ses-insert-ses-range-click
531 @findex ses-insert-ses-range
539 is the sum of three specific cells. If you insert a new second row,
544 and the new row is not included in the sum.
546 The macro @code{(ses-range @var{from} @var{to})} evaluates to a list of
547 the values in a rectangle of cells. If your formula is
549 (apply '+ (ses-range A1 A3))
551 and you insert a new second row, it becomes
553 (apply '+ (ses-range A1 A4))
555 and the new row is included in the sum.
557 While entering or editing a formula in the minibuffer, you can select
558 a range in the spreadsheet (using mouse or keyboard), then paste a
559 representation of that range into your formula. Suppose you select
564 Inserts "A1 B1 C1" @code{(ses-insert-range-click})
567 Keyboard version (@code{ses-insert-range}).
570 Inserts "(ses-range A1 C1)" (@code{ses-insert-ses-range-click}).
573 Keyboard version (@code{ses-insert-ses-range}).
576 If you delete the @var{from} or @var{to} cell for a range, the nearest
577 still-existing cell is used instead. If you delete the entire range,
578 the formula relocator will delete the ses-range from the formula.
580 If you insert a new row just beyond the end of a one-column range, or
581 a new column just beyond a one-row range, the new cell is included in
582 the range. New cells inserted just before a range are not included.
585 @node Sorting by column, Standard formula functions, Ranges in formulas, Advanced Features
586 @section Sorting by column
588 @findex ses-sort-column
589 @findex ses-sort-column-click
593 Sort the cells of a range using one of the columns
594 (@code{ses-sort-column}). The rows (or partial rows if the range
595 doesn't include all columns) are rearranged so the chosen column will
598 @item [header-line mouse-2]
599 The easiest way to sort is to click mouse-2 on the chosen column's header row
600 (@code{ses-sort-column-click}).
603 The sort comparison uses @code{string<}, which works well for
604 right-justified numbers and left-justified strings.
606 With prefix arg, sort is in descending order.
608 Rows are moved one at a time, with relocation of formulas. This works
609 well if formulas refer to other cells in their row, not so well for
610 formulas that refer to other rows in the range or to cells outside the
614 @node Standard formula functions, More on cell printing, Sorting by column, Advanced Features
615 @section Standard formula functions
616 @cindex standard formula functions
619 @findex ses-delete-blanks
623 Oftentimes you want a calculation to exclude the blank cells. Here
624 are some useful functions to call from your formulas:
627 @item (ses-delete-blanks &rest @var{args})
628 Returns a list from which all blank cells (value is either @code{nil} or
629 '*skip*) have been deleted.
631 @item (ses+ &rest @var{args})
632 Sum of non-blank arguments.
634 @item (ses-average @var{list})
635 Average of non-blank elements in @var{list}. Here the list is passed
636 as a single argument, since you'll probably use it with @code{ses-range}.
639 @node More on cell printing, Import and export, Standard formula functions, Advanced Features
640 @section More on cell printing
641 @cindex cell printing, more
642 @findex ses-truncate-cell
643 @findex ses-recalculate-cell
647 @item nil prints the same as "", but allows previous cell to spill over.
648 @item '*skip* replaces nil when the previous cell actually does spill over;
649 nothing is printed for it.
650 @item '*error* indicates that the formula signaled an error instead of
651 producing a value: the print cell is filled with hash marks (#).
654 If the result from the printer function is too wide for the cell and
655 the following cell is @code{nil}, the result will spill over into the
656 following cell. Very wide results can spill over several cells. If
657 the result is too wide for the available space (up to the end of the
658 row or the next non-@code{nil} cell), the result is truncated if the cell's
659 value is a string, or replaced with hash marks otherwise.
661 SES could get confused by printer results that contain newlines or
662 tabs, so these are replaced with question marks.
666 Confine a cell to its own column (@code{ses-truncate-cell}). This
667 allows you to move point to a rightward cell that would otherwise be
668 covered by a spill-over. If you don't change the rightward cell, the
669 confined cell will spill over again the next time it is reprinted.
672 When applied to a single cell, this command displays in the echo area
673 any formula error or printer error that occurred during
674 recalculation/reprinting (@code{ses-recalculate-cell}). You can use
675 this to undo the effect of @kbd{t}.
678 When a printer function signals an error, the fallback printer
679 @samp{"%s"} is substituted. This is useful when your column printer
680 is numeric-only and you use a string as a cell value. Note that the
681 standard default printer is ``%.7g'' which is numeric-only, so cells
682 that are empty of contain strings will use the fallback printer.
683 @kbd{c} on such cells will display ``Format specifier doesn't match
687 @node Import and export, Virus protection, More on cell printing, Advanced Features
688 @section Import and export
689 @cindex import and export
690 @cindex export, and import
691 @findex ses-export-tsv
692 @findex ses-export-tsf
696 Export a range of cells as tab-separated values (@code{ses-export-tsv}).
698 Export a range of cells as tab-separated formulas (@code{ses-export-tsf}).
701 The exported text goes to the kill ring --- you can paste it into
702 another buffer. Columns are separated by tabs, rows by newlines.
704 To import text, use any of the yank commands where the text to paste
705 contains tabs and/or newlines. Imported formulas are not relocated.
707 @node Virus protection, Spreadsheets with details and summary, Import and export, Advanced Features
708 @section Virus protection
709 @cindex virus protection
711 Whenever a formula or printer is read from a file or is pasted into
712 the spreadsheet, it receives a ``needs safety check'' marking. Later,
713 when the formula or printer is evaluated for the first time, it is
714 checked for safety using the @code{unsafep} predicate; if found to be
715 ``possibly unsafe'', the questionable formula or printer is displayed
716 and you must press Y to approve it or N to use a substitute. The
717 substitute always signals an error.
719 Formulas or printers that you type in are checked immediately for
720 safety. If found to be possibly unsafe and you press N to disapprove,
721 the action is canceled and the old formula or printer will remain.
723 Besides viruses (which try to copy themselves to other files),
724 @code{unsafep} can also detect all other kinds of Trojan horses, such as
725 spreadsheets that delete files, send email, flood Web sites, alter
726 your Emacs settings, etc.
728 Generally, spreadsheet formulas and printers are simple things that
729 don't need to do any fancy computing, so all potentially-dangerous
730 parts of the Emacs Lisp environment can be excluded without cramping
731 your style as a formula-writer. See the documentation in @file{unsafep.el}
732 for more info on how Lisp forms are classified as safe or unsafe.
734 @node Spreadsheets with details and summary, , Virus protection, Advanced Features
735 @section Spreadsheets with details and summary
736 @cindex details and summary
737 @cindex summary, and details
739 A common organization for spreadsheets is to have a bunch of ``detail''
740 rows, each perhaps describing a transaction, and then a set of
741 ``summary'' rows that each show reduced data for some subset of the
742 details. SES supports this organization via the @code{ses-select}
746 @item (ses-select @var{fromrange} @var{test} @var{torange})
747 Returns a subset of @var{torange}. For each member in @var{fromrange}
748 that is equal to @var{test}, the corresponding member of @var{torange}
749 is included in the result.
754 (ses-average (ses-select (ses-range A1 A5) 'Smith (ses-range B1 B5)))
756 This computes the average of the B column values for those rows whose
757 A column value is the symbol 'Smith.
759 Arguably one could specify only @var{fromrange} plus
760 @var{to-row-offset} and @var{to-column-offset}. The @var{torange} is
761 stated explicitly to ensure that the formula will be recalculated if
762 any cell in either range is changed.
764 File @file{etc/ses-example.el} in the Emacs distribution is an example of a
765 details-and-summary spreadsheet.
768 @c ===================================================================
770 @node For Gurus, Index, Advanced Features, Top
772 @cindex advanced features
776 * Nonrelocatable references::
778 * Buffer-local variables in spreadsheets::
779 * Uses of defadvice in SES::
782 @node Deferred updates, Nonrelocatable references, For Gurus, For Gurus
783 @section Deferred updates
784 @cindex deferred updates
785 @cindex updates, deferred
786 @vindex run-with-idle-timer
788 To save time by avoiding redundant computations, cells that need
789 recalculation due to changes in other cells are added to a set. At
790 the end of the command, each cell in the set is recalculated once.
791 This can create a new set of cells that need recalculation. The
792 process is repeated until either the set is empty or it stops changing
793 (due to circular references among the cells). In extreme cases, you
794 might see progress messages of the form ``Recalculating... (@var{nnn}
795 cells left)''. If you interrupt the calculation using @kbd{C-g}, the
796 spreadsheet will be left in an inconsistent state, so use @kbd{C-_} or
797 @kbd{C-c C-l} to fix it.
799 To save even more time by avoiding redundant writes, cells that have
800 changes are added to a set instead of being written immediately to the
801 data area. Each cell in the set is written once, at the end of the
802 command. If you change vast quantities of cells, you might see a
803 progress message of the form ``Writing... (@var{nnn} cells left)''.
804 These deferred cell-writes cannot be interrupted by @kbd{C-g}, so
805 you'll just have to wait.
807 SES uses @code{run-with-idle-timer} to move the cell underline when
808 Emacs will be scrolling the buffer after the end of a command, and
809 also to narrow and underline after @kbd{C-x C-v}. This is visible as
810 a momentary glitch after C-x C-v and certain scrolling commands. You
811 can type ahead without worrying about the glitch.
814 @node Nonrelocatable references, The data area, Deferred updates, For Gurus
815 @section Nonrelocatable references
816 @cindex nonrelocatable references
817 @cindex references, nonrelocatable
819 @kbd{C-y} relocates all cell-references in a pasted formula, while
820 @kbd{C-u C-y} relocates none of the cell-references. What about mixed
827 to make an @dfn{absolute reference}. The formula relocator skips over
828 quoted things, so this will not be relocated when pasted or when
829 rows/columns are inserted/deleted. However, B3 will not be recorded
830 as a dependency of this cell, so this cell will not be updated
831 automatically when B3 is changed.
833 The variables @code{row} and @code{col} are dynamically bound while a
834 cell formula is being evaluated. You can use
836 (ses-cell-value row 0)
838 to get the value from the leftmost column in the current row. This
839 kind of dependency is also not recorded.
842 @node The data area, Buffer-local variables in spreadsheets, Nonrelocatable references, For Gurus
843 @section The data area
845 @findex ses-reconstruct-all
847 Begins with an 014 character, followed by sets of cell-definition
848 macros for each row, followed by column-widths, column-printers,
849 default-printer, and header-row. Then there's the global parameters
850 (file-format ID, numrows, numcols) and the local variables (specifying
851 SES mode for the buffer, etc.)
853 When a SES file is loaded, first the numrows and numcols values are
854 loaded, then the entire data area is @code{eval}ed, and finally the local
855 variables are processed.
857 You can edit the data area, but don't insert or delete any newlines
858 except in the local-variables part, since SES locates things by
859 counting newlines. Use @kbd{C-x C-e} at the end of a line to install
860 your edits into the spreadsheet data structures (this does not update
861 the print area, use e.g. @kbd{C-c C-l} for that).
863 The data area is maintained as an image of spreadsheet data
864 structures that area stored in buffer-local variables. If the data
865 area gets messed up, you can try reconstructing the data area from the
870 (@code{ses-reconstruct-all}).
874 @node Buffer-local variables in spreadsheets, Uses of defadvice in SES, The data area, For Gurus
875 @section Buffer-local variables in spreadsheets
876 @cindex buffer-local variables
877 @cindex variables, buffer-local
879 You can add additional local variables to the list at the bottom of
880 the data area, such as hidden constants you want to refer to in your
883 You can override the variable @code{ses--symbolic-formulas} to be a list of
884 symbols (as parenthesized strings) to show as completions for the '
885 command. This initial completions list is used instead of the actual
886 set of symbols-as-formulas in the spreadsheet.
888 For an example of this, see file @file{etc/ses-example.ses}.
890 If (for some reason) you want your formulas or printers to save data
891 into variables, you must declare these variables as buffer-locals in
892 order to avoid a virus warning.
894 You can define functions by making them values for the fake local
895 variable @code{eval}. Such functions can then be used in your
896 formulas and printers, but usually each @code{eval} is presented to
897 the user during file loading as a potential virus --- this can get
900 You can define functions in your @file{.emacs} file. Other people can
901 still read the print area of your spreadsheet, but they won't be able
902 to recalculate or reprint anything that depends on your functions. To
903 avoid virus warnings, each function used in a formula needs
905 (put 'your-function-name 'safe-function t)
908 @node Uses of defadvice in SES, , Buffer-local variables in spreadsheets, For Gurus
909 @section Uses of defadvice in SES
912 @cindex copy-region-as-kill
917 Defines a new undo element format (@var{fun} . @var{args}), which
918 means ``undo by applying @var{fun} to @var{args}''. For spreadsheet
919 buffers, it allows undos in the data area even though that's outside
922 @item copy-region-as-kill
923 When copying from the print area of a spreadsheet, treat the region as
924 a rectangle and attach each cell's formula and printer as 'ses
928 When yanking into the print area of a spreadsheet, first try to yank
929 as cells (if the yank text has 'ses properties), then as tab-separated
930 formulas, then (if all else fails) as a single formula for the current
934 @c ===================================================================
935 @node Index, Acknowledgements, For Gurus, Top
940 @c ===================================================================
942 @node Acknowledgements, GNU Free Documentation License, Index, Top
943 @chapter Acknowledgements
947 Jonathan Yavner @email{jyavner@@member.fsf.org}@*
948 Stefan Monnier @email{monnier@@gnu.org}@*
949 Shigeru Fukaya @email{shigeru.fukaya@@gmail.com}
955 Jonathan Yavner @email{jyavner@@member.fsf.org}@*
956 Brad Collins <brad@@chenla.org>
962 Christoph Conrad @email{christoph.conrad@@gmx.de}@*
963 CyberBob @email{cyberbob@@redneck.gacracker.org}@*
964 Syver Enstad @email{syver-en@@online.no}@*
965 Ami Fischman @email{fischman@@zion.bpnetworks.com}@*
966 Thomas Gehrlein @email{Thomas.Gehrlein@@t-online.de}@*
967 Chris F.A. Johnson @email{c.f.a.johnson@@rogers.com}@*
968 Yusong Li @email{lyusong@@hotmail.com}@*
969 Juri Linkov @email{juri@@jurta.org}@*
970 Harald Maier @email{maierh@@myself.com}@*
971 Alan Nash @email{anash@@san.rr.com}@*
972 François Pinard @email{pinard@@iro.umontreal.ca}@*
973 Pedro Pinto @email{ppinto@@cs.cmu.edu}@*
974 Stefan Reichör @email{xsteve@@riic.at}@*
975 Oliver Scholz @email{epameinondas@@gmx.de}@*
976 Richard M. Stallman @email{rms@@gnu.org}@*
977 Luc Teirlinck @email{teirllm@@dms.auburn.edu}@*
978 J. Otto Tennant @email{jotto@@pobox.com}@*
979 Jean-Philippe Theberge @email{jphil@@acs.pagesjaunes.fr}
982 @c ===================================================================
984 @node GNU Free Documentation License, , Acknowledgements, Top
985 @appendix GNU Free Documentation License
986 @include doclicense.texi
991 arch-tag: 10a4ee1c-7ef4-4c06-8b7a-f975e39f0dec