aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Yavner2007-10-25 20:12:26 +0000
committerJonathan Yavner2007-10-25 20:12:26 +0000
commit4eb3897c84d0e861a5346fd83d425690fbaa63e4 (patch)
tree2c177a679873e1539ebf40598e02399b0775ab85
parentd88da39af689226915604e0ab8428ed03e3e4465 (diff)
downloademacs-4eb3897c84d0e861a5346fd83d425690fbaa63e4.tar.gz
emacs-4eb3897c84d0e861a5346fd83d425690fbaa63e4.zip
Make `ses--symbolic-formulas' a safe local variable.
(ses-mode-print-map): Add `c' and `t' (suggested by Gareth Rees). (ses-recalculate-cell): Deal with point being just beyond end of data area (why does this happen?) (ses-set-curcell): Ditto. (ses-column-letter): Handle columns beyond 702. Code written by Gareth Rees.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/ses.el21
2 files changed, 28 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ca2048720d4..b395cd797a9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12007-10-25 Jonathan Yavner <jyavner@member.fsf.org>
2
3 * ses.el: Make `ses--symbolic-formulas' a safe local variable.
4 (ses-mode-print-map): Add `c' and `t' (suggested by
5 Gareth Rees).
6 (ses-recalculate-cell): Deal with point being just beyond end of
7 data area (why does this happen?)
8 (ses-set-curcell): Ditto.
9 (ses-column-letter): Handle columns beyond 702. Code written by
10 Gareth Rees.
11
12007-10-25 Carsten Dominik <dominik@science.uva.nl> 122007-10-25 Carsten Dominik <dominik@science.uva.nl>
2 13
3 * textmodes/org.el: (org-agenda-get-restriction-and-command): Use 14 * textmodes/org.el: (org-agenda-get-restriction-and-command): Use
diff --git a/lisp/ses.el b/lisp/ses.el
index 3f904fde0d2..62067471b60 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -172,8 +172,10 @@ Each function is called with ARG=1."
172 "\"" ses-read-cell 172 "\"" ses-read-cell
173 "'" ses-read-symbol 173 "'" ses-read-symbol
174 "=" ses-edit-cell 174 "=" ses-edit-cell
175 "c" ses-recalculate-cell
175 "j" ses-jump 176 "j" ses-jump
176 "p" ses-read-cell-printer 177 "p" ses-read-cell-printer
178 "t" ses-truncate-cell
177 "w" ses-set-column-width 179 "w" ses-set-column-width
178 "x" ses-export-keymap 180 "x" ses-export-keymap
179 "\M-p" ses-read-column-printer)) 181 "\M-p" ses-read-column-printer))
@@ -271,6 +273,9 @@ default printer and then modify its output.")
271 (make-local-variable x) 273 (make-local-variable x)
272 (set x nil))) 274 (set x nil)))
273 275
276;;;This variable is documented as being permitted in file-locals:
277(put 'ses--symbolic-formulas 'safe-local-variable 'consp)
278
274(defconst ses-paramlines-plist 279(defconst ses-paramlines-plist
275 '(ses--col-widths -5 ses--col-printers -4 ses--default-printer -3 280 '(ses--col-widths -5 ses--col-printers -4 ses--default-printer -3
276 ses--header-row -2 ses--file-format 1 ses--numrows 2 281 ses--header-row -2 ses--file-format 1 ses--numrows 2
@@ -507,10 +512,12 @@ for this spreadsheet."
507 (list (symbol-name (cadr formula)))))) 512 (list (symbol-name (cadr formula))))))
508 513
509(defun ses-column-letter (col) 514(defun ses-column-letter (col)
510 "Converts a column number to A..Z or AA..ZZ" 515 "Return the alphabetic name of column number COL.
511 (if (< col 26) 5160-25 become A-Z; 26-701 become AA-ZZ, and so on."
512 (char-to-string (+ ?A col)) 517 (let ((units (char-to-string (+ ?A (% col 26)))))
513 (string (+ ?@ (/ col 26)) (+ ?A (% col 26))))) 518 (if (< col 26)
519 units
520 (concat (ses-column-letter (1- (/ col 26))) units))))
514 521
515(defun ses-create-cell-symbol (row col) 522(defun ses-create-cell-symbol (row col)
516 "Produce a symbol that names the cell (ROW,COL). (0,0) => 'A1." 523 "Produce a symbol that names the cell (ROW,COL). (0,0) => 'A1."
@@ -738,6 +745,9 @@ region, or nil if cursor is not at a cell."
738 ;;Range 745 ;;Range
739 (let ((bcell (get-text-property (region-beginning) 'intangible)) 746 (let ((bcell (get-text-property (region-beginning) 'intangible))
740 (ecell (get-text-property (1- (region-end)) 'intangible))) 747 (ecell (get-text-property (1- (region-end)) 'intangible)))
748 (when (= (region-end) ses--data-marker)
749 ;;Correct for overflow
750 (setq ecell (get-text-property (- (region-end) 2) 'intangible)))
741 (setq ses--curcell (if (and bcell ecell) 751 (setq ses--curcell (if (and bcell ecell)
742 (cons bcell ecell) 752 (cons bcell ecell)
743 nil)))) 753 nil))))
@@ -2328,6 +2338,9 @@ hard to override how mouse-1 works."
2328(defun ses-copy-region (beg end) 2338(defun ses-copy-region (beg end)
2329 "Treat the region as rectangular. Convert the intangible attributes to 2339 "Treat the region as rectangular. Convert the intangible attributes to
2330SES attributes recording the contents of the cell as of the time of copying." 2340SES attributes recording the contents of the cell as of the time of copying."
2341 (when (= end ses--data-marker)
2342 ;;Avoid overflow situation
2343 (setq end (1- ses--data-marker)))
2331 (let* ((inhibit-point-motion-hooks t) 2344 (let* ((inhibit-point-motion-hooks t)
2332 (x (mapconcat 'ses-copy-region-helper 2345 (x (mapconcat 'ses-copy-region-helper
2333 (extract-rectangle beg (1- end)) "\n"))) 2346 (extract-rectangle beg (1- end)) "\n")))