Commit 4eb3897c authored by Jonathan Yavner's avatar Jonathan Yavner
Browse files

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.
parent d88da39a
2007-10-25 Jonathan Yavner <jyavner@member.fsf.org>
* ses.el: 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.
2007-10-25 Carsten Dominik <dominik@science.uva.nl> 2007-10-25 Carsten Dominik <dominik@science.uva.nl>
* textmodes/org.el: (org-agenda-get-restriction-and-command): Use * textmodes/org.el: (org-agenda-get-restriction-and-command): Use
......
...@@ -172,8 +172,10 @@ Each function is called with ARG=1." ...@@ -172,8 +172,10 @@ Each function is called with ARG=1."
"\"" ses-read-cell "\"" ses-read-cell
"'" ses-read-symbol "'" ses-read-symbol
"=" ses-edit-cell "=" ses-edit-cell
"c" ses-recalculate-cell
"j" ses-jump "j" ses-jump
"p" ses-read-cell-printer "p" ses-read-cell-printer
"t" ses-truncate-cell
"w" ses-set-column-width "w" ses-set-column-width
"x" ses-export-keymap "x" ses-export-keymap
"\M-p" ses-read-column-printer)) "\M-p" ses-read-column-printer))
...@@ -271,6 +273,9 @@ default printer and then modify its output.") ...@@ -271,6 +273,9 @@ default printer and then modify its output.")
(make-local-variable x) (make-local-variable x)
(set x nil))) (set x nil)))
;;;This variable is documented as being permitted in file-locals:
(put 'ses--symbolic-formulas 'safe-local-variable 'consp)
(defconst ses-paramlines-plist (defconst ses-paramlines-plist
'(ses--col-widths -5 ses--col-printers -4 ses--default-printer -3 '(ses--col-widths -5 ses--col-printers -4 ses--default-printer -3
ses--header-row -2 ses--file-format 1 ses--numrows 2 ses--header-row -2 ses--file-format 1 ses--numrows 2
...@@ -507,10 +512,12 @@ for this spreadsheet." ...@@ -507,10 +512,12 @@ for this spreadsheet."
(list (symbol-name (cadr formula)))))) (list (symbol-name (cadr formula))))))
(defun ses-column-letter (col) (defun ses-column-letter (col)
"Converts a column number to A..Z or AA..ZZ" "Return the alphabetic name of column number COL.
(if (< col 26) 0-25 become A-Z; 26-701 become AA-ZZ, and so on."
(char-to-string (+ ?A col)) (let ((units (char-to-string (+ ?A (% col 26)))))
(string (+ ?@ (/ col 26)) (+ ?A (% col 26))))) (if (< col 26)
units
(concat (ses-column-letter (1- (/ col 26))) units))))
(defun ses-create-cell-symbol (row col) (defun ses-create-cell-symbol (row col)
"Produce a symbol that names the cell (ROW,COL). (0,0) => 'A1." "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,6 +745,9 @@ region, or nil if cursor is not at a cell."
;;Range ;;Range
(let ((bcell (get-text-property (region-beginning) 'intangible)) (let ((bcell (get-text-property (region-beginning) 'intangible))
(ecell (get-text-property (1- (region-end)) 'intangible))) (ecell (get-text-property (1- (region-end)) 'intangible)))
(when (= (region-end) ses--data-marker)
;;Correct for overflow
(setq ecell (get-text-property (- (region-end) 2) 'intangible)))
(setq ses--curcell (if (and bcell ecell) (setq ses--curcell (if (and bcell ecell)
(cons bcell ecell) (cons bcell ecell)
nil)))) nil))))
...@@ -2328,6 +2338,9 @@ hard to override how mouse-1 works." ...@@ -2328,6 +2338,9 @@ hard to override how mouse-1 works."
(defun ses-copy-region (beg end) (defun ses-copy-region (beg end)
"Treat the region as rectangular. Convert the intangible attributes to "Treat the region as rectangular. Convert the intangible attributes to
SES attributes recording the contents of the cell as of the time of copying." SES attributes recording the contents of the cell as of the time of copying."
(when (= end ses--data-marker)
;;Avoid overflow situation
(setq end (1- ses--data-marker)))
(let* ((inhibit-point-motion-hooks t) (let* ((inhibit-point-motion-hooks t)
(x (mapconcat 'ses-copy-region-helper (x (mapconcat 'ses-copy-region-helper
(extract-rectangle beg (1- end)) "\n"))) (extract-rectangle beg (1- end)) "\n")))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment