gnucash master: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon Jun 22 08:18:14 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/d5a95727 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8db13470 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/851bc7f8 (commit)
	from  https://github.com/Gnucash/gnucash/commit/f072fef0 (commit)



commit d5a957278f2a7f7158615b56cc67897589f43251
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jun 22 19:52:32 2020 +0800

    [html-utilities] use ice-9 match

diff --git a/gnucash/report/html-utilities.scm b/gnucash/report/html-utilities.scm
index d54a8528f..61812ca9d 100644
--- a/gnucash/report/html-utilities.scm
+++ b/gnucash/report/html-utilities.scm
@@ -24,6 +24,7 @@
 
 (use-modules (gnucash engine))
 (use-modules (gnucash utilities))
+(use-modules (ice-9 match))
 
 ;; returns a list with n #f (empty cell) values 
 (define (gnc:html-make-empty-cell) #f)
@@ -283,32 +284,18 @@
         (if (not (or (equal? default-value value)
                      (char=? (string-ref section 0) #\_)))
             (addto! render-list retval))))
+    (define (name-fn name) (if plaintext? name (gnc:html-markup-b name)))
+    (define br (if plaintext? "\n" (gnc:html-markup-br)))
     (for-each
      (lambda (child)
        (let ((report (gnc-report-find (car child))))
          (addto! render-list (cons "Embedded Report" (gnc:report-name report)))))
      (or report-list '()))
     (gnc:options-for-each add-option-if-changed options)
-    (if plaintext?
-        (string-append
-         (string-join
-          (map (lambda (item)
-                 (format #f "~a: ~a\n" (car item) (cdr item)))
-               render-list)
-          "")
-         "\n")
-        (apply
-         gnc:make-html-text
-         (apply
-          append
-          (map
-           (lambda (item)
-             (list
-              (gnc:html-markup-b (car item))
-              ": "
-              (cdr item)
-              (gnc:html-markup-br)))
-           render-list))))))
+    (let lp ((render-list (reverse render-list)) (acc '()))
+      (match render-list
+        (() (if plaintext? (string-concatenate acc) (apply gnc:make-html-text acc)))
+        (((name . val) . rest) (lp rest (cons* (name-fn name) ": " val br acc)))))))
 
 (define (gnc:html-make-generic-warning
          report-title-string report-id

commit 8db13470e2a8d383b5d21bccb287839a1ee13cb3
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jun 22 19:36:52 2020 +0800

    deprecations: remove functions deprecated in 3.x

diff --git a/gnucash/report/html-table.scm b/gnucash/report/html-table.scm
index 4cb3a2ba2..e37ff75bb 100644
--- a/gnucash/report/html-table.scm
+++ b/gnucash/report/html-table.scm
@@ -204,17 +204,6 @@
 (define gnc:html-table-set-caption!
   (record-modifier <html-table> 'caption))
 
-;; note the following function is now generally unused.
-(define (gnc:html-table-col-headers table)
-  (issue-deprecation-warning "gnc:html-table-col-headers is deprecated. \
-use gnc:html-table-multirow-col-headers instead.")
-  (let ((headers ((record-accessor <html-table> 'col-headers) table)))
-    (cond
-     ((not headers) #f)
-     ((null? (cdr headers)) (car headers))
-     (else (gnc:warn "gnc:html-table-col-headers used on a table object \
-with multiple rows. returning the first row only.") (car headers)))))
-
 (define (gnc:html-table-set-col-headers! table col-headers)
   (gnc:html-table-set-multirow-col-headers! table (list col-headers)))
 
@@ -224,14 +213,6 @@ with multiple rows. returning the first row only.") (car headers)))))
 (define gnc:html-table-set-multirow-col-headers!
   (record-modifier <html-table> 'col-headers))
 
-(define (gnc:html-table-row-headers table)
-  (issue-deprecation-warning "gnc:html-table-row-headers is unused.")
-  ((record-accessor <html-table> 'row-headers) table))
-
-(define (gnc:html-table-set-row-headers! table . rest)
-  (issue-deprecation-warning "gnc:html-table-set-row-headers! is unused.")
-  (apply (record-modifier <html-table> 'row-headers) table rest))
-
 (define gnc:html-table-style
   (record-accessor <html-table> 'style))
 
diff --git a/gnucash/report/report.scm b/gnucash/report/report.scm
index b48b3d7d5..e1a2eb7da 100644
--- a/gnucash/report/report.scm
+++ b/gnucash/report/report.scm
@@ -569,12 +569,9 @@
 (export gnc:html-table-set-data!)
 (export gnc:html-table-caption)
 (export gnc:html-table-set-caption!)
-(export gnc:html-table-col-headers)
 (export gnc:html-table-set-col-headers!)
 (export gnc:html-table-multirow-col-headers)
 (export gnc:html-table-set-multirow-col-headers!)
-(export gnc:html-table-row-headers)
-(export gnc:html-table-set-row-headers!)
 (export gnc:html-table-style)
 (export gnc:html-table-set-style-internal!)
 (export gnc:html-table-row-styles)
diff --git a/gnucash/report/test/test-report-html.scm b/gnucash/report/test/test-report-html.scm
index 83143db21..c9792fe78 100644
--- a/gnucash/report/test/test-report-html.scm
+++ b/gnucash/report/test/test-report-html.scm
@@ -637,11 +637,6 @@ HTML Document Title</title></head><body></body>\n\
                (test-doc (gnc:make-html-document))
                (test-table (gnc:make-html-table))
              )
-          ;; change the default settings just to see what effect it has
-          ;;(gnc:html-table-set-col-headers! test-table #t)
-          ;; -> this make (gnc:html-table-render test-table test-doc) crash
-          ;; col-headers must be #f or a list
-          (gnc:html-table-set-row-headers! test-table #t)
           (gnc:html-table-set-caption! test-table #t)
           (gnc:html-table-append-row! test-table "Row 1")
           (gnc:html-table-append-row! test-table "Row 2")
@@ -660,11 +655,6 @@ HTML Document Title</title></head><body></body>\n\
                (test-doc (gnc:make-html-document))
                (test-table (gnc:make-html-table))
              )
-          ;; change the default settings just to see what effect it has
-          ;;(gnc:html-table-set-col-headers! test-table #t)
-          ;; -> this make (gnc:html-table-render test-table test-doc) crash
-          ;; col-headers must be #f or a list
-          (gnc:html-table-set-row-headers! test-table #t)
           (gnc:html-table-set-caption! test-table #t)
           (gnc:html-table-append-row! test-table "Row 2")
           (gnc:html-table-prepend-row! test-table "Row 1")
@@ -687,11 +677,6 @@ HTML Document Title</title></head><body></body>\n\
              (test-doc (gnc:make-html-document))
              (test-table (gnc:make-html-table))
            )
-        ;; change the default settings just to see what effect it has
-        ;;(gnc:html-table-set-col-headers! test-table #t)
-        ;; -> this make (gnc:html-table-render test-table test-doc) crash
-        ;; col-headers must be #f or a list
-        (gnc:html-table-set-row-headers! test-table #t)
         (gnc:html-table-set-caption! test-table #t)
         (gnc:html-table-append-row! test-table "Row 1")
         (gnc:html-table-append-row! test-table "Row 2")
@@ -718,11 +703,6 @@ HTML Document Title</title></head><body></body>\n\
              (test-doc (gnc:make-html-document))
              (test-table (gnc:make-html-table))
            )
-        ;; change the default settings just to see what effect it has
-        ;;(gnc:html-table-set-col-headers! test-table #t)
-        ;; -> this make (gnc:html-table-render test-table test-doc) crash
-        ;; col-headers must be #f or a list
-        (gnc:html-table-set-row-headers! test-table #t)
         (gnc:html-table-set-caption! test-table #t)
         (gnc:html-table-append-row! test-table "r1c1")
         (gnc:html-table-append-row! test-table '("r2c1" "r2c2" "r2c3"))
@@ -747,11 +727,6 @@ HTML Document Title</title></head><body></body>\n\
              (test-doc (gnc:make-html-document))
              (test-table (gnc:make-html-table))
            )
-        ;; change the default settings just to see what effect it has
-        ;;(gnc:html-table-set-col-headers! test-table #t)
-        ;; -> this make (gnc:html-table-render test-table test-doc) crash
-        ;; col-headers must be #f or a list
-        (gnc:html-table-set-row-headers! test-table #t)
         (gnc:html-table-set-caption! test-table #t)
         (gnc:html-table-append-row! test-table "Row 1")
         (gnc:html-table-append-row! test-table "Row 2")

commit 851bc7f8d962e7605f94d67d53e9cb4234c32ec4
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jun 22 19:17:48 2020 +0800

    deprecations: clarify functions deprecated in 4.x.

diff --git a/bindings/guile/business-core.scm b/bindings/guile/business-core.scm
index abaec8ce5..c153e8f13 100644
--- a/bindings/guile/business-core.scm
+++ b/bindings/guile/business-core.scm
@@ -100,7 +100,7 @@
 (define (gnc:owner-from-split split result-owner)
   (define (notnull x) (and (not (null? x)) x))
   (issue-deprecation-warning
-   "gnc:owner-from-split is deprecated. use gnc:split->owner instead.")
+   "gnc:owner-from-split is deprecated in 4.x. use gnc:split->owner instead.")
   (let* ((trans (xaccSplitGetParent split))
 	 (invoice (notnull (gncInvoiceGetInvoiceFromTxn trans)))
 	 (temp (gncOwnerNew))
diff --git a/bindings/guile/gnc-module.scm b/bindings/guile/gnc-module.scm
index 9d916fb8e..129974360 100644
--- a/bindings/guile/gnc-module.scm
+++ b/bindings/guile/gnc-module.scm
@@ -30,6 +30,7 @@
 (use-modules (ice-9 match))
 
 (define (deprecate . lst)
+  ;; 4.x deprecation. remove in 5.x
   (issue-deprecation-warning (string-concatenate lst)))
 
 (define (no-op-deprecation-warning)
diff --git a/bindings/guile/utilities.scm b/bindings/guile/utilities.scm
index 075b07547..77189db5f 100644
--- a/bindings/guile/utilities.scm
+++ b/bindings/guile/utilities.scm
@@ -154,7 +154,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public (gnc:substring-replace-from-to s1 s2 s3 start end-after)
-  (issue-deprecation-warning "gnc:substring-replace-from-to is deprecated.")
+  (issue-deprecation-warning "gnc:substring-replace-from-to is deprecated in 4.x.")
   (string-replace-substring
    s1 s2 s3 0 (string-length s1) (max 0 (1- start))
    (and (positive? end-after) (+ (max 0 (1- start)) (1- end-after)))))
diff --git a/gnucash/report/eguile-utilities.scm b/gnucash/report/eguile-utilities.scm
index 3f78ee888..e8c12e94c 100644
--- a/gnucash/report/eguile-utilities.scm
+++ b/gnucash/report/eguile-utilities.scm
@@ -66,7 +66,7 @@
   (let* ((stylesheetpath (find-stylesheet fname))
          (templatepath  (find-template fname)))
     ; make sure there's a trailing delimiter
-      (issue-deprecation-warning "find-file is deprecated. Please use find-stylesheet or find-template instead.")
+      (issue-deprecation-warning "find-file is deprecated in 4.x. Please use find-stylesheet or find-template instead.")
       (cond
        ((access? stylesheetpath R_OK) stylesheetpath)
        ((access? templatepath R_OK) templatepath)
diff --git a/gnucash/report/html-barchart.scm b/gnucash/report/html-barchart.scm
index 2f5fe8764..23967a741 100644
--- a/gnucash/report/html-barchart.scm
+++ b/gnucash/report/html-barchart.scm
@@ -67,7 +67,7 @@
 
 (define (gnc:make-html-barchart)
   (issue-deprecation-warning
-   "(gnc:make-html-barchart) is deprecated. use gnc:make-html-chart instead.")
+   "(gnc:make-html-barchart) is deprecated in 4.x. use gnc:make-html-chart instead.")
   (gnc:make-html-barchart-internal '(pixels . -1) '(pixels . -1) #f #f #f #f '() '() '() 
 				   #f #f #f '() #f #f #f #f #f #f))
 
diff --git a/gnucash/report/html-linechart.scm b/gnucash/report/html-linechart.scm
index 4fca2f9ca..cd79048c0 100644
--- a/gnucash/report/html-linechart.scm
+++ b/gnucash/report/html-linechart.scm
@@ -74,7 +74,7 @@
 
 (define (gnc:make-html-linechart)
   (issue-deprecation-warning
-   "(gnc:make-html-linechart) is deprecated. use gnc:make-html-chart instead.")
+   "(gnc:make-html-linechart) is deprecated in 4.x. use gnc:make-html-chart instead.")
   (gnc:make-html-linechart-internal
     '(pixels . -1)  ;;width
     '(pixels . -1)  ;;height
diff --git a/gnucash/report/html-piechart.scm b/gnucash/report/html-piechart.scm
index 169312d9f..3bdc7fd21 100644
--- a/gnucash/report/html-piechart.scm
+++ b/gnucash/report/html-piechart.scm
@@ -62,7 +62,7 @@
 
 (define (gnc:make-html-piechart)
   (issue-deprecation-warning
-   "(gnc:make-html-piechart) is deprecated. use gnc:make-html-chart instead.")
+   "(gnc:make-html-piechart) is deprecated in 4.x. use gnc:make-html-chart instead.")
   (gnc:make-html-piechart-internal '(pixels . -1) '(pixels . -1) #f #f #f #f #f #f #f #f #f #f #f))
 
 (define gnc:html-piechart-data
diff --git a/gnucash/report/html-scatter.scm b/gnucash/report/html-scatter.scm
index 620d61210..f1532d797 100644
--- a/gnucash/report/html-scatter.scm
+++ b/gnucash/report/html-scatter.scm
@@ -68,7 +68,7 @@
 
 (define (gnc:make-html-scatter)
   (issue-deprecation-warning
-   "(gnc:make-html-scatter) is deprecated. use gnc:make-html-chart instead.")
+   "(gnc:make-html-scatter) is deprecated in 4.x. use gnc:make-html-chart instead.")
   (gnc:make-html-scatter-internal '(pixels . -1) '(pixels . -1) #f #f #f #f '() #f #f))
 
 (define gnc:html-scatter-width
diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
index b6d7f63f4..64d648802 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/libgnucash/app-utils/app-utils.scm
@@ -309,11 +309,11 @@
 
 ;; Symbols deprecated in 4.x, to remove for 5.x
 (define-public (gnc:get-debit-string acct-type)
-    (issue-deprecation-warning "gnc:get-debit-string is deprecated. Please use (gnucash engine)'s gnc-account-get-debit-string instead.")
+    (issue-deprecation-warning "gnc:get-debit-string is deprecated in 4.x. Please use (gnucash engine)'s gnc-account-get-debit-string instead.")
     (gnc-account-get-debit-string acct-type))
 (define-public (gnc:get-credit-string acct-type)
-    (issue-deprecation-warning "gnc:get-credit-string is deprecated. Please use (gnucash engine)'s gnc-account-get-credit-string instead.")
+    (issue-deprecation-warning "gnc:get-credit-string is deprecated in 4.x. Please use (gnucash engine)'s gnc-account-get-credit-string instead.")
     (gnc-account-get-debit-string acct-type))
 (define-public (gnc:config-file-format-version version)
-    (issue-deprecation-warning "gnc:config-file-format-version is deprecated and will be removed from a future version.")
+    (issue-deprecation-warning "gnc:config-file-format-version is deprecated in 4.x and will be removed from a future version.")
     #t)



Summary of changes:
 bindings/guile/business-core.scm         |  2 +-
 bindings/guile/gnc-module.scm            |  1 +
 bindings/guile/utilities.scm             |  2 +-
 gnucash/report/eguile-utilities.scm      |  2 +-
 gnucash/report/html-barchart.scm         |  2 +-
 gnucash/report/html-linechart.scm        |  2 +-
 gnucash/report/html-piechart.scm         |  2 +-
 gnucash/report/html-scatter.scm          |  2 +-
 gnucash/report/html-table.scm            | 19 -------------------
 gnucash/report/html-utilities.scm        | 27 +++++++--------------------
 gnucash/report/report.scm                |  3 ---
 gnucash/report/test/test-report-html.scm | 25 -------------------------
 libgnucash/app-utils/app-utils.scm       |  6 +++---
 13 files changed, 18 insertions(+), 77 deletions(-)



More information about the gnucash-changes mailing list