49 |
;;---------------------------------------------------------------------------- |
;;---------------------------------------------------------------------------- |
50 |
|
|
51 |
(defgroup ses nil |
(defgroup ses nil |
52 |
"Simple Emacs Spreadsheet" |
"Simple Emacs Spreadsheet." |
53 |
:group 'applications |
:group 'applications |
54 |
:prefix "ses-" |
:prefix "ses-" |
55 |
:version "21.1") |
:version "21.1") |
376 |
;;print area (excluding the terminating newline) |
;;print area (excluding the terminating newline) |
377 |
(setq ses--col-widths widths |
(setq ses--col-widths widths |
378 |
ses--linewidth (apply '+ -1 (mapcar '1+ widths)) |
ses--linewidth (apply '+ -1 (mapcar '1+ widths)) |
379 |
ses--blank-line (concat (make-string ses--linewidth ? ) "\n")) |
ses--blank-line (concat (make-string ses--linewidth ?\s) "\n")) |
380 |
t) |
t) |
381 |
|
|
382 |
(defmacro ses-column-printers (printers) |
(defmacro ses-column-printers (printers) |
798 |
(cond |
(cond |
799 |
((< len width) |
((< len width) |
800 |
;;Fill field to length with spaces |
;;Fill field to length with spaces |
801 |
(setq len (make-string (- width len) ? ) |
(setq len (make-string (- width len) ?\s) |
802 |
text (if (eq ses-call-printer-return t) |
text (if (eq ses-call-printer-return t) |
803 |
(concat text len) |
(concat text len) |
804 |
(concat len text)))) |
(concat len text)))) |
816 |
maxcol (1+ maxcol))) |
maxcol (1+ maxcol))) |
817 |
(if (<= len maxwidth) |
(if (<= len maxwidth) |
818 |
;;Fill to complete width of all the fields spanned |
;;Fill to complete width of all the fields spanned |
819 |
(setq text (concat text (make-string (- maxwidth len) ? ))) |
(setq text (concat text (make-string (- maxwidth len) ?\s))) |
820 |
;;Not enough room to end of line or next non-nil field. Truncate |
;;Not enough room to end of line or next non-nil field. Truncate |
821 |
;;if string or decimal; otherwise fill with error indicator |
;;if string or decimal; otherwise fill with error indicator |
822 |
(setq sig `(error "Too wide" ,text)) |
(setq sig `(error "Too wide" ,text)) |
906 |
COL=NUMCOLS. Deletes characters if CHANGE < 0. Caller should bind |
COL=NUMCOLS. Deletes characters if CHANGE < 0. Caller should bind |
907 |
inhibit-quit to t." |
inhibit-quit to t." |
908 |
(let ((inhibit-read-only t) |
(let ((inhibit-read-only t) |
909 |
(blank (if (> change 0) (make-string change ? ))) |
(blank (if (> change 0) (make-string change ?\s))) |
910 |
(at-end (= col ses--numcols))) |
(at-end (= col ses--numcols))) |
911 |
(ses-set-with-undo 'ses--linewidth (+ ses--linewidth change)) |
(ses-set-with-undo 'ses--linewidth (+ ses--linewidth change)) |
912 |
;;ses-set-with-undo always returns t for strings. |
;;ses-set-with-undo always returns t for strings. |
913 |
(1value (ses-set-with-undo 'ses--blank-line |
(1value (ses-set-with-undo 'ses--blank-line |
914 |
(concat (make-string ses--linewidth ? ) "\n"))) |
(concat (make-string ses--linewidth ?\s) "\n"))) |
915 |
(dotimes (row ses--numrows) |
(dotimes (row ses--numrows) |
916 |
(ses-goto-print row col) |
(ses-goto-print row col) |
917 |
(when at-end |
(when at-end |
2901 |
(let ((printer (or (ses-col-printer col) ses--default-printer)) |
(let ((printer (or (ses-col-printer col) ses--default-printer)) |
2902 |
(width (ses-col-width col)) |
(width (ses-col-width col)) |
2903 |
half) |
half) |
2904 |
(or fill (setq fill ? )) |
(or fill (setq fill ?\s)) |
2905 |
(or span (setq span 0)) |
(or span (setq span 0)) |
2906 |
(setq value (ses-call-printer printer value)) |
(setq value (ses-call-printer printer value)) |
2907 |
(dotimes (x span) |
(dotimes (x span) |