Show
Ignore:
Timestamp:
09/30/06 09:12:06 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

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
  • trunk/lisp/ses.el

    r4091 r4169  
    238238  "The initial contents of an empty spreadsheet.") 
    239239 
    240 (defconst ses-paramlines-plist 
    241   '(ses--col-widths  2 ses--col-printers  3 ses--default-printer  4 
    242     ses--header-row  5 ses--file-format   8 ses--numrows          9 
    243     ses--numcols    10) 
    244   "Offsets from last cell line to various parameter lines in the data area 
    245 of a spreadsheet.") 
    246  
    247240(defconst ses-box-prop '(:box (:line-width 2 :style released-button)) 
    248241  "Display properties to create a raised box for cells in the header line.") 
     
    256249default printer and then modify its output.") 
    257250 
     251 
     252;;---------------------------------------------------------------------------- 
     253;; Local variables and constants 
     254;;---------------------------------------------------------------------------- 
     255 
    258256(eval-and-compile 
    259257  (defconst ses-localvars 
     
    262260      ses--deferred-recalc ses--deferred-write ses--file-format 
    263261      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 
    265264      ;;Global variables that we override 
    266265      mode-line-process next-line-add-newlines transient-mark-mode) 
     
    272271    (make-local-variable x) 
    273272    (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 
     279data area of a spreadsheet.") 
    274280 
    275281 
     
    409415cell in the range specified by CURCELL.  The range is available in the 
    410416variables `minrow', `maxrow', `mincol', and `maxcol'." 
     417  (declare (indent defun) (debug (form body))) 
    411418  (let ((cur (make-symbol "cur")) 
    412419        (min (make-symbol "min")) 
     
    429436             (setq col (+ ,c mincol)) 
    430437             ,@body)))))) 
    431  
    432 (put 'ses-dorange 'lisp-indent-function 'defun) 
    433 (def-edebug-spec ses-dorange (form body)) 
    434438 
    435439;;Support for coverage testing. 
     
    651655  "Recalculate cells in LIST, checking for dependency loops.  Prints 
    652656progress messages every second.  Dependent cells are not recalculated 
    653 if the cell's value is unchanged if FORCE is nil." 
     657if the cell's value is unchanged and FORCE is nil." 
    654658  (let ((ses--deferred-recalc list) 
    655659        (nextlist             list) 
     
    710714(defun ses-in-print-area () 
    711715  "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)) 
    713717 
    714718;;We turn off point-motion-hooks and explicitly position the cursor, in case 
     
    954958  (ses-widen) 
    955959  (let ((inhibit-point-motion-hooks t)) ;In case intangible attrs are wrong 
    956     (goto-char (point-min)) 
    957960    (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)))) 
    964970 
    965971(defun ses-set-parameter (def value &optional elem) 
     
    10711077  result-so-far) 
    10721078 
     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 
     1081COL).  Cells starting at (STARTROW,STARTCOL) are being shifted 
     1082by (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 
    10731096(defun ses-relocate-formula (formula startrow startcol rowincr colincr) 
    10741097  "Produce a copy of FORMULA where all symbols that refer to cells in row 
     
    11141137                result)))) 
    11151138      (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 and 
    1119 COL).  Cells starting at (STARTROW,STARTCOL) are being shifted 
    1120 by (ROWINCR,COLINCR)." 
    1121   (let ((row (car rowcol)) 
    1122         (col (cdr rowcol))) 
    1123     (if (or (< row startrow) (< col startcol)) 
    1124         sym 
    1125       (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 variable 
    1130           (ses-create-cell-symbol row col) 
    1131         ;;Delete reference to a deleted cell 
    1132         nil)))) 
    11331139 
    11341140(defun ses-relocate-range (range startrow startcol rowincr colincr) 
     
    13381344  (search-backward ";; Local Variables:\n" nil t) 
    13391345  (backward-list 1) 
     1346  (setq ses--params-marker (point-marker)) 
    13401347  (let ((params (condition-case nil (read (current-buffer)) (error nil)))) 
    13411348    (or (and (= (safe-length params) 3) 
     
    13671374  (or (looking-at ses-print-data-boundary) 
    13681375      (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))) 
    13701379  ;;Initialize printer and symbol lists 
    13711380  (mapc 'ses-printer-record ses-standard-printer-functions) 
     
    15741583          ;;read the local variables at the end of the file.  Now it's safe to 
    15751584          ;;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) 
    15801586          (setq ses--deferred-narrow nil)) 
    15811587        ;;Update the modeline 
     
    18041810      (insert ses--blank-line)) 
    18051811    (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))) 
    18061815    ;;Placeholders for cell data 
    18071816    (insert (make-string (* ses--numrows (1+ ses--numcols)) ?\n)) 
    18081817    ;;Placeholders for col-widths, col-printers, default-printer, header-row 
    18091818    (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)))) 
    18111823  (ses-set-parameter 'ses--col-widths ses--col-widths) 
    18121824  (ses-set-parameter 'ses--col-printers ses--col-printers) 
     
    28812893 
    28822894;;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)) 
    28842897  (put x 'side-effect-free t)) 
    28852898