gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Dec 4 08:34:53 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/9e23e41f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/da32fb0d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/51e3a657 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/82d3bcd3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a2ef6ed6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c094c076 (commit)
	from  https://github.com/Gnucash/gnucash/commit/1a8b4820 (commit)



commit 9e23e41fe60835d9b86fe8f9591ec1d84a37839b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 20:52:08 2020 +0800

    [piechart|scatter] define gnc:not-all-zeros locally
    
    which ensures that html-piechart and html-scatter converted into
    modules do not need to import this function from elsewhere.

diff --git a/gnucash/report/html-piechart.scm b/gnucash/report/html-piechart.scm
index 2bc56d1dc..fb6f3a3e6 100644
--- a/gnucash/report/html-piechart.scm
+++ b/gnucash/report/html-piechart.scm
@@ -151,6 +151,14 @@
 (define gnc:html-piechart-set-button-3-legend-urls!
   (record-modifier <html-piechart> 'button-3-legend-urls))
 
+(define (gnc:not-all-zeros data)
+  (define (myor list)
+    (if (null? list) #f
+        (or (car list) (myor (cdr list)))))
+  (cond ((number? data) (not (= 0 data)))
+	((list? data) (myor (map gnc:not-all-zeros data)))
+	(else #f)))
+
 (define (gnc:html-piechart-render piechart doc)
   (let* ((chart (gnc:make-html-chart))
          (title (gnc:html-piechart-title piechart))
diff --git a/gnucash/report/html-scatter.scm b/gnucash/report/html-scatter.scm
index 77ebf5aa8..d16f92569 100644
--- a/gnucash/report/html-scatter.scm
+++ b/gnucash/report/html-scatter.scm
@@ -132,6 +132,14 @@
        scatter
        (cons newpoint (gnc:html-scatter-data scatter)))))
 
+(define (gnc:not-all-zeros data)
+  (define (myor list)
+    (if (null? list) #f
+        (or (car list) (myor (cdr list)))))
+  (cond ((number? data) (not (= 0 data)))
+	((list? data) (myor (map gnc:not-all-zeros data)))
+	(else #f)))
+
 ;; The Renderer
 (define (gnc:html-scatter-render scatter doc)
   (let* ((chart (gnc:make-html-chart))

commit da32fb0dae3f24eece68f8486810477e3410c037
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 18:37:21 2020 +0800

    [utilities] simplify addto!

diff --git a/bindings/guile/utilities.scm b/bindings/guile/utilities.scm
index 77189db5f..fe025ea74 100644
--- a/bindings/guile/utilities.scm
+++ b/bindings/guile/utilities.scm
@@ -76,10 +76,8 @@
 (define-public (gnc:gui-error str1 str2) (gnc:error str1))
 (define-public (gnc:gui-msg str1 str2) (gnc:msg str1))
 
-(define-syntax addto!
-  (syntax-rules ()
-    ((addto! alist element)
-     (set! alist (cons element alist)))))
+(define-syntax-rule (addto! alist element)
+  (set! alist (cons element alist)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; pair of utility functions for use with guile-json which requires

commit 51e3a6576253e68774ff44b1279313ed973c163d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 18:37:07 2020 +0800

    [options.scm] typo ref -> list-ref

diff --git a/libgnucash/app-utils/options.scm b/libgnucash/app-utils/options.scm
index f5fe006ba..d9a0b73d0 100644
--- a/libgnucash/app-utils/options.scm
+++ b/libgnucash/app-utils/options.scm
@@ -1103,7 +1103,7 @@ the option '~a'."))
      (vector (lambda () (length ok-values))
              (lambda (x) (vector-ref (list-ref ok-values x) 0))
              (lambda (x) (vector-ref (list-ref ok-values x) 1))
-             (lambda (x) (vector-ref (ref ok-values x) 2))
+             (lambda (x) (vector-ref (list-ref ok-values x) 2))
              (lambda (x) (gnc:multichoice-list-lookup ok-values x)))
      (lambda () (list-strings ok-values)) #f)))
 

commit 82d3bcd394b763df80253cb37e96444520afa0ae
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 18:36:36 2020 +0800

    [core-utils] N_ is identity function
    
    N_ is mapped to the identity function. Previously N_ was defined as a
    macro, which is more tricky to export.

diff --git a/bindings/guile/core-utils.scm b/bindings/guile/core-utils.scm
index 58685cee0..422fd3a6b 100644
--- a/bindings/guile/core-utils.scm
+++ b/bindings/guile/core-utils.scm
@@ -49,7 +49,7 @@
 (define G_ gnc:gettext)
 (define NG_ gnc:ngettext)
 (define C_ gnc:C-gettext)
-(define-syntax-rule (N_ x) x)
+(define N_ identity)
 
 ;; the following will define _ to call gnc:gettext for guile up to
 ;; 2.2. It may be removed in the future when minimum guile is 3.0.

commit a2ef6ed6a5b6cf8e65599670d37ff7935910db6e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 18:36:22 2020 +0800

    Use proper format syntax

diff --git a/gnucash/report/html-text.scm b/gnucash/report/html-text.scm
index 7fb0da9c5..3837a7eda 100644
--- a/gnucash/report/html-text.scm
+++ b/gnucash/report/html-text.scm
@@ -133,7 +133,7 @@
             (apply string-append
                    (gnc:html-document-tree-collapse rendered-elt)))
            (#t 
-            (format "hold on there podner. form='~s'\n" rendered-elt)
+            (format #f "hold on there podner. form=~s\n" rendered-elt)
             ""))))
       entities))))
 
diff --git a/libgnucash/app-utils/date-utilities.scm b/libgnucash/app-utils/date-utilities.scm
index 6d7faae88..4f89fc98c 100644
--- a/libgnucash/app-utils/date-utilities.scm
+++ b/libgnucash/app-utils/date-utilities.scm
@@ -68,7 +68,7 @@
   (gnc-print-time64 (gnc-mktime datevec) "%Y"))
 
 (define (gnc:date-get-quarter-string datevec)
-  (format #f "Q~d" (gnc:date-get-quarter datevec)))
+  (format #f "Q~a" (gnc:date-get-quarter datevec)))
 
 (define (gnc:date-get-quarter-year-string datevec)
   (string-append 

commit c094c07616d7d05c54ee659728812937c7e549c9
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Dec 4 18:35:52 2020 +0800

    [balsheet-eg] instead of before, use macros after definition

diff --git a/gnucash/report/reports/standard/balsheet-eg.scm b/gnucash/report/reports/standard/balsheet-eg.scm
index 4383e647a..4899e8194 100644
--- a/gnucash/report/reports/standard/balsheet-eg.scm
+++ b/gnucash/report/reports/standard/balsheet-eg.scm
@@ -69,48 +69,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; Define an account record for cacheing information about all the accounts
-(define (accrec-printer accrec port)
-  ;; accrec printer.  This is for debugging reports, so it uses
-  ;; HTML for pretty-printing
-  (set-current-output-port port)
-  (display "accrec:- ")
-  (display " account: ")     (display (dump (accrec-account accrec)))
-  (display " code: ")        (display (accrec-code accrec))
-  (display " placeholder: ") (display (dump (accrec-placeholder? accrec)))
-  (display " namelink: ")    (display (accrec-namelink accrec))
-  (display " commodity: ")   (if (accrec-commodity accrec)
-                               (display (gnc-commodity-get-mnemonic (accrec-commodity accrec)))
-                               (display "#f"))
-  (display " balance-num: ") (if (accrec-balance-num accrec)
-                               (display (gnc-numeric-to-double (accrec-balance-num accrec)))
-                               ;(display (gnc:monetary->string (accrec-balance-mny accrec)))
-                               ;(display (format-monetary (accrec-balance-num accrec))) ; not this -- too fancy
-                               (display "#f"))
-  (display " depth: ")       (display (accrec-depth accrec))
-  (display " treedepth: ")   (display (accrec-treedepth accrec))
-  (display " non-zero?: ")   (display (accrec-non-zero? accrec))
-  (display " summary?: ")    (display (accrec-summary? accrec))
-  (display " subtotal-cc: ") (if (accrec-subtotal-cc accrec)
-                               ;(display (get-comm-coll-total (accrec-subtotal-cc accrec) #f))
-                               ;(display (format-comm-coll (accrec-subtotal-cc accrec)))
-                               (display
-                                 (string-concatenate
-                                   (map-in-order
-                                     (lambda (mny)
-                                       (string-append (gnc:monetary->string mny) " "))
-                                     ((accrec-subtotal-cc accrec) 'format gnc:make-gnc-monetary #f))))
-                               (display "#f"))
-  (display " sublist: ")     (if (accrec-sublist accrec)
-                               (begin
-                                 (display "\n<ul>")
-                                 (for-each
-                                  (lambda (sub-accrec)
-                                     (display "\n<li>")
-                                     (accrec-printer sub-accrec port)
-                                     (display "</li>"))
-                                  (accrec-sublist accrec))
-                                 (display "</ul>"))
-                               (display "#f")))
 
 (define-record-type <accrec>
   (newaccrec-full account code placeholder? namelink commodity balance-num depth
@@ -129,6 +87,51 @@
   (subtotal-cc accrec-subtotal-cc accrec-set-subtotal-cc!)
   (sublist accrec-sublist accrec-set-sublist!))
 
+(define (accrec-printer accrec port)
+  ;; accrec printer.  This is for debugging reports, so it uses
+  ;; HTML for pretty-printing
+  (set-current-output-port port)
+  (display "accrec:- ")
+  (display " account: ")     (display (dump (accrec-account accrec)))
+  (display " code: ")        (display (accrec-code accrec))
+  (display " placeholder: ") (display (dump (accrec-placeholder? accrec)))
+  (display " namelink: ")    (display (accrec-namelink accrec))
+  (display " commodity: ")
+  (if (accrec-commodity accrec)
+      (display (gnc-commodity-get-mnemonic (accrec-commodity accrec)))
+      (display "#f"))
+  (display " balance-num: ")
+  (if (accrec-balance-num accrec)
+      (display (gnc-numeric-to-double (accrec-balance-num accrec)))
+      (display "#f"))
+  (display " depth: ")       (display (accrec-depth accrec))
+  (display " treedepth: ")   (display (accrec-treedepth accrec))
+  (display " non-zero?: ")   (display (accrec-non-zero? accrec))
+  (display " summary?: ")    (display (accrec-summary? accrec))
+  (display " subtotal-cc: ")
+  (if (accrec-subtotal-cc accrec)
+      ;;(display (get-comm-coll-total (accrec-subtotal-cc accrec) #f))
+      ;;(display (format-comm-coll (accrec-subtotal-cc accrec)))
+      (display
+       (string-concatenate
+        (map-in-order
+         (lambda (mny)
+           (string-append (gnc:monetary->string mny) " "))
+         ((accrec-subtotal-cc accrec) 'format gnc:make-gnc-monetary #f))))
+      (display "#f"))
+  (display " sublist: ")
+  (if (accrec-sublist accrec)
+      (begin
+        (display "\n<ul>")
+        (for-each
+         (lambda (sub-accrec)
+           (display "\n<li>")
+           (accrec-printer sub-accrec port)
+           (display "</li>"))
+         (accrec-sublist accrec))
+        (display "</ul>"))
+      (display "#f")))
+
 (define (accrec-balance-mny accrec)
   (gnc:make-gnc-monetary (accrec-commodity accrec) (accrec-balance-num accrec)))
 



Summary of changes:
 bindings/guile/core-utils.scm                   |  2 +-
 bindings/guile/utilities.scm                    |  6 +-
 gnucash/report/html-piechart.scm                |  8 +++
 gnucash/report/html-scatter.scm                 |  8 +++
 gnucash/report/html-text.scm                    |  2 +-
 gnucash/report/reports/standard/balsheet-eg.scm | 87 +++++++++++++------------
 libgnucash/app-utils/date-utilities.scm         |  2 +-
 libgnucash/app-utils/options.scm                |  2 +-
 8 files changed, 67 insertions(+), 50 deletions(-)



More information about the gnucash-changes mailing list