aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Belaïche2016-08-09 23:46:13 +0200
committerVincent Belaïche2016-08-09 23:46:13 +0200
commit731d225cf3a8f95d3bad0baf60c792afc7d58b78 (patch)
tree9d33bc49657e9b4e7aadecc44cc6d76389d212ef
parente13c5467fc0c08c6875653df56b8b54185d0c4cc (diff)
downloademacs-731d225cf3a8f95d3bad0baf60c792afc7d58b78.tar.gz
emacs-731d225cf3a8f95d3bad0baf60c792afc7d58b78.zip
Apply changes from commits 3c97b0f758 and 8a38e948b0 to master branch.
Here follows the logs from the two commits which I apply to master. commit 3c97b0f7589e06aeb1ab0147f0ee32974c32926d Author: Vincent Belaïche <vincentb1@users.sourceforge.net> Date: Fri Jul 29 13:44:14 2016 +0200 Fix ses-delete-blanks to delete only blanks + documentation. * doc/misc/ses.texi (Quick Tutorial): Mention the '!' 'ses-range' modifier as an alternative to 'ses+'. (Advanced Features): Add a refernce to node 'Nonrelocatable references' concerning function 'ses-rename-cell'. (Standard formula functions): Mention the '!' 'ses-range' modifier as an alternative to 'ses-delete-blanks'. (More on cell printing): Fix fallback printer definition. Minor editorial formatting changes. (Nonrelocatable references): Document the use of 'ses-rename-cell' as a better way to make cell reference non-relocatable. (The data area): Document the presence of local printer definitions in the data area. * lisp/ses.el (ses-delete-blanks): Do not remove *error*. Any error in an argument should propagate into the using formula rather than being silently hidden ! commit 8a38e948b039516e70176ebe20c5349e2ade6ac5 Author: Vincent Belaïche <vincentb1@users.sourceforge.net> Date: Thu Jul 28 19:49:37 2016 +0200 Fix local printer set to left aligned string formatter. * lisp/ses.el (ses-local-printer-compile): Add missing case for left-aligned string formatter.
-rw-r--r--doc/misc/ses.texi54
-rw-r--r--lisp/ses.el7
2 files changed, 48 insertions, 13 deletions
diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi
index 84d2cc77c0c..c43ddf472a4 100644
--- a/doc/misc/ses.texi
+++ b/doc/misc/ses.texi
@@ -187,6 +187,14 @@ the end-points, e.g.:
187(The @code{apply} is necessary because @code{ses-range} produces a 187(The @code{apply} is necessary because @code{ses-range} produces a
188@emph{list} of values. This allows for more complex possibilities.) 188@emph{list} of values. This allows for more complex possibilities.)
189 189
190Alternatively you can use the @code{!} modifier of @code{ses-range} to
191remove blank cells which allows to use @code{+} instead of
192@code{ses+}:
193
194@lisp
195(apply '+ (ses-range A2 A5 !))
196@end lisp
197
190@c =================================================================== 198@c ===================================================================
191 199
192@node The Basics 200@node The Basics
@@ -756,8 +764,8 @@ Pops up a menu to set the current row as the header, or revert to
756column letters. 764column letters.
757@item M-x ses-rename-cell 765@item M-x ses-rename-cell
758@findex ses-rename-cell 766@findex ses-rename-cell
759Rename a cell from a standard A1-like name to any 767Rename a cell from a standard A1-like name to any string that can be a
760string. 768valid local variable name (See also @ref{Nonrelocatable references}).
761@item M-x ses-repair-cell-reference-all 769@item M-x ses-repair-cell-reference-all
762@findex ses-repair-cell-reference-all 770@findex ses-repair-cell-reference-all
763When you interrupt a cell formula update by clicking @kbd{C-g}, then 771When you interrupt a cell formula update by clicking @kbd{C-g}, then
@@ -952,8 +960,17 @@ are some useful functions to call from your formulas:
952 960
953@table @code 961@table @code
954@item (ses-delete-blanks &rest @var{args}) 962@item (ses-delete-blanks &rest @var{args})
955Returns a list from which all blank cells (value is either @code{nil} or 963Returns a list from which all blank cells (value is either @code{nil}
956'*skip*) have been deleted. 964or '*skip*) have been deleted. Order of args is reverted. Please note
965that @code{ses-range} has a @code{!} modifier that allows to remove
966blanks, so it is possible to write:
967@lisp
968(ses-range A1 A5 !)
969@end lisp
970instead of
971@lisp
972(apply 'ses-delete-blanks (ses-range A1 A5 <))
973@end lisp
957 974
958@item (ses+ &rest @var{args}) 975@item (ses+ &rest @var{args})
959Sum of non-blank arguments. 976Sum of non-blank arguments.
@@ -1003,9 +1020,9 @@ this to undo the effect of @kbd{t}.
1003@end table 1020@end table
1004 1021
1005When a printer function signals an error, the fallback printer 1022When a printer function signals an error, the fallback printer
1006@samp{"%s"} is substituted. This is useful when your column printer 1023@samp{"%S"} is substituted. This is useful when your column printer
1007is numeric-only and you use a string as a cell value. Note that the 1024is numeric-only and you use a string as a cell value. Note that the
1008standard default printer is ``%.7g'' which is numeric-only, so cells 1025standard default printer is @samp{"%.7g"} which is numeric-only, so cells
1009that are empty of contain strings will use the fallback printer. 1026that are empty of contain strings will use the fallback printer.
1010@kbd{c} on such cells will display ``Format specifier doesn't match 1027@kbd{c} on such cells will display ``Format specifier doesn't match
1011argument type''. 1028argument type''.
@@ -1147,7 +1164,18 @@ can type ahead without worrying about the glitch.
1147@kbd{C-u C-y} relocates none of the cell-references. What about mixed 1164@kbd{C-u C-y} relocates none of the cell-references. What about mixed
1148cases? 1165cases?
1149 1166
1150You can use 1167The best way is to rename cells that you do not want to be relocatable
1168by using @code{ses-rename-cell}.
1169@findex ses-rename-cell
1170Cells that do not have an A1-like name style are not relocated on
1171yank. Using this method, the concerned cells won't be relocated
1172whatever formula they appear in. Please note however that when a
1173formula contains some range @code{(ses-range @var{cell1} @var{cell2})}
1174then in the yanked formula each range bound @var{cell1} and
1175@var{cell2} are relocated, or not, indepently, depending on whether
1176they are A1-like or renamed.
1177
1178An alternative method is to use
1151@lisp 1179@lisp
1152(symbol-value 'B3) 1180(symbol-value 'B3)
1153@end lisp 1181@end lisp
@@ -1155,7 +1183,8 @@ to make an @dfn{absolute reference}. The formula relocator skips over
1155quoted things, so this will not be relocated when pasted or when 1183quoted things, so this will not be relocated when pasted or when
1156rows/columns are inserted/deleted. However, B3 will not be recorded 1184rows/columns are inserted/deleted. However, B3 will not be recorded
1157as a dependency of this cell, so this cell will not be updated 1185as a dependency of this cell, so this cell will not be updated
1158automatically when B3 is changed. 1186automatically when B3 is changed, this is why using
1187@code{ses-rename-cell} is most of the time preferable.
1159 1188
1160The variables @code{row} and @code{col} are dynamically bound while a 1189The variables @code{row} and @code{col} are dynamically bound while a
1161cell formula is being evaluated. You can use 1190cell formula is being evaluated. You can use
@@ -1172,12 +1201,13 @@ kind of dependency is also not recorded.
1172@findex ses-reconstruct-all 1201@findex ses-reconstruct-all
1173 1202
1174Begins with an 014 character, followed by sets of cell-definition 1203Begins with an 014 character, followed by sets of cell-definition
1175macros for each row, followed by column-widths, column-printers, 1204macros for each row, followed by the set of local printer
1205defintitions, followed by column-widths, column-printers,
1176default-printer, and header-row. Then there's the global parameters 1206default-printer, and header-row. Then there's the global parameters
1177(file-format ID, numrows, numcols) and the local variables (specifying 1207(file-format ID, row count, column count, local printer count) and the
1178@acronym{SES} mode for the buffer, etc.). 1208local variables (specifying @acronym{SES} mode for the buffer, etc.).
1179 1209
1180When a @acronym{SES} file is loaded, first the numrows and numcols values are 1210When a @acronym{SES} file is loaded, first the global parameters are
1181loaded, then the entire data area is @code{eval}ed, and finally the local 1211loaded, then the entire data area is @code{eval}ed, and finally the local
1182variables are processed. 1212variables are processed.
1183 1213
diff --git a/lisp/ses.el b/lisp/ses.el
index ad3c39e93ea..9abbd6dd2ca 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1,3 +1,4 @@
1
1;;; ses.el -- Simple Emacs Spreadsheet -*- lexical-binding:t -*- 2;;; ses.el -- Simple Emacs Spreadsheet -*- lexical-binding:t -*-
2 3
3;; Copyright (C) 2002-2016 Free Software Foundation, Inc. 4;; Copyright (C) 2002-2016 Free Software Foundation, Inc.
@@ -565,6 +566,10 @@ definition."
565 ((functionp printer) printer) 566 ((functionp printer) printer)
566 ((stringp printer) 567 ((stringp printer)
567 `(lambda (x) (format ,printer x))) 568 `(lambda (x) (format ,printer x)))
569 ((stringp (car-safe printer))
570 `(lambda (x)
571 (setq ses-call-printer-return t)
572 (format ,(car printer) x)))
568 (t (error "Invalid printer %S" printer)))) 573 (t (error "Invalid printer %S" printer))))
569 574
570(defun ses--local-printer (name def) 575(defun ses--local-printer (name def)
@@ -3798,7 +3803,7 @@ Use `math-format-value' as a printer for Calc objects."
3798 "Return ARGS reversed, with the blank elements (nil and *skip*) removed." 3803 "Return ARGS reversed, with the blank elements (nil and *skip*) removed."
3799 (let (result) 3804 (let (result)
3800 (dolist (cur args) 3805 (dolist (cur args)
3801 (unless (memq cur '(nil *skip* *error*)) 3806 (unless (memq cur '(nil *skip*))
3802 (push cur result))) 3807 (push cur result)))
3803 result)) 3808 result))
3804 3809