emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 731d225 1/3: Apply changes from commits 3c97b0f758


From: Vincent Belaïche
Subject: [Emacs-diffs] master 731d225 1/3: Apply changes from commits 3c97b0f758 and 8a38e948b0 to master branch.
Date: Wed, 10 Aug 2016 08:14:45 +0000 (UTC)

branch: master
commit 731d225cf3a8f95d3bad0baf60c792afc7d58b78
Author: Vincent Belaïche <address@hidden>
Commit: Vincent Belaïche <address@hidden>

    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 <address@hidden>
    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 <address@hidden>
    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.
---
 doc/misc/ses.texi |   54 +++++++++++++++++++++++++++++++++++++++++------------
 lisp/ses.el       |    7 ++++++-
 2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi
index 84d2cc7..c43ddf4 100644
--- a/doc/misc/ses.texi
+++ b/doc/misc/ses.texi
@@ -187,6 +187,14 @@ the end-points, e.g.:
 (The @code{apply} is necessary because @code{ses-range} produces a
 @emph{list} of values.  This allows for more complex possibilities.)
 
+Alternatively you can use the @code{!} modifier of @code{ses-range} to
+remove blank cells which allows to use @code{+} instead of
address@hidden:
+
address@hidden
+(apply '+ (ses-range A2 A5 !))
address@hidden lisp
+
 @c ===================================================================
 
 @node The Basics
@@ -756,8 +764,8 @@ Pops up a menu to set the current row as the header, or 
revert to
 column letters.
 @item M-x ses-rename-cell
 @findex ses-rename-cell
-Rename a cell from a standard A1-like name to any
-string.
+Rename a cell from a standard A1-like name to any string that can be a
+valid local variable name (See also @ref{Nonrelocatable references}).
 @item M-x ses-repair-cell-reference-all
 @findex ses-repair-cell-reference-all
 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:
 
 @table @code
 @item (ses-delete-blanks &rest @var{args})
-Returns a list from which all blank cells (value is either @code{nil} or
-'*skip*) have been deleted.
+Returns a list from which all blank cells (value is either @code{nil}
+or '*skip*) have been deleted. Order of args is reverted. Please note
+that @code{ses-range} has a @code{!} modifier that allows to remove
+blanks, so it is possible to write:
address@hidden
+(ses-range A1 A5 !)
address@hidden lisp
+instead of
address@hidden
+(apply 'ses-delete-blanks (ses-range A1 A5 <))
address@hidden lisp
 
 @item (ses+ &rest @var{args})
 Sum of non-blank arguments.
@@ -1003,9 +1020,9 @@ this to undo the effect of @kbd{t}.
 @end table
 
 When a printer function signals an error, the fallback printer
address@hidden"%s"} is substituted.  This is useful when your column printer
address@hidden"%S"} is substituted.  This is useful when your column printer
 is numeric-only and you use a string as a cell value.  Note that the
-standard default printer is ``%.7g'' which is numeric-only, so cells
+standard default printer is @samp{"%.7g"} which is numeric-only, so cells
 that are empty of contain strings will use the fallback printer.
 @kbd{c} on such cells will display ``Format specifier doesn't match
 argument type''.
@@ -1147,7 +1164,18 @@ can type ahead without worrying about the glitch.
 @kbd{C-u C-y} relocates none of the cell-references.  What about mixed
 cases?
 
-You can use
+The best way is to rename cells that you do not want to be relocatable
+by using @code{ses-rename-cell}.
address@hidden ses-rename-cell
+Cells that do not have an A1-like name style are not relocated on
+yank. Using this method, the concerned cells won't be relocated
+whatever formula they appear in. Please note however that when a
+formula contains some range @code{(ses-range @var{cell1} @var{cell2})}
+then in the yanked formula each range bound @var{cell1} and
address@hidden are relocated, or not, indepently, depending on whether
+they are A1-like or renamed.
+
+An alternative method is to use
 @lisp
 (symbol-value 'B3)
 @end lisp
@@ -1155,7 +1183,8 @@ to make an @dfn{absolute reference}.  The formula 
relocator skips over
 quoted things, so this will not be relocated when pasted or when
 rows/columns are inserted/deleted.  However, B3 will not be recorded
 as a dependency of this cell, so this cell will not be updated
-automatically when B3 is changed.
+automatically when B3 is changed, this is why using
address@hidden is most of the time preferable.
 
 The variables @code{row} and @code{col} are dynamically bound while a
 cell formula is being evaluated.  You can use
@@ -1172,12 +1201,13 @@ kind of dependency is also not recorded.
 @findex ses-reconstruct-all
 
 Begins with an 014 character, followed by sets of cell-definition
-macros for each row, followed by column-widths, column-printers,
+macros for each row, followed by the set of local printer
+defintitions, followed by column-widths, column-printers,
 default-printer, and header-row.  Then there's the global parameters
-(file-format ID, numrows, numcols) and the local variables (specifying
address@hidden mode for the buffer, etc.).
+(file-format ID, row count, column count, local printer count) and the
+local variables (specifying @acronym{SES} mode for the buffer, etc.).
 
-When a @acronym{SES} file is loaded, first the numrows and numcols values are
+When a @acronym{SES} file is loaded, first the global parameters are
 loaded, then the entire data area is @code{eval}ed, and finally the local
 variables are processed.
 
diff --git a/lisp/ses.el b/lisp/ses.el
index ad3c39e..9abbd6d 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1,3 +1,4 @@
+
 ;;; ses.el -- Simple Emacs Spreadsheet  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2016 Free Software Foundation, Inc.
@@ -565,6 +566,10 @@ definition."
    ((functionp printer) printer)
    ((stringp printer)
     `(lambda (x) (format ,printer x)))
+   ((stringp (car-safe printer))
+    `(lambda (x)
+       (setq ses-call-printer-return t)
+       (format ,(car printer) x)))
    (t (error "Invalid printer %S" printer))))
 
 (defun ses--local-printer (name def)
@@ -3798,7 +3803,7 @@ Use `math-format-value' as a printer for Calc objects."
   "Return ARGS reversed, with the blank elements (nil and *skip*) removed."
   (let (result)
     (dolist (cur args)
-      (unless (memq cur '(nil *skip* *error*))
+      (unless (memq cur '(nil *skip*))
        (push cur result)))
     result))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]