Browse Source

Table formula: Fix for Lisp return value nil

* lisp/org-table.el (org-table-eval-formula): Substitute `listp' with
`consp'.

* testing/lisp/test-org-table.el (test-org-table/lisp-return-value):
Fix test.
Michael Brand 10 years ago
parent
commit
739136e17f
2 changed files with 3 additions and 4 deletions
  1. 2 2
      lisp/org-table.el
  2. 1 2
      testing/lisp/test-org-table.el

+ 2 - 2
lisp/org-table.el

@@ -2764,7 +2764,7 @@ Orig:   %s
 $xyz->  %s
 @r$c->  %s
 $1->    %s\n" orig formula form0 form))
-	    (if (listp ev)
+	    (if (consp ev)
 		(princ (format "        %s^\nError:  %s"
 			       (make-string (car ev) ?\-) (nth 1 ev)))
 	      (princ (format "Result: %s\nFormat: %s\nFinal:  %s"
@@ -2779,7 +2779,7 @@ $1->    %s\n" orig formula form0 form))
 	      (user-error "Abort"))
 	    (delete-window bw)
 	    (message "")))
-	(if (listp ev) (setq fmt nil ev "#ERROR"))
+	(when (consp ev) (setq fmt nil ev "#ERROR"))
 	(org-table-justify-field-maybe
 	 (format org-table-formula-field-format
 		 (if fmt (format fmt (string-to-number ev)) ev)))

+ 1 - 2
testing/lisp/test-org-table.el

@@ -411,7 +411,6 @@ reference (with row).  Mode string N."
 | type-of (identity @1)   | r           | r      | r   |
 | identity @1             | r           | r      | r   |
 "
-   ;; TODO Fix "#ERROR".
    "
 |                         | nil    | (list) | '()    |
 |-------------------------+--------+--------+--------|
@@ -425,7 +424,7 @@ reference (with row).  Mode string N."
 |-------------------------+--------+--------+--------|
 | type-of @1              | symbol | symbol | symbol |
 | type-of (identity @1)   | symbol | symbol | symbol |
-| identity @1             | #ERROR | #ERROR | #ERROR |
+| identity @1             | nil    | nil    | nil    |
 "
    1 (concat "#+TBLFM: @2$<<..@2$> = '(type-of @1) :: "
 	     "@3$<<..@3$> = '(type-of (identity @1)) :: "