aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-01-19 23:46:31 +0000
committerStefan Monnier2005-01-19 23:46:31 +0000
commit7c018923b03fb5907df95a72336ca535f1f6b4e0 (patch)
tree757162a975ae208b91b05563e32cff162d729361
parentaa56124af51e80c65bfc143326aedaa96ec0e028 (diff)
downloademacs-7c018923b03fb5907df95a72336ca535f1f6b4e0.tar.gz
emacs-7c018923b03fb5907df95a72336ca535f1f6b4e0.zip
(ses-dotimes-msg): Remove macro. Use `dotimes-with-progress-reporter' instead.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/ses.el47
2 files changed, 26 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f7eb4f9749c..05a6915355f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12005-01-10 Paul Pogonyshev <pogonyshev@gmx.net>
2
3 * subr.el (dotimes-with-progress-reporter): New macro.
4
5 * ses.el (ses-dotimes-msg): Remove macro.
6 Use `dotimes-with-progress-reporter' instead.
7
12005-01-19 Steven Tamm <steventamm@mac.com> 82005-01-19 Steven Tamm <steventamm@mac.com>
2 9
3 * term/mac-win.el (process-connection-type): Use new 10 * term/mac-win.el (process-connection-type): Use new
@@ -34,6 +41,8 @@
34 41
352005-01-18 Stefan Monnier <monnier@iro.umontreal.ca> 422005-01-18 Stefan Monnier <monnier@iro.umontreal.ca>
36 43
44 * simple.el (blink-matching-open): Strip extra info from syntax.
45
37 * progmodes/sh-script.el (sh-here-doc-open-re): Don't allow | or other 46 * progmodes/sh-script.el (sh-here-doc-open-re): Don't allow | or other
38 funny chars in the end-of-here-doc marker. 47 funny chars in the end-of-here-doc marker.
39 48
@@ -6362,8 +6371,7 @@
6362 * progmodes/cperl-mode.el (cperl-mode): Adapt defun-prompt-regexp 6371 * progmodes/cperl-mode.el (cperl-mode): Adapt defun-prompt-regexp
6363 so that it is more understanding of whitespace. 6372 so that it is more understanding of whitespace.
6364 6373
6365 * xml.el (xml-maybe-do-ns, xml-parse-tag): Produce elements in the 6374 * xml.el (xml-maybe-do-ns, xml-parse-tag): Produce elements in the form
6366 form
6367 (("ns" . "element") (attr-list) children) instead of 6375 (("ns" . "element") (attr-list) children) instead of
6368 ((:ns . "element") (attr-list) children) in order to reduce the 6376 ((:ns . "element") (attr-list) children) in order to reduce the
6369 number of symbols used. 6377 number of symbols used.
diff --git a/lisp/ses.el b/lisp/ses.el
index 2a952aab286..49d4f49d94a 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -405,26 +405,6 @@ for safety. This is a macro to prevent propagate-on-load viruses."
405 (setq ses--header-row row) 405 (setq ses--header-row row)
406 t) 406 t)
407 407
408(defmacro ses-dotimes-msg (spec msg &rest body)
409 "(ses-dotimes-msg (VAR LIMIT) MSG BODY...): Like `dotimes', but
410a message is emitted using MSG every second or so during the loop."
411 (let ((msgvar (make-symbol "msg"))
412 (limitvar (make-symbol "limit"))
413 (var (car spec))
414 (limit (cadr spec)))
415 `(let ((,limitvar ,limit)
416 (,msgvar ,msg))
417 (setq ses-start-time (float-time))
418 (message ,msgvar)
419 (setq ,msgvar (concat ,msgvar " (%d%%)"))
420 (dotimes (,var ,limitvar)
421 (ses-time-check ,msgvar '(/ (* ,var 100) ,limitvar))
422 ,@body)
423 (message nil))))
424
425(put 'ses-dotimes-msg 'lisp-indent-function 2)
426(def-edebug-spec ses-dotimes-msg ((symbolp form) form body))
427
428(defmacro ses-dorange (curcell &rest body) 408(defmacro ses-dorange (curcell &rest body)
429 "Execute BODY repeatedly, with the variables `row' and `col' set to each 409 "Execute BODY repeatedly, with the variables `row' and `col' set to each
430cell in the range specified by CURCELL. The range is available in the 410cell in the range specified by CURCELL. The range is available in the
@@ -1218,7 +1198,8 @@ the rectangle (MINROW,MINCOL)..(NUMROWS,NUMCOLS) by adding ROWINCR and COLINCR
1218to each symbol." 1198to each symbol."
1219 (let (reform) 1199 (let (reform)
1220 (let (mycell newval) 1200 (let (mycell newval)
1221 (ses-dotimes-msg (row ses--numrows) "Relocating formulas..." 1201 (dotimes-with-progress-reporter
1202 (row ses--numrows) "Relocating formulas..."
1222 (dotimes (col ses--numcols) 1203 (dotimes (col ses--numcols)
1223 (setq ses-relocate-return nil 1204 (setq ses-relocate-return nil
1224 mycell (ses-get-cell row col) 1205 mycell (ses-get-cell row col)
@@ -1246,7 +1227,8 @@ to each symbol."
1246 (cond 1227 (cond
1247 ((and (<= rowincr 0) (<= colincr 0)) 1228 ((and (<= rowincr 0) (<= colincr 0))
1248 ;;Deletion of rows and/or columns 1229 ;;Deletion of rows and/or columns
1249 (ses-dotimes-msg (row (- ses--numrows minrow)) "Relocating variables..." 1230 (dotimes-with-progress-reporter
1231 (row (- ses--numrows minrow)) "Relocating variables..."
1250 (setq myrow (+ row minrow)) 1232 (setq myrow (+ row minrow))
1251 (dotimes (col (- ses--numcols mincol)) 1233 (dotimes (col (- ses--numcols mincol))
1252 (setq mycol (+ col mincol) 1234 (setq mycol (+ col mincol)
@@ -1262,7 +1244,8 @@ to each symbol."
1262 (let ((disty (1- ses--numrows)) 1244 (let ((disty (1- ses--numrows))
1263 (distx (1- ses--numcols)) 1245 (distx (1- ses--numcols))
1264 myrow mycol) 1246 myrow mycol)
1265 (ses-dotimes-msg (row (- ses--numrows minrow)) "Relocating variables..." 1247 (dotimes-with-progress-reporter
1248 (row (- ses--numrows minrow)) "Relocating variables..."
1266 (setq myrow (- disty row)) 1249 (setq myrow (- disty row))
1267 (dotimes (col (- ses--numcols mincol)) 1250 (dotimes (col (- ses--numcols mincol))
1268 (setq mycol (- distx col) 1251 (setq mycol (- distx col)
@@ -1475,7 +1458,7 @@ Narrows the buffer to show only the print area. Gives it `read-only' and
1475 (put-text-property (point-min) (1+ (point-min)) 'front-sticky t) 1458 (put-text-property (point-min) (1+ (point-min)) 'front-sticky t)
1476 ;;Create intangible properties, which also indicate which cell the text 1459 ;;Create intangible properties, which also indicate which cell the text
1477 ;;came from. 1460 ;;came from.
1478 (ses-dotimes-msg (row ses--numrows) "Finding cells..." 1461 (dotimes-with-progress-reporter (row ses--numrows) "Finding cells..."
1479 (dotimes (col ses--numcols) 1462 (dotimes (col ses--numcols)
1480 (setq pos end 1463 (setq pos end
1481 sym (ses-cell-symbol row col)) 1464 sym (ses-cell-symbol row col))
@@ -1724,7 +1707,7 @@ print area if NONARROW is nil."
1724 ;;find the data area when inserting or deleting *skip* values for cells 1707 ;;find the data area when inserting or deleting *skip* values for cells
1725 (dotimes (row ses--numrows) 1708 (dotimes (row ses--numrows)
1726 (insert-and-inherit ses--blank-line)) 1709 (insert-and-inherit ses--blank-line))
1727 (ses-dotimes-msg (row ses--numrows) "Reprinting..." 1710 (dotimes-with-progress-reporter (row ses--numrows) "Reprinting..."
1728 (if (eq (ses-cell-value row 0) '*skip*) 1711 (if (eq (ses-cell-value row 0) '*skip*)
1729 ;;Column deletion left a dangling skip 1712 ;;Column deletion left a dangling skip
1730 (ses-set-cell row 0 'value nil)) 1713 (ses-set-cell row 0 'value nil))
@@ -1809,11 +1792,13 @@ cells."
1809 ;;Reconstruct reference lists. 1792 ;;Reconstruct reference lists.
1810 (let (x yrow ycol) 1793 (let (x yrow ycol)
1811 ;;Delete old reference lists 1794 ;;Delete old reference lists
1812 (ses-dotimes-msg (row ses--numrows) "Deleting references..." 1795 (dotimes-with-progress-reporter
1796 (row ses--numrows) "Deleting references..."
1813 (dotimes (col ses--numcols) 1797 (dotimes (col ses--numcols)
1814 (ses-set-cell row col 'references nil))) 1798 (ses-set-cell row col 'references nil)))
1815 ;;Create new reference lists 1799 ;;Create new reference lists
1816 (ses-dotimes-msg (row ses--numrows) "Computing references..." 1800 (dotimes-with-progress-reporter
1801 (row ses--numrows) "Computing references..."
1817 (dotimes (col ses--numcols) 1802 (dotimes (col ses--numcols)
1818 (dolist (ref (ses-formula-references (ses-cell-formula row col))) 1803 (dolist (ref (ses-formula-references (ses-cell-formula row col)))
1819 (setq x (ses-sym-rowcol ref) 1804 (setq x (ses-sym-rowcol ref)
@@ -2073,7 +2058,7 @@ before current one."
2073 (ses-set-parameter 'ses--numrows (+ ses--numrows count)) 2058 (ses-set-parameter 'ses--numrows (+ ses--numrows count))
2074 ;;Insert each row 2059 ;;Insert each row
2075 (ses-goto-print row 0) 2060 (ses-goto-print row 0)
2076 (ses-dotimes-msg (x count) "Inserting row..." 2061 (dotimes-with-progress-reporter (x count) "Inserting row..."
2077 ;;Create a row of empty cells. The `symbol' fields will be set by 2062 ;;Create a row of empty cells. The `symbol' fields will be set by
2078 ;;the call to ses-relocate-all. 2063 ;;the call to ses-relocate-all.
2079 (setq newrow (make-vector ses--numcols nil)) 2064 (setq newrow (make-vector ses--numcols nil))
@@ -2162,7 +2147,7 @@ If COL is specified, the new column(s) get the specified WIDTH and PRINTER
2162 (ses-create-cell-variable-range 0 (1- ses--numrows) 2147 (ses-create-cell-variable-range 0 (1- ses--numrows)
2163 ses--numcols (+ ses--numcols count -1)) 2148 ses--numcols (+ ses--numcols count -1))
2164 ;;Insert each column. 2149 ;;Insert each column.
2165 (ses-dotimes-msg (x count) "Inserting column..." 2150 (dotimes-with-progress-reporter (x count) "Inserting column..."
2166 ;;Create a column of empty cells. The `symbol' fields will be set by 2151 ;;Create a column of empty cells. The `symbol' fields will be set by
2167 ;;the call to ses-relocate-all. 2152 ;;the call to ses-relocate-all.
2168 (ses-adjust-print-width col (1+ width)) 2153 (ses-adjust-print-width col (1+ width))
@@ -2220,7 +2205,7 @@ from the current one."
2220 (ses-begin-change) 2205 (ses-begin-change)
2221 (ses-set-parameter 'ses--numcols (- ses--numcols count)) 2206 (ses-set-parameter 'ses--numcols (- ses--numcols count))
2222 (ses-adjust-print-width col (- width)) 2207 (ses-adjust-print-width col (- width))
2223 (ses-dotimes-msg (row ses--numrows) "Deleting column..." 2208 (dotimes-with-progress-reporter (row ses--numrows) "Deleting column..."
2224 ;;Delete lines from cell data area 2209 ;;Delete lines from cell data area
2225 (ses-goto-data row col) 2210 (ses-goto-data row col)
2226 (ses-delete-line count) 2211 (ses-delete-line count)
@@ -2469,7 +2454,7 @@ formulas are to be inserted without relocation."
2469 (colincr (- (cdr rowcol) (cdr first))) 2454 (colincr (- (cdr rowcol) (cdr first)))
2470 (pos 0) 2455 (pos 0)
2471 myrow mycol x) 2456 myrow mycol x)
2472 (ses-dotimes-msg (row needrows) "Yanking..." 2457 (dotimes-with-progress-reporter (row needrows) "Yanking..."
2473 (setq myrow (+ row (car rowcol))) 2458 (setq myrow (+ row (car rowcol)))
2474 (dotimes (col needcols) 2459 (dotimes (col needcols)
2475 (setq mycol (+ col (cdr rowcol)) 2460 (setq mycol (+ col (cdr rowcol))