ses: Quick Tutorial

 
 2 Quick Tutorial
 ****************
 
 If you want to get started quickly and think that you know what to
 expect from a simple spreadsheet, this chapter may be all that you need.
 
    First, visit a new file with the ‘.ses’ extension.  Emacs presents
 you with an empty spreadsheet containing a single cell.
 
    Begin by inserting a headline: ‘"Income"<RET>’.  The double quotes
 indicate that this is a text cell.  (Notice that Emacs automatically
 inserts the closing quotation mark.)
 
    To insert your first income value, you must first resize the
 spreadsheet.  Press <TAB> to add a new cell and navigate back up to it.
 Enter a number, such as ‘2.23’.  Then proceed to add a few more income
 entries, e.g.:
 
      A
       Income
         2.23
         0.02
        15.76
        -4.00
 
    To add up the values, enter a Lisp expression:
 
      (+ A2 A3 A4 A5)
 
    Perhaps you want to add a cell to the right of cell A4 to explain why
 you have a negative entry.  Pressing ‘TAB’ in that cell adds an entire
 new column ‘B’, where you can add such a note.
 
    The column is fairly narrow by default, but pressing ‘w’ allows you
 to resize it as needed.  Make it 20 characters wide.  You can now add
 descriptive legends for all the entries, e.g.:
 
      A       B
       Income
         2.23       Consulting fee
         0.02     Informed opinion
        15.76       Lemonade stand
           -4          Loan to Joe
        14.01                Total
 
    By default, the labels in column B are right-justified.  To change
 that, you can enter a printer function for the whole column, using e.g.,
 ‘M-p ("%s")’.  You can override a column’s printer function in any
 individual cell using ‘p’.
 
    If Joe pays back his loan, you might blank that entry; e.g., by
 positioning the cursor in cell A5 and pressing ‘C-d’ twice.  If you do
 that, the total cell will display ‘######’.  That is because the regular
 ‘+’ operator does not handle a range that contains some empty cells.
 Instead of emptying the cell, you could enter a literal ‘0’, or delete
 the entire row using ‘C-k’.  An alternative is to use the special
 function ‘ses+’ instead of the regular ‘+’:
 
      (ses+ A2 A3 A4 A5)
 
    To make a formula robust against changes in the spreadsheet geometry,
 you can use the ‘ses-range’ macro to refer to a range of cells by the
 end-points, e.g.:
 
      (apply 'ses+ (ses-range A2 A5))
 
    (The ‘apply’ is necessary because ‘ses-range’ produces a _list_ of
 values.  This allows for more complex possibilities.)