summaryrefslogtreecommitdiff
path: root/lisp/ses.el
diff options
context:
space:
mode:
authorVincent Belaïche <vincentb1@users.sourceforge.net>2017-07-17 20:54:20 +0200
committerVincent Belaïche <vincentb1@users.sourceforge.net>2017-07-17 20:54:20 +0200
commit0083123499cc29e301c197218d3809b225675e57 (patch)
treeab320067f489e2c38f91a3e025b2b15e961d07ae /lisp/ses.el
parent002d6abcc76a8a83e5ea191e6f8d6dbed6b714eb (diff)
downloademacs-0083123499cc29e301c197218d3809b225675e57.tar.gz
emacs-0083123499cc29e301c197218d3809b225675e57.tar.bz2
emacs-0083123499cc29e301c197218d3809b225675e57.zip
Fix relocation with named cell referred to by a one-symbol formula.
* lisp/ses.el (ses-replace-name-in-formula): Fix bug for it to work also with one symbol formulas. * test/lisp/ses-tests.el (ses-tests-renaming-cell-with-one-symbol-formula): Add new test for renaming with relocating a one symbol formula.
Diffstat (limited to 'lisp/ses.el')
-rw-r--r--lisp/ses.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/ses.el b/lisp/ses.el
index 2e214348eb9..ed5e166d952 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -3634,8 +3634,12 @@ highlighted range in the spreadsheet."
(defun ses-replace-name-in-formula (formula old-name new-name)
(let ((new-formula formula))
- (unless (and (consp formula)
- (eq (car-safe formula) 'quote))
+ (cond
+ ((eq (car-safe formula) 'quote))
+ ((symbolp formula)
+ (if (eq formula old-name)
+ (setq new-formula new-name)))
+ ((consp formula)
(while formula
(let ((elt (car-safe formula)))
(cond
@@ -3644,8 +3648,8 @@ highlighted range in the spreadsheet."
((and (symbolp elt)
(eq (car-safe formula) old-name))
(setcar formula new-name))))
- (setq formula (cdr formula))))
- new-formula))
+ (setq formula (cdr formula)))))
+ new-formula))
(defun ses-rename-cell (new-name &optional cell)
"Rename current cell."