aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ses.texi30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi
index 2f92e3ea836..4cb4188f690 100644
--- a/doc/misc/ses.texi
+++ b/doc/misc/ses.texi
@@ -443,6 +443,36 @@ printer function. Then, if you call again
443@code{"%.3f"} all the cells using printer @samp{foo} will be reprinted 443@code{"%.3f"} all the cells using printer @samp{foo} will be reprinted
444accordingly. 444accordingly.
445 445
446When you define a printer function with a lambda expression taking one
447argument, please take care that the returned value is a string, or a
448list containing a string, even when the input argument has an
449unexpected value. Here is an example:
450
451@example
452(lambda (val)
453 (cond
454 ((null val) "")
455 ((and (numberp val) (>= val 0)) (format "%.1f" val))
456 (t (ses-center-span (format "%S" val) ?#))))
457@end example
458
459This example will:
460@itemize
461@item
462When the cell is empty (ie.@: when @code{val} is @code{nil}), print an
463empty string @code{""}
464@item
465When the cell value is a non negative number, format the the value in
466fixed-point notation with one decimal after point
467@item
468Otherwise, handle the value as erroneous by printing it as an
469s-expression (using @code{prin1}), centered and surrounded by @code{#}
470filling.
471@end itemize
472
473
474
475
446@node Clearing cells 476@node Clearing cells
447@section Clearing cells 477@section Clearing cells
448@cindex clearing commands 478@cindex clearing commands