]> code.delx.au - gnu-emacs/blobdiff - doc/misc/ses.texi
; Merge from origin/emacs-25
[gnu-emacs] / doc / misc / ses.texi
index 068505089a3aad583096203397fa0e1b2de790e5..8b0bb82f17487eb16dbd0b7bcea7cbb67d6d1b3d 100644 (file)
@@ -2,17 +2,17 @@
 @c %**start of header
 @setfilename ../../info/ses.info
 @settitle @acronym{SES}: Simple Emacs Spreadsheet
+@include docstyle.texi
 @setchapternewpage off
 @syncodeindex fn cp
 @syncodeindex vr cp
 @syncodeindex ky cp
-@documentencoding UTF-8
 @c %**end of header
 
 @copying
 This file documents @acronym{SES}: the Simple Emacs Spreadsheet.
 
-Copyright @copyright{} 2002--2015 Free Software Foundation, Inc.
+Copyright @copyright{} 2002--2016 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -377,6 +377,7 @@ Undo previous action (@code{(undo)}).
 @findex ses-read-cell-printer
 @findex ses-read-column-printer
 @findex ses-read-default-printer
+@findex ses-define-local-printer
 @findex ses-center
 @findex ses-center-span
 @findex ses-dashfill
@@ -435,13 +436,43 @@ Centering with dashes and spill-over.
 Centering with tildes (~) and spill-over.
 @end table
 
-You can define printer function local to a sheet with command
-@code{ses-define-local-printer}. For instance define printer
-@samp{foo} to @code{"%.2f"} and then use symbol @samp{foo} as a
-printer function. Then, if you call again
+You can define printer function local to a sheet with the command
+@code{ses-define-local-printer}.  For instance, define a printer
+@samp{foo} to @code{"%.2f"}, and then use symbol @samp{foo} as a
+printer function.  Then, if you call again
 @code{ses-define-local-printer} on @samp{foo} to redefine it as
-@code{"%.3f"} all the cells using printer @samp{foo} will be reprinted
-accordingly.
+@code{"%.3f"}, all the cells using printer @samp{foo} will be
+reprinted accordingly.
+
+When you define a printer function with a lambda expression taking one
+argument, please take care that the returned value is a string, or a
+list containing a string, even when the input argument has an
+unexpected value. Here is an example:
+
+@example
+(lambda (val)
+   (cond
+      ((null val) "")
+      ((and (numberp val) (>= val 0)) (format "%.1f" val))
+      (t (ses-center-span (format "%S" val) ?#))))
+@end example
+
+This example will:
+@itemize
+@item
+When the cell is empty (ie.@: when @code{val} is @code{nil}), print an
+empty string @code{""}
+@item
+When the cell value is a non negative number, format the the value in
+fixed-point notation with one decimal after point
+@item
+Otherwise, handle the value as erroneous by printing it as an
+s-expression (using @code{prin1}), centered and surrounded by @code{#}
+filling.
+@end itemize
+
+
+
 
 @node Clearing cells
 @section Clearing cells
@@ -1046,7 +1077,7 @@ the data area, such as hidden constants you want to refer to in your
 formulas.
 
 You can override the variable @code{ses--symbolic-formulas} to be a list of
-symbols (as parenthesized strings) to show as completions for the '
+symbols (as parenthesized strings) to show as completions for the @kbd{'}
 command.  This initial completions list is used instead of the actual
 set of symbols-as-formulas in the spreadsheet.