[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SES local variables to define printers

From: Vincent Belaïche
Subject: Re: SES local variables to define printers
Date: Sat, 25 May 2013 22:43:14 +0200

Stefan Monnier a écrit :
> Hi Vincent,
> Could you show us an example of what used to work, as well as an example
> of what you'd ideally want to see working (in case it's different)?
>         Stefan

Here is an example "example.ses", if you open it with the current SES it
will generate an error "Invalid printer" while it used to work --- don't
remember with which version, but that sort of thing was working one year
or so ago.

If you take my patch (attached as ses.el.gz) and configure
ses-enable-local-variables you will have desired printing.

The thing is that I often use Calc object in cells --- and this is even
the very reason why I use SES --- the downside of that is that I need to
configure suitable printing functions for those Calc objects --- this is
all the more true that some time I happen not to have the same float
format for all the cells.

Another use case is that in some cell I have to be confirmed values
(some guess which I need to reconfirm...) and I want some printing with
some mark that this cell needs to be consolidated.

In the attached example I use two local printers checked-time and
tbc-time: cells B2 -- B4 use checked-time, while cells B5 & B6 use
tbc-time. check-time does some fancy printing for Calc HMS forms, and
tbc-time add some extra "?? " prefix on top of that. So I get this

-----Task------ -----Time------
      gardening        1h 3m 0s
        cooking     0h 45m 3.1s
       sleeping       7h 35m 6s
  bird watching    ?? 0h 20m 0s
        *Total*  ?? 9h 43m 9.1s


-----Task------ -----Time------
      gardening        1h 3m 0s
        cooking     0h 45m 3.1s
       sleeping       7h 35m 6s
  bird watching    ?? 0h 20m 0s
        *Total*  ?? 9h 43m 9.1s

(ses-cell A1 "Task" "Task" ses-dashfill nil)
(ses-cell B1 "Time" "Time" ses-dashfill nil)

(ses-cell A2 "gardening" "gardening" nil nil)
(ses-cell B2 (hms 1 3 0) (quote (hms 1 3 0)) checked-time (B6))

(ses-cell A3 "cooking" "cooking" nil nil)
(ses-cell B3 (hms 0 45 (float 312 -2)) (quote (hms 0 45 (float 312 -2))) 
checked-time (B6))

(ses-cell A4 "sleeping" "sleeping" nil nil)
(ses-cell B4 (hms 7 35 6) (quote (hms 7 35 6)) checked-time (B6))

(ses-cell A5 "bird watching" "bird watching" nil nil)
(ses-cell B5 (hms 0 20 0) (quote (hms 0 20 0)) tbc-time (B6))

(ses-cell A6 "*Total*" "*Total*" nil nil)
(ses-cell B6 (hms 9 43 (float 912 -2)) (calcFunc-add B2 B3 B4 B5) tbc-time nil)

(ses-column-widths [15 15])
(ses-column-printers [nil nil])
(ses-default-printer "%.7g")
(ses-header-row 0)

( ;Global parameters (these are read first)
 2 ;SES file-format
 6 ;numrows
 2 ;numcols

;; Local Variables:
;; mode: ses
;; checked-time: (lambda (x) (let ((calc-float-format '(fix 1)) 
(calc-hms-format "%sh %sm %ss")) (math-format-value x)))
;; tbc-time: (lambda (x) (let ((calc-float-format '(fix 1))(calc-hms-format "?? 
%sh %sm %ss")) (math-format-value x)))
;; End:

Attachment: ses.el.gz
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]