[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117982: * ses.el (ses-calculate-cell): bind row and
From: |
Vincent Belaïche |
Subject: |
[Emacs-diffs] trunk r117982: * ses.el (ses-calculate-cell): bind row and col dynamically to |
Date: |
Tue, 30 Sep 2014 08:06:46 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117982
revision-id: address@hidden
parent: address@hidden
committer: Vincent Belaïche <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-30 10:06:28 +0200
message:
* ses.el (ses-calculate-cell): bind row and col dynamically to
their values with 'cl-progv'.
(ses-dorange): bind row, col, maxrow and maxcol dynamically to
their values with 'cl-progv', also use non-interned symbols for
row, minrow, maxrow, mincol and maxcol.
(maxrow maxcol): New defvar, to make the compiler happy.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/ses.el ses.el-20091113204419-o5vbwnq5f7feedwu-2447
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-09-30 00:48:31 +0000
+++ b/lisp/ChangeLog 2014-09-30 08:06:28 +0000
@@ -1,3 +1,12 @@
+2014-09-30 Vincent Belaïche <address@hidden>
+
+ * ses.el (ses-calculate-cell): bind row and col dynamically to
+ their values with 'cl-progv'.
+ (ses-dorange): bind row, col, maxrow and maxcol dynamically to
+ their values with 'cl-progv', also use non-interned symbols for
+ row, minrow, maxrow, mincol and maxcol.
+ (maxrow maxcol): New defvar, to make the compiler happy.
+
2014-09-30 Stefan Monnier <address@hidden>
* minibuffer.el (completion-at-point): Emit warning for ill-behaved
=== modified file 'lisp/ses.el'
--- a/lisp/ses.el 2014-09-29 20:25:19 +0000
+++ b/lisp/ses.el 2014-09-30 08:06:28 +0000
@@ -592,30 +592,37 @@
t)
(defmacro ses-dorange (curcell &rest body)
- "Execute BODY repeatedly, with the variables `row' and `col' set to each
-cell in the range specified by CURCELL. The range is available in the
-variables `minrow', `maxrow', `mincol', and `maxcol'."
+ "Execute BODY repeatedly, with the variables `row', `col',
+`maxrow' and `maxcol' dynamically scoped to each cell in the
+range specified by CURCELL."
(declare (indent defun) (debug (form body)))
(let ((cur (make-symbol "cur"))
(min (make-symbol "min"))
(max (make-symbol "max"))
(r (make-symbol "r"))
- (c (make-symbol "c")))
+ (c (make-symbol "c"))
+ (row (make-symbol "row"))
+ ;; The range is available in the variables `minrow', `maxrow',
+ ;; `mincol', and `maxcol'.
+ (minrow (make-symbol "minrow"))
+ (mincol (make-symbol "mincol"))
+ (maxrow (make-symbol "maxrow"))
+ (maxcol (make-symbol "maxcol")) )
`(let* ((,cur ,curcell)
(,min (ses-sym-rowcol (if (consp ,cur) (car ,cur) ,cur)))
(,max (ses-sym-rowcol (if (consp ,cur) (cdr ,cur) ,cur))))
- (let ((minrow (car ,min))
- (maxrow (car ,max))
- (mincol (cdr ,min))
- (maxcol (cdr ,max))
- row col)
- (if (or (> minrow maxrow) (> mincol maxcol))
+ (let ((,minrow (car ,min))
+ (,maxrow (car ,max))
+ (,mincol (cdr ,min))
+ (,maxcol (cdr ,max))
+ ,row)
+ (if (or (> ,minrow ,maxrow) (> ,mincol ,maxcol))
(error "Empty range"))
- (dotimes (,r (- maxrow minrow -1))
- (setq row (+ ,r minrow))
- (dotimes (,c (- maxcol mincol -1))
- (setq col (+ ,c mincol))
- ,@body))))))
+ (dotimes (,r (- ,maxrow ,minrow -1))
+ (setq ,row (+ ,r ,minrow))
+ (dotimes (,c (- ,maxcol ,mincol -1))
+ (cl-progv '(row col maxrow maxcol) (list ,row (+ ,c ,mincol)
,maxrow ,maxcol)
+ ,@body)))))))
;;Support for coverage testing.
(defmacro 1value (form)
@@ -939,7 +946,9 @@
(setq formula (ses-safe-formula (cadr formula)))
(ses-set-cell row col 'formula formula))
(condition-case sig
- (setq newval (eval formula))
+ (setq newval (cl-progv '(row col)
+ (list row col)
+ (eval formula)))
(error
;; Variable `sig' can't be nil.
(nconc sig (list (ses-cell-symbol cell)))
@@ -2177,6 +2186,14 @@
(setq ses--Dijkstra-attempt-nb (1+ ses--Dijkstra-attempt-nb)
ses--Dijkstra-weight-bound (* ses--numrows ses--numcols)))
+;; These functions use the variables 'row' and 'col' that are dynamically bound
+;; by ses-print-cell. We define these variables at compile-time to make the
+;; compiler happy.
+(defvar row)
+(defvar col)
+(defvar maxrow)
+(defvar maxcol)
+
(defun ses-recalculate-cell ()
"Recalculate and reprint the current cell or range.
@@ -3676,12 +3693,6 @@
;; Standard print functions
;;----------------------------------------------------------------------------
-;; These functions use the variables 'row' and 'col' that are dynamically bound
-;; by ses-print-cell. We define these variables at compile-time to make the
-;; compiler happy.
-(defvar row)
-(defvar col)
-
(defun ses-center (value &optional span fill)
"Print VALUE, centered within column.
FILL is the fill character for centering (default = space).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117982: * ses.el (ses-calculate-cell): bind row and col dynamically to,
Vincent Belaïche <=