diff options
| author | Vincent Belaïche | 2016-08-09 23:46:13 +0200 |
|---|---|---|
| committer | Vincent Belaïche | 2016-08-09 23:46:13 +0200 |
| commit | 731d225cf3a8f95d3bad0baf60c792afc7d58b78 (patch) | |
| tree | 9d33bc49657e9b4e7aadecc44cc6d76389d212ef | |
| parent | e13c5467fc0c08c6875653df56b8b54185d0c4cc (diff) | |
| download | emacs-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.texi | 54 | ||||
| -rw-r--r-- | lisp/ses.el | 7 |
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 | ||
| 190 | Alternatively you can use the @code{!} modifier of @code{ses-range} to | ||
| 191 | remove 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 | |||
| 756 | column letters. | 764 | column 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 |
| 759 | Rename a cell from a standard A1-like name to any | 767 | Rename a cell from a standard A1-like name to any string that can be a |
| 760 | string. | 768 | valid 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 |
| 763 | When you interrupt a cell formula update by clicking @kbd{C-g}, then | 771 | When 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}) |
| 955 | Returns a list from which all blank cells (value is either @code{nil} or | 963 | Returns a list from which all blank cells (value is either @code{nil} |
| 956 | '*skip*) have been deleted. | 964 | or '*skip*) have been deleted. Order of args is reverted. Please note |
| 965 | that @code{ses-range} has a @code{!} modifier that allows to remove | ||
| 966 | blanks, so it is possible to write: | ||
| 967 | @lisp | ||
| 968 | (ses-range A1 A5 !) | ||
| 969 | @end lisp | ||
| 970 | instead 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}) |
| 959 | Sum of non-blank arguments. | 976 | Sum of non-blank arguments. |
| @@ -1003,9 +1020,9 @@ this to undo the effect of @kbd{t}. | |||
| 1003 | @end table | 1020 | @end table |
| 1004 | 1021 | ||
| 1005 | When a printer function signals an error, the fallback printer | 1022 | When 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 |
| 1007 | is numeric-only and you use a string as a cell value. Note that the | 1024 | is numeric-only and you use a string as a cell value. Note that the |
| 1008 | standard default printer is ``%.7g'' which is numeric-only, so cells | 1025 | standard default printer is @samp{"%.7g"} which is numeric-only, so cells |
| 1009 | that are empty of contain strings will use the fallback printer. | 1026 | that 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 |
| 1011 | argument type''. | 1028 | argument 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 |
| 1148 | cases? | 1165 | cases? |
| 1149 | 1166 | ||
| 1150 | You can use | 1167 | The best way is to rename cells that you do not want to be relocatable |
| 1168 | by using @code{ses-rename-cell}. | ||
| 1169 | @findex ses-rename-cell | ||
| 1170 | Cells that do not have an A1-like name style are not relocated on | ||
| 1171 | yank. Using this method, the concerned cells won't be relocated | ||
| 1172 | whatever formula they appear in. Please note however that when a | ||
| 1173 | formula contains some range @code{(ses-range @var{cell1} @var{cell2})} | ||
| 1174 | then in the yanked formula each range bound @var{cell1} and | ||
| 1175 | @var{cell2} are relocated, or not, indepently, depending on whether | ||
| 1176 | they are A1-like or renamed. | ||
| 1177 | |||
| 1178 | An 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 | |||
| 1155 | quoted things, so this will not be relocated when pasted or when | 1183 | quoted things, so this will not be relocated when pasted or when |
| 1156 | rows/columns are inserted/deleted. However, B3 will not be recorded | 1184 | rows/columns are inserted/deleted. However, B3 will not be recorded |
| 1157 | as a dependency of this cell, so this cell will not be updated | 1185 | as a dependency of this cell, so this cell will not be updated |
| 1158 | automatically when B3 is changed. | 1186 | automatically when B3 is changed, this is why using |
| 1187 | @code{ses-rename-cell} is most of the time preferable. | ||
| 1159 | 1188 | ||
| 1160 | The variables @code{row} and @code{col} are dynamically bound while a | 1189 | The variables @code{row} and @code{col} are dynamically bound while a |
| 1161 | cell formula is being evaluated. You can use | 1190 | cell 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 | ||
| 1174 | Begins with an 014 character, followed by sets of cell-definition | 1203 | Begins with an 014 character, followed by sets of cell-definition |
| 1175 | macros for each row, followed by column-widths, column-printers, | 1204 | macros for each row, followed by the set of local printer |
| 1205 | defintitions, followed by column-widths, column-printers, | ||
| 1176 | default-printer, and header-row. Then there's the global parameters | 1206 | default-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.). | 1208 | local variables (specifying @acronym{SES} mode for the buffer, etc.). |
| 1179 | 1209 | ||
| 1180 | When a @acronym{SES} file is loaded, first the numrows and numcols values are | 1210 | When a @acronym{SES} file is loaded, first the global parameters are |
| 1181 | loaded, then the entire data area is @code{eval}ed, and finally the local | 1211 | loaded, then the entire data area is @code{eval}ed, and finally the local |
| 1182 | variables are processed. | 1212 | variables 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 | ||