Changeset 4169 for trunk/lisp/ses.el
- Timestamp:
- 09/30/06 09:12:06 (2 years ago)
- Files:
-
- trunk/lisp (modified) (1 prop)
- trunk/lisp/ses.el (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp
- Property svn:ignore changed from
*.elc
MANIFEST
Makefile
Makefile.unix
makefile
elc.tar.gz
cus-load.el
finder-inf.el
subdirs.el
loaddefs.el
to
*.elc
MANIFEST
Makefile
Makefile.unix
makefile
elc.tar.gz
cus-load.el
finder-inf.el
subdirs.el
loaddefs.el
pre-mh-loaddefs.el-CMD
- Property svn:ignore changed from
trunk/lisp/ses.el
r4091 r4169 238 238 "The initial contents of an empty spreadsheet.") 239 239 240 (defconst ses-paramlines-plist241 '(ses--col-widths 2 ses--col-printers 3 ses--default-printer 4242 ses--header-row 5 ses--file-format 8 ses--numrows 9243 ses--numcols 10)244 "Offsets from last cell line to various parameter lines in the data area245 of a spreadsheet.")246 247 240 (defconst ses-box-prop '(:box (:line-width 2 :style released-button)) 248 241 "Display properties to create a raised box for cells in the header line.") … … 256 249 default printer and then modify its output.") 257 250 251 252 ;;---------------------------------------------------------------------------- 253 ;; Local variables and constants 254 ;;---------------------------------------------------------------------------- 255 258 256 (eval-and-compile 259 257 (defconst ses-localvars … … 262 260 ses--deferred-recalc ses--deferred-write ses--file-format 263 261 ses--header-hscroll ses--header-row ses--header-string ses--linewidth 264 ses--numcols ses--numrows ses--symbolic-formulas 262 ses--numcols ses--numrows ses--symbolic-formulas ses--data-marker 263 ses--params-marker 265 264 ;;Global variables that we override 266 265 mode-line-process next-line-add-newlines transient-mark-mode) … … 272 271 (make-local-variable x) 273 272 (set x nil))) 273 274 (defconst ses-paramlines-plist 275 '(ses--col-widths -5 ses--col-printers -4 ses--default-printer -3 276 ses--header-row -2 ses--file-format 1 ses--numrows 2 277 ses--numcols 3) 278 "Offsets from 'Global parameters' line to various parameter lines in the 279 data area of a spreadsheet.") 274 280 275 281 … … 409 415 cell in the range specified by CURCELL. The range is available in the 410 416 variables `minrow', `maxrow', `mincol', and `maxcol'." 417 (declare (indent defun) (debug (form body))) 411 418 (let ((cur (make-symbol "cur")) 412 419 (min (make-symbol "min")) … … 429 436 (setq col (+ ,c mincol)) 430 437 ,@body)))))) 431 432 (put 'ses-dorange 'lisp-indent-function 'defun)433 (def-edebug-spec ses-dorange (form body))434 438 435 439 ;;Support for coverage testing. … … 651 655 "Recalculate cells in LIST, checking for dependency loops. Prints 652 656 progress messages every second. Dependent cells are not recalculated 653 if the cell's value is unchanged ifFORCE is nil."657 if the cell's value is unchanged and FORCE is nil." 654 658 (let ((ses--deferred-recalc list) 655 659 (nextlist list) … … 710 714 (defun ses-in-print-area () 711 715 "Returns t if point is in print area of spreadsheet." 712 ( eq (get-text-property (point) 'keymap) 'ses-mode-print-map))716 (<= (point) ses--data-marker)) 713 717 714 718 ;;We turn off point-motion-hooks and explicitly position the cursor, in case … … 954 958 (ses-widen) 955 959 (let ((inhibit-point-motion-hooks t)) ;In case intangible attrs are wrong 956 (goto-char (point-min))957 960 (if col 958 ;;It's a cell 959 (forward-line (+ ses--numrows 2 (* def (1+ ses--numcols)) col)) 960 ;;Convert def-symbol to offset 961 (setq def (plist-get ses-paramlines-plist def)) 962 (or def (signal 'args-out-of-range nil)) 963 (forward-line (+ (* ses--numrows (+ ses--numcols 2)) def))))) 961 ;;It's a cell 962 (progn 963 (goto-char ses--data-marker) 964 (forward-line (+ 1 (* def (1+ ses--numcols)) col))) 965 ;;Convert def-symbol to offset 966 (setq def (plist-get ses-paramlines-plist def)) 967 (or def (signal 'args-out-of-range nil)) 968 (goto-char ses--params-marker) 969 (forward-line def)))) 964 970 965 971 (defun ses-set-parameter (def value &optional elem) … … 1071 1077 result-so-far) 1072 1078 1079 (defsubst ses-relocate-symbol (sym rowcol startrow startcol rowincr colincr) 1080 "Relocate one symbol SYM, whichs corresponds to ROWCOL (a cons of ROW and 1081 COL). Cells starting at (STARTROW,STARTCOL) are being shifted 1082 by (ROWINCR,COLINCR)." 1083 (let ((row (car rowcol)) 1084 (col (cdr rowcol))) 1085 (if (or (< row startrow) (< col startcol)) 1086 sym 1087 (setq row (+ row rowincr) 1088 col (+ col colincr)) 1089 (if (and (>= row startrow) (>= col startcol) 1090 (< row ses--numrows) (< col ses--numcols)) 1091 ;;Relocate this variable 1092 (ses-create-cell-symbol row col) 1093 ;;Delete reference to a deleted cell 1094 nil)))) 1095 1073 1096 (defun ses-relocate-formula (formula startrow startcol rowincr colincr) 1074 1097 "Produce a copy of FORMULA where all symbols that refer to cells in row … … 1114 1137 result)))) 1115 1138 (nreverse result)))) 1116 1117 (defun ses-relocate-symbol (sym rowcol startrow startcol rowincr colincr)1118 "Relocate one symbol SYM, whichs corresponds to ROWCOL (a cons of ROW and1119 COL). Cells starting at (STARTROW,STARTCOL) are being shifted1120 by (ROWINCR,COLINCR)."1121 (let ((row (car rowcol))1122 (col (cdr rowcol)))1123 (if (or (< row startrow) (< col startcol))1124 sym1125 (setq row (+ row rowincr)1126 col (+ col colincr))1127 (if (and (>= row startrow) (>= col startcol)1128 (< row ses--numrows) (< col ses--numcols))1129 ;;Relocate this variable1130 (ses-create-cell-symbol row col)1131 ;;Delete reference to a deleted cell1132 nil))))1133 1139 1134 1140 (defun ses-relocate-range (range startrow startcol rowincr colincr) … … 1338 1344 (search-backward ";; Local Variables:\n" nil t) 1339 1345 (backward-list 1) 1346 (setq ses--params-marker (point-marker)) 1340 1347 (let ((params (condition-case nil (read (current-buffer)) (error nil)))) 1341 1348 (or (and (= (safe-length params) 3) … … 1367 1374 (or (looking-at ses-print-data-boundary) 1368 1375 (error "Missing marker between print and data areas")) 1369 (forward-char (length ses-print-data-boundary)) 1376 (forward-char 1) 1377 (setq ses--data-marker (point-marker)) 1378 (forward-char (1- (length ses-print-data-boundary))) 1370 1379 ;;Initialize printer and symbol lists 1371 1380 (mapc 'ses-printer-record ses-standard-printer-functions) … … 1574 1583 ;;read the local variables at the end of the file. Now it's safe to 1575 1584 ;;do the narrowing. 1576 (save-excursion 1577 (goto-char (point-min)) 1578 (forward-line ses--numrows) 1579 (narrow-to-region (point-min) (point))) 1585 (narrow-to-region (point-min) ses--data-marker) 1580 1586 (setq ses--deferred-narrow nil)) 1581 1587 ;;Update the modeline … … 1804 1810 (insert ses--blank-line)) 1805 1811 (insert ses-print-data-boundary) 1812 (backward-char (1- (length ses-print-data-boundary))) 1813 (setq ses--data-marker (point-marker)) 1814 (forward-char (1- (length ses-print-data-boundary))) 1806 1815 ;;Placeholders for cell data 1807 1816 (insert (make-string (* ses--numrows (1+ ses--numcols)) ?\n)) 1808 1817 ;;Placeholders for col-widths, col-printers, default-printer, header-row 1809 1818 (insert "\n\n\n\n") 1810 (insert ses-initial-global-parameters)) 1819 (insert ses-initial-global-parameters) 1820 (backward-char (1- (length ses-initial-global-parameters))) 1821 (setq ses--params-marker (point-marker)) 1822 (forward-char (1- (length ses-initial-global-parameters)))) 1811 1823 (ses-set-parameter 'ses--col-widths ses--col-widths) 1812 1824 (ses-set-parameter 'ses--col-printers ses--col-printers) … … 2881 2893 2882 2894 ;;All standard formulas are safe 2883 (dolist (x '(ses-range ses-delete-blanks ses+ ses-average ses-select)) 2895 (dolist (x '(ses-cell-value ses-range ses-delete-blanks ses+ ses-average 2896 ses-select)) 2884 2897 (put x 'side-effect-free t)) 2885 2898
