[nongnu] elpa/evil 08b824eac7: Fix up evil-indent (#1613)

2022-05-03 Thread ELPA Syncer
branch: elpa/evil
commit 08b824eac7e261a1dc5e2a12ae71e8144f2d04c6
Author: rbrtb <104695105+rb...@users.noreply.github.com>
Commit: GitHub 

Fix up evil-indent (#1613)

* Fix up evil-indent

* Add evil-test-indent

* Fix up

* Improve test
---
 evil-commands.el | 49 +++--
 evil-tests.el|  9 +
 2 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 2bb14baa0b..d6b2e622af 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1922,28 +1922,33 @@ but doesn't insert or remove any spaces."
   "Indent text."
   :move-point nil
   :type line
-  (if (and (= beg (line-beginning-position))
-   (= end (line-beginning-position 2)))
-  ;; since some Emacs modes can only indent one line at a time,
-  ;; implement "==" as a call to `indent-according-to-mode'
-  (indent-according-to-mode)
-(goto-char beg)
-(indent-region beg end))
-  ;; We also need to tabify or untabify the leading white characters
-  (when evil-indent-convert-tabs
-(let* ((beg-line (line-number-at-pos beg))
-   (end-line (line-number-at-pos end))
-   (ln beg-line)
-   (convert-white (if indent-tabs-mode 'tabify 'untabify)))
-  (save-excursion
-(while (<= ln end-line)
-  (goto-char (point-min))
-  (forward-line (- ln 1))
-  (back-to-indentation)
-  ;; Whether tab or space should be used is determined by 
indent-tabs-mode
-  (funcall convert-white (line-beginning-position) (point))
-  (setq ln (1+ ln)
-(back-to-indentation)))
+  (save-restriction
+(narrow-to-region beg end)
+(if (and (= beg (line-beginning-position))
+ (= end (line-beginning-position 2)))
+;; since some Emacs modes can only indent one line at a time,
+;; implement "==" as a call to `indent-according-to-mode'
+(indent-according-to-mode)
+  (goto-char beg)
+  (indent-region beg end))
+;; Update `beg' and `end'
+(setq beg (point-min)
+  end (point-max))
+;; We also need to tabify or untabify the leading white characters
+(when evil-indent-convert-tabs
+  (let* ((beg-line (line-number-at-pos beg))
+ (end-line (line-number-at-pos end))
+ (ln beg-line)
+ (convert-white (if indent-tabs-mode 'tabify 'untabify)))
+(save-excursion
+  (while (<= ln end-line)
+(goto-char (point-min))
+(forward-line (- ln 1))
+(back-to-indentation)
+;; Whether tab or space should be used is determined by 
indent-tabs-mode
+(funcall convert-white (line-beginning-position) (point))
+(setq ln (1+ ln)
+  (back-to-indentation
 
 (evil-define-operator evil-indent-line (beg end)
   "Indent the line."
diff --git a/evil-tests.el b/evil-tests.el
index e3c251d034..5aa9013831 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -1614,6 +1614,15 @@ New Tex[t]
 
 ;;; Operators
 
+(ert-deftest evil-test-indent ()
+  "Test `evil-indent'"
+  :tags '(evil visual operator)
+  (evil-test-buffer
+:state visual
+""
+("=")
+"Line with too much indentation."))
+
 (ert-deftest evil-test-keypress-parser ()
   "Test `evil-keypress-parser'"
   :tags '(evil operator)



[nongnu] elpa/elpher bf0dd36eb2: Patch release.

2022-05-03 Thread ELPA Syncer
branch: elpa/elpher
commit bf0dd36eb2f5b339c6b561dbe3ee9693565b484b
Author: plugd 
Commit: plugd 

Patch release.
---
 config.mk | 2 +-
 elpher-pkg.el | 2 +-
 elpher.el | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config.mk b/config.mk
index 6647c4c6fa..79071f5a79 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
 PKG = elpher
-VERSION = 3.4.0
+VERSION = 3.4.1
 
 INSTALLINFO = install-info
 MAKEINFO= makeinfo
diff --git a/elpher-pkg.el b/elpher-pkg.el
index 9130582ee3..a0a4daa455 100644
--- a/elpher-pkg.el
+++ b/elpher-pkg.el
@@ -1,4 +1,4 @@
-(define-package "elpher" "3.4.0" "A friendly gopher and gemini client"
+(define-package "elpher" "3.4.1" "A friendly gopher and gemini client"
   '((emacs "27.1"))
   :keywords ("convenience")
   :authors (("Tim Vaughan" . "pl...@thelambdalab.xyz"))
diff --git a/elpher.el b/elpher.el
index e7b37ba017..92362286fe 100644
--- a/elpher.el
+++ b/elpher.el
@@ -5,7 +5,7 @@
 
 ;; Author: Tim Vaughan 
 ;; Created: 11 April 2019
-;; Version: 3.4.0
+;; Version: 3.4.1
 ;; Keywords: comm gopher
 ;; Homepage: https://thelambdalab.xyz/elpher
 ;; Package-Requires: ((emacs "27.1"))
@@ -70,7 +70,7 @@
 ;;; Global constants
 ;;
 
-(defconst elpher-version "3.4.0"
+(defconst elpher-version "3.4.1"
   "Current version of elpher.")
 
 (defconst elpher-margin-width 6



[elpa] externals/pyim 77d690bcfb 1/2: 使用 hook 而不是 advice 来处理 page 和 preview 相关功能。

2022-05-03 Thread ELPA Syncer
branch: externals/pyim
commit 77d690bcfbdf4a439c2e0f6b2ba8477530d44582
Author: Feng Shu 
Commit: Feng Shu 

使用 hook 而不是 advice 来处理 page 和 preview 相关功能。

* pyim.el (pyim-input-method): Use pyim-process-ui-init-hook.

* pyim-process.el (pyim-process-ui-init-hook)
(pyim-process-ui-refresh-hook, pyim-process-ui-hide-hook)
(pyim-process-ui-position-function): New variables.
(pyim-process-init-ui, pyim-process-ui-position)
(pyim-process-preview-refresh, pyim-process-page-refresh)
(pyim-process-preview-hide, pyim-process-page-hide): Removed.
(pyim-process-terminate, pyim-process-run-async)
(pyim-process-run-1): Use new hooks.

* pyim-preview.el (pyim-process-ui-init-hook)
(pyim-process-ui-refresh-hook, pyim-process-ui-hide-hook)
(pyim-process-ui-position-function):

* pyim-page.el (pyim-page-refresh, pyim-process-ui-refresh-hook)
(pyim-process-ui-hide-hook):
---
 pyim-page.el|  6 +++---
 pyim-preview.el |  8 
 pyim-process.el | 38 +++---
 pyim.el |  2 +-
 4 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/pyim-page.el b/pyim-page.el
index a0bf325144..53e6836603 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -230,10 +230,10 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(null unread-post-input-method-events))
   (pyim-page-show
(pyim-page-info-format page-info tooltip)
-   (pyim-process-ui-position)
+   (funcall pyim-process-ui-position-function)
tooltip
 
-(advice-add 'pyim-process-page-refresh :after #'pyim-page-refresh)
+(add-hook 'pyim-process-ui-refresh-hook #'pyim-page-refresh)
 
 (defun pyim-page-next-page (arg)
   "Pyim page 翻页命令."
@@ -549,7 +549,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
   (setq-local cursor-type t))
 (setq pyim-page-last-minibuffer-string nil)
 
-(advice-add 'pyim-process-page-hide :after #'pyim-page-hide)
+(add-hook 'pyim-process-ui-hide-hook #'pyim-page-hide)
 
 ;; * Footer
 (provide 'pyim-page)
diff --git a/pyim-preview.el b/pyim-preview.el
index 7ec28d9606..f6ccf5b88d 100644
--- a/pyim-preview.el
+++ b/pyim-preview.el
@@ -57,7 +57,7 @@
   (if input-method-highlight-flag
   (overlay-put pyim-preview-overlay 'face 'pyim-preview-face)
 
-(advice-add 'pyim-process-init-ui :after #'pyim-preview-setup-overlay)
+(add-hook 'pyim-process-ui-init-hook #'pyim-preview-setup-overlay)
 
 (defun pyim-preview-delete-overlay ()
   "删除 pyim 光标处实时预览功能所需要的 overlay.
@@ -97,7 +97,7 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示
 (move-overlay pyim-preview-overlay
   (overlay-start pyim-preview-overlay) (point
 
-(advice-add 'pyim-process-preview-refresh :after #'pyim-preview-refresh)
+(add-hook 'pyim-process-ui-refresh-hook #'pyim-preview-refresh)
 
 (defun pyim-preview-delete-string ()
   "删除已经插入 buffer 的 preview 预览字符串。"
@@ -105,13 +105,13 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示
 (delete-region (overlay-start pyim-preview-overlay)
(overlay-end pyim-preview-overlay
 
-(advice-add 'pyim-process-preview-hide :after #'pyim-preview-delete-string)
+(add-hook 'pyim-process-ui-hide-hook #'pyim-preview-delete-string)
 
 (defun pyim-preview-start-point ()
   "Preview 字符串的开始位置。"
   (overlay-start pyim-preview-overlay))
 
-(advice-add 'pyim-process-ui-position :override #'pyim-preview-start-point)
+(setq pyim-process-ui-position-function #'pyim-preview-start-point)
 
 ;; * Footer
 (provide 'pyim-preview)
diff --git a/pyim-process.el b/pyim-process.el
index 1fce8061fe..d1c8f47905 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -116,6 +116,18 @@ entered (nihaom) 的第一个候选词。
 
 (defvar pyim-process-run-exhibit-timer nil)
 
+(defvar pyim-process-ui-init-hook nil
+  "Hook used to run ui init functions.")
+
+(defvar pyim-process-ui-refresh-hook nil
+  "Hook used to run ui refresh functions.")
+
+(defvar pyim-process-ui-hide-hook nil
+  "Hook used to run ui hide functions.")
+
+(defvar pyim-process-ui-position-function #'point
+  "The value is a function returned a position where ui place.")
+
 (pyim-register-local-variables
  '(pyim-process-input-ascii
pyim-process-translating))
@@ -134,12 +146,6 @@ entered (nihaom) 的第一个候选词。
 (defun pyim-process-update-personal-words ()
   (pyim-dcache-call-api 'update-personal-words t))
 
-(defun pyim-process-init-ui ()
-  "PYIM 流程,用户界面相关的初始化工作。")
-
-(defun pyim-process-ui-position ()
-  "用户界面定位点获取函数接口.")
-
 (defun pyim-process-start-daemon ()
   "启动 pyim 流程需要的相关 daemon, 接口函数.")
 
@@ -322,14 +328,7 @@ entered (nihaom) 的第一个候选词。
  (pyim-entered-get 'point-after))
 (pyim-process-terminate))
(t (setq pyim-candidate-position 1)
-  (pyim-process-preview-refresh)
-  (pyim-process-page-refresh))
-
-(defun pyim-process-preview-refresh ()
-  "Preview refre

[elpa] externals/pyim updated (c779960884 -> 90a5e443e9)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  c779960884 iword2count-recent* -> iword2count-recent-*-items
   new  77d690bcfb 使用 hook 而不是 advice 来处理 page 和 preview 相关功能。
   new  90a5e443e9 Fix previous commit.


Summary of changes:
 pyim-page.el| 12 +---
 pyim-preview.el | 10 +-
 pyim-process.el | 38 +++---
 pyim.el |  2 +-
 4 files changed, 26 insertions(+), 36 deletions(-)



[elpa] externals/pyim 90a5e443e9 2/2: Fix previous commit.

2022-05-03 Thread ELPA Syncer
branch: externals/pyim
commit 90a5e443e9663731017e958c063633f8003a60e2
Author: Feng Shu 
Commit: Feng Shu 

Fix previous commit.
---
 pyim-page.el| 6 ++
 pyim-preview.el | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/pyim-page.el b/pyim-page.el
index 53e6836603..db239d4c6c 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -250,8 +250,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
 (if (> new 0)
 (if (> new maxpos) 1 new)
   maxpos)))
-  (pyim-process-preview-refresh)
-  (pyim-page-refresh
+  (run-hooks 'pyim-process-ui-refresh-hook
 
 (defun pyim-page-previous-page (arg)
   (interactive "p")
@@ -269,8 +268,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(if (>= len new)
(if (> new 0) new len)
  1))
-  (pyim-process-preview-refresh)
-  (pyim-page-refresh t
+  (run-hook-with-args 'pyim-process-ui-refresh-hook 'hightlight-current
 
 (defun pyim-page-previous-word (arg)
   (interactive "p")
diff --git a/pyim-preview.el b/pyim-preview.el
index f6ccf5b88d..b5bec800a0 100644
--- a/pyim-preview.el
+++ b/pyim-preview.el
@@ -67,7 +67,7 @@
   (if (and (overlayp pyim-preview-overlay) (overlay-start 
pyim-preview-overlay))
   (delete-overlay pyim-preview-overlay)))
 
-(defun pyim-preview-refresh ()
+(defun pyim-preview-refresh (&rest _)
   "刷新光标处预览.
 
 pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示一



[elpa] externals/eglot f8556b7e76: Fix #941: Ensure exit-function of eglot-c-at-point runs on exact match

2022-05-03 Thread ELPA Syncer
branch: externals/eglot
commit f8556b7e76ef7086191c469979274e499d992aed
Author: rbrtb <104695105+rb...@users.noreply.github.com>
Commit: GitHub 

Fix #941: Ensure exit-function of eglot-c-at-point runs on exact match

When the completion is exact match, exit-function should still run.

Say one is using auto-imports feature of pyright.  One types foo, and
triggers the completion.  There are two candidates: foo and foo_bar.  If
one chooses foo, the status would be 'exact' instead of 'finished', thus
exit-function is not executed, foo is not auto-imported.

* eglot.el (eglot-completion-at-point): Consider 'exact status.

Copyright-paperwork-exempt: Yes
---
 eglot.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 3d1b19c905..81c545e64f 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2649,7 +2649,7 @@ for which LSP on-type-formatting should be requested."
 (line-beginning-position
:exit-function
(lambda (proxy status)
- (when (eq status 'finished)
+ (when (memq status '(finished exact))
;; To assist in using this whole `completion-at-point'
;; function inside `completion-in-region', ensure the exit
;; function runs in the buffer where the completion was



[nongnu] elpa/evil 37699af1c7: Fix typo in test tags (#1439)

2022-05-03 Thread ELPA Syncer
branch: elpa/evil
commit 37699af1c76e18b4d4b1e16422779a86c6f40628
Author: rolag <10981866+ro...@users.noreply.github.com>
Commit: GitHub 

Fix typo in test tags (#1439)

Co-authored-by: rolag 



[elpa] externals/sql-cassandra f0daf06e19: Require emacs 29. Bump version.

2022-05-03 Thread Filipp Gunbin
branch: externals/sql-cassandra
commit f0daf06e1933cf207449538adc455412998acd02
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

Require emacs 29.  Bump version.
---
 sql-cassandra.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sql-cassandra.el b/sql-cassandra.el
index c569829067..d4aa1a0f48 100644
--- a/sql-cassandra.el
+++ b/sql-cassandra.el
@@ -4,7 +4,8 @@
 
 ;; Author: Filipp Gunbin 
 ;; Maintainer: Filipp Gunbin 
-;; Version: 0.1
+;; Package-Requires: ((emacs "29"))
+;; Version: 0.2
 ;; Keywords: sql, cassandra, cql, cqlsh
 
 ;; This program is free software; you can redistribute it and/or modify



[nongnu] elpa/git-commit 5bcb8c7d97: Fix documentation typos

2022-05-03 Thread ELPA Syncer
branch: elpa/git-commit
commit 5bcb8c7d9752724e6ed7f57fb14d47aaa52077f0
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

Fix documentation typos
---
 docs/magit.org | 2 +-
 docs/magit.texi| 2 +-
 lisp/magit-base.el | 2 +-
 lisp/magit-log.el  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/magit.org b/docs/magit.org
index b5f489903b..3c659f7f3e 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -5884,7 +5884,7 @@ shown in different colors to indicate the status of the 
commits.
 
 The following colors are used:
 
-- Commits that use the same forground color as the ~default~ face have
+- Commits that use the same foreground color as the ~default~ face have
   not been applied yet.
 
 - Yellow commits have some special relationship to the commit rebase
diff --git a/docs/magit.texi b/docs/magit.texi
index 779e02d88e..ba584e61da 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -7239,7 +7239,7 @@ The following colors are used:
 
 @itemize
 @item
-Commits that use the same forground color as the @code{default} face have
+Commits that use the same foreground color as the @code{default} face have
 not been applied yet.
 
 @item
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index 289982ddd2..cb9ad67309 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -674,7 +674,7 @@ third-party completion frameworks."
  (advice-member-p 'consult-completing-read-multiple
   'completing-read-multiple))
 ;; Our NO-SPLIT hack is not compatible with `CONSULT's
-;; implemenation so fall back to the original function.
+;; implementation so fall back to the original function.
 ;; #4437
 (unwind-protect
 (progn
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 4328a56b8a..47c3fb6baf 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -1775,7 +1775,7 @@ keymap is the parent of their keymaps.")
 
 (cl-defmethod magit-section-ident-value ((section magit-unpulled-section))
   "\"..@{push}\" cannot be used as the value because that is
-ambigious if `push.default' does not allow a 1:1 mapping, and
+ambiguous if `push.default' does not allow a 1:1 mapping, and
 many commands would fail because of that.  But here that does
 not matter and we need an unique value so we use that string
 in the pushremote case."
@@ -1820,7 +1820,7 @@ in the pushremote case."
 
 (cl-defmethod magit-section-ident-value ((section magit-unpushed-section))
   "\"..@{push}\" cannot be used as the value because that is
-ambigious if `push.default' does not allow a 1:1 mapping, and
+ambiguous if `push.default' does not allow a 1:1 mapping, and
 many commands would fail because of that.  But here that does
 not matter and we need an unique value so we use that string
 in the pushremote case."



[nongnu] elpa/magit updated (547ad9e393 -> 5bcb8c7d97)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/magit.

  from  547ad9e393 Fix a single typo
  adds  5bcb8c7d97 Fix documentation typos

No new revisions were added by this update.

Summary of changes:
 docs/magit.org | 2 +-
 docs/magit.texi| 2 +-
 lisp/magit-base.el | 2 +-
 lisp/magit-log.el  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)



[nongnu] elpa/magit-section updated (547ad9e393 -> 5bcb8c7d97)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/magit-section.

  from  547ad9e393 Fix a single typo
  adds  5bcb8c7d97 Fix documentation typos

No new revisions were added by this update.

Summary of changes:
 docs/magit.org | 2 +-
 docs/magit.texi| 2 +-
 lisp/magit-base.el | 2 +-
 lisp/magit-log.el  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)



[nongnu] elpa/with-editor 3bd620d464 1/2: make: Remove dash from DEPS

2022-05-03 Thread ELPA Syncer
branch: elpa/with-editor
commit 3bd620d464f756c7267094660a1373bc48d2b42f
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

make: Remove dash from DEPS

The dependency on `dash' has already been dropped earlier.
---
 default.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/default.mk b/default.mk
index ded66c899b..4e2755e6ce 100644
--- a/default.mk
+++ b/default.mk
@@ -6,7 +6,6 @@ ELS   = $(PKG).el
 ELCS  = $(ELS:.el=.elc)
 
 DEPS  = compat
-DEPS += dash
 
 DOMAIN  ?= magit.vc
 CFRONT_DIST ?= E2LUHBKU1FBV02



[nongnu] elpa/with-editor 48996e3116 2/2: Don't load any optional dependencies at compile-time only

2022-05-03 Thread ELPA Syncer
branch: elpa/with-editor
commit 48996e3116dadee06c8c68b1a0fe6ad8fd5317e0
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

Don't load any optional dependencies at compile-time only

Instead rely on `declare-function' and variable declarations.

Closes #112.
---
 default.mk  |  1 +
 lisp/with-editor.el | 20 
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/default.mk b/default.mk
index 4e2755e6ce..f152f45afd 100644
--- a/default.mk
+++ b/default.mk
@@ -6,6 +6,7 @@ ELS   = $(PKG).el
 ELCS  = $(ELS:.el=.elc)
 
 DEPS  = compat
+DEPS += vterm
 
 DOMAIN  ?= magit.vc
 CFRONT_DIST ?= E2LUHBKU1FBV02
diff --git a/lisp/with-editor.el b/lisp/with-editor.el
index 716c47475d..dd65d00aee 100644
--- a/lisp/with-editor.el
+++ b/lisp/with-editor.el
@@ -83,21 +83,16 @@
 (require 'shell)
 (eval-when-compile (require 'subr-x))
 
-(eval-when-compile
-  (progn (require 'dired nil t)
- (require 'eshell nil t)
- (require 'term nil t)
- (condition-case err
- (require 'vterm nil t)
-   (error (message "Error(vterm): %S" err)))
- (require 'warnings nil t)))
-(declare-function dired-get-filename 'dired)
-(declare-function term-emulate-terminal 'term)
-(declare-function vterm-send-return 'vterm)
-(declare-function vterm-send-string 'vterm)
+(declare-function dired-get-filename "dired"
+  (&optional localp no-error-if-not-filep))
+(declare-function term-emulate-terminal "term" (proc str))
+(declare-function vterm-send-return "vterm" ())
+(declare-function vterm-send-string "vterm" (string &optional paste-p))
 (defvar eshell-preoutput-filter-functions)
 (defvar git-commit-post-finish-hook)
 (defvar vterm--process)
+(defvar warning-minimum-level)
+(defvar warning-minimum-log-level)
 
 ;;; Options
 
@@ -884,6 +879,7 @@ else like the former."
   "Debug configuration issues.
 See info node `(with-editor)Debugging' for instructions."
   (interactive)
+  (require 'warnings)
   (with-current-buffer (get-buffer-create "*with-editor-debug*")
 (pop-to-buffer (current-buffer))
 (erase-buffer)



[nongnu] elpa/with-editor updated (54d1e816ac -> 48996e3116)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/with-editor.

  from  54d1e816ac make: Improve creation of autoloads file
   new  3bd620d464 make: Remove dash from DEPS
   new  48996e3116 Don't load any optional dependencies at compile-time only


Summary of changes:
 default.mk  |  2 +-
 lisp/with-editor.el | 20 
 2 files changed, 9 insertions(+), 13 deletions(-)



[nongnu] elpa/git-commit updated (5bcb8c7d97 -> 476383fc8f)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/git-commit.

  from  5bcb8c7d97 Fix documentation typos
   new  cbb6185d44 magit-diff-wash-signature: Unset marker
   new  2676dddb84 magit-revision-refresh-buffer: Use hash of commit not tag
   new  476383fc8f magit-insert-revision-tag: Use sections for message and 
signature


Summary of changes:
 lisp/magit-diff.el | 29 ++---
 1 file changed, 22 insertions(+), 7 deletions(-)



[nongnu] elpa/git-commit cbb6185d44 1/3: magit-diff-wash-signature: Unset marker

2022-05-03 Thread ELPA Syncer
branch: elpa/git-commit
commit cbb6185d44c995559e371fc7e7d4b15f65451c19
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

magit-diff-wash-signature: Unset marker
---
 lisp/magit-diff.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index b51aa32477..ca82232de2 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2161,6 +2161,7 @@ section or a child thereof."
 (when title
   (magit-insert-heading title))
 (goto-char end)
+(set-marker end nil)
 (insert "\n")
 
 (defun magit-diff-wash-diffstat ()



[nongnu] elpa/git-commit 476383fc8f 3/3: magit-insert-revision-tag: Use sections for message and signature

2022-05-03 Thread ELPA Syncer
branch: elpa/git-commit
commit 476383fc8fb0f6ea4c6fc29d7057a1b5b5f95bd8
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

magit-insert-revision-tag: Use sections for message and signature
---
 lisp/magit-diff.el | 26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 03a4da6665..9e78b52923 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2118,7 +2118,7 @@ keymap is the parent of their keymaps.")
 (defun magit-diff-wash-diffs (args &optional limit)
   (run-hooks 'magit-diff-wash-diffs-hook)
   (when (member "--show-signature" args)
-(magit-diff-wash-signature))
+(magit-diff-wash-signature magit-buffer-revision-hash))
   (when (member "--stat" args)
 (magit-diff-wash-diffstat))
   (when (re-search-forward magit-diff-headline-re limit t)
@@ -2141,7 +2141,7 @@ section or a child thereof."
   (magit-section-goto it)
 (user-error "No diffstat in this buffer")))
 
-(defun magit-diff-wash-signature ()
+(defun magit-diff-wash-signature (object)
   (when (looking-at "^gpg: ")
 (let (title end)
   (save-excursion
@@ -2157,7 +2157,7 @@ section or a child thereof."
  'face '(italic bold)
   (forward-line))
 (setq end (point-marker)))
-  (magit-insert-section (signature magit-buffer-revision title)
+  (magit-insert-section (signature object title)
 (when title
   (magit-insert-heading title))
 (goto-char end)
@@ -2548,13 +2548,27 @@ or a ref which is not a branch, then it inserts 
nothing."
 (insert (propertize heading 'font-lock-face
 'magit-section-secondary-heading)))
   (magit-insert-heading)
+  (forward-line)
+  (magit-insert-section section (message)
+(oset section heading-highlight-face
+  'magit-diff-revision-summary-highlight)
+(let ((beg (point)))
+  (forward-line)
+  (magit--add-face-text-property
+   beg (point) 'magit-diff-revision-summary))
+(magit-insert-heading)
+(if (re-search-forward "-BEGIN PGP SIGNATURE-" nil t)
+(goto-char (match-beginning 0))
+  (goto-char (point-max)))
+(insert ?\n))
   (if (re-search-forward "-BEGIN PGP SIGNATURE-" nil t)
   (progn
 (let ((beg (match-beginning 0)))
-  (re-search-forward "-END PGP SIGNATURE-")
+  (re-search-forward "-END PGP SIGNATURE-\n")
   (delete-region beg (point)))
-(insert ?\n)
-(magit-process-git t "verify-tag" magit-buffer-revision))
+(save-excursion
+  (magit-process-git t "verify-tag" magit-buffer-revision))
+(magit-diff-wash-signature magit-buffer-revision))
 (goto-char (point-max)))
   (insert ?\n
 



[nongnu] elpa/git-commit 2676dddb84 2/3: magit-revision-refresh-buffer: Use hash of commit not tag

2022-05-03 Thread ELPA Syncer
branch: elpa/git-commit
commit 2676dddb84232b9813b8f3e0deb26207331e
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

magit-revision-refresh-buffer: Use hash of commit not tag

Use "git rev-parse ARG^{commit}" instead of just "... ARG", which
matters for tags (but not branches).  `magit-buffer-revision-hash'
is supposed to be a commit hash.
---
 lisp/magit-diff.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index ca82232de2..03a4da6665 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2497,7 +2497,7 @@ Staging and applying changes is documented in info node
 (magit-buffer-diff-files-suspended nil)))
 
 (defun magit-revision-refresh-buffer ()
-  (setq magit-buffer-revision-hash (magit-rev-parse magit-buffer-revision))
+  (setq magit-buffer-revision-hash (magit-rev-hash magit-buffer-revision))
   (magit-set-header-line-format
(concat (magit-object-type magit-buffer-revision-hash)
" "  magit-buffer-revision



[nongnu] elpa/magit updated (5bcb8c7d97 -> 476383fc8f)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/magit.

  from  5bcb8c7d97 Fix documentation typos
  adds  cbb6185d44 magit-diff-wash-signature: Unset marker
  adds  2676dddb84 magit-revision-refresh-buffer: Use hash of commit not tag
  adds  476383fc8f magit-insert-revision-tag: Use sections for message and 
signature

No new revisions were added by this update.

Summary of changes:
 lisp/magit-diff.el | 29 ++---
 1 file changed, 22 insertions(+), 7 deletions(-)



[nongnu] elpa/magit-section updated (5bcb8c7d97 -> 476383fc8f)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch elpa/magit-section.

  from  5bcb8c7d97 Fix documentation typos
  adds  cbb6185d44 magit-diff-wash-signature: Unset marker
  adds  2676dddb84 magit-revision-refresh-buffer: Use hash of commit not tag
  adds  476383fc8f magit-insert-revision-tag: Use sections for message and 
signature

No new revisions were added by this update.

Summary of changes:
 lisp/magit-diff.el | 29 ++---
 1 file changed, 22 insertions(+), 7 deletions(-)



[elpa] main 8794e45e74: * elpa-packages (tomelr): New package

2022-05-03 Thread Stefan Monnier via
branch: main
commit 8794e45e74486e768a7d8865719a333c395a6663
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages (tomelr): New package
---
 elpa-packages | 4 
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index 8c84ff41de..4336648387 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -606,6 +606,10 @@
   :auto-sync t
   :ignored-files ("COPYING" "doclicense.texi"))
  ("tNFA"   :url "http://www.dr-qubit.org/git/predictive.git";)
+ ("tomelr" :url "https://github.com/kaushalmodi/tomelr";
+  :ignored-files ("LICENSE")
+  :news "CHANGELOG.org"
+  :auto-sync t)
  ("tramp"  :url "git://git.sv.gnu.org/tramp.git"
   :branch "externals/tramp"
   :main-file "trampver.el"



[elpa] externals/tomelr 732140041e 07/84: doc: Discover `json-encoding-pretty-print` variable!

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 732140041e91528a7ee3c730ce10bac0931698c4
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Discover `json-encoding-pretty-print` variable!
---
 README.org | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index 6c0e0711e8..3db9373425 100644
--- a/README.org
+++ b/README.org
@@ -899,7 +899,7 @@ the name matches "scalar" completely or partially, run:
 #+begin_src shell
 make test MATCH=scalar
 #+end_src
-* Helper function
+* COMMENT Helper function
 ** JSON Reference pretty print string
 The ~json-encode-pretty~ function defined here is used to pretty-print
 the above JSON examples.
@@ -908,10 +908,9 @@ the above JSON examples.
 (defun json-encode-pretty (object)
   "Return prettified JSONified version of OBJECT."
   (with-temp-buffer
-(let ((json-false :false))
-  (insert (json-encode object))
-  (json-pretty-print-buffer)
-  (buffer-substring-no-properties (point-min) (point-max)
+(let ((json-false :false)
+  (json-encoding-pretty-print t))
+  (json-encode object
 #+end_src
 * Reference
 [[https://toml.io/en/v1.0.0/][TOML v1.0.0 Spec]]



[elpa] externals/tomelr d96a3b235b 04/84: doc: Add LOGBOOK drawer example

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit d96a3b235b9dc7181f8140cf23b75d28a853c941
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Add LOGBOOK drawer example
---
 README.org | 43 ++-
 1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 542a6b71d3..0d290b5e0f 100644
--- a/README.org
+++ b/README.org
@@ -324,40 +324,51 @@ contributors = [
   (varieties . name . "red delicious"))
  ((name . "granny smith"))
  ((name . "banana")
-  (varieties . (((name . "plantain"
+  (varieties . (((name . "plantain")))
+
+
+  (org_logbook . (((timestamp . 2022-04-08T14:53:00-04:00)
+   (note . "This note addition prompt shows up on typing the 
`C-c C-z` binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."))
+  ((timestamp . 2018-09-06T11:45:00-04:00)
+   (note . "Another note **bold** _italics_."))
+  ((timestamp . 2018-09-06T11:37:00-04:00)
+   (note . "A note `mono`.")
 #+end_src
 *** TOML
 #+begin_src toml
 [[products]]
   name = "Hammer"
   sku = 738594937
-
 [[products]]  # empty table within the array
-
 [[products]]
   name = "Nail"
   sku = 284758393
-
   color = "gray"
 
 [[fruits]]
   name = "apple"
-
   [fruits.physical]  # subtable
 color = "red"
 shape = "round"
-
   [[fruits.varieties]]  # nested array of tables
 name = "red delicious"
-
   [[fruits.varieties]]
 name = "granny smith"
-
 [[fruits]]
   name = "banana"
-
   [[fruits.varieties]]
 name = "plantain"
+
+[[org_logbook]]
+  timestamp = 2022-04-08T14:53:00-04:00
+  note = """This note addition prompt shows up on typing the `C-c C-z` binding.
+See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
+[[org_logbook]]
+  timestamp = 2018-09-06T11:45:00-04:00
+  note = """Another note **bold** _italics_."""
+[[org_logbook]]
+  timestamp = 2018-09-06T11:37:00-04:00
+  note = """A note `mono`."""
 #+end_src
 *** JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
@@ -406,6 +417,20 @@ contributors = [
 }
   ]
 }
+  ],
+  "org_logbook": [
+{
+  "timestamp": "2022-04-08T14:53:00-04:00",
+  "note": "This note addition prompt shows up on typing the `C-c C-z` 
binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."
+},
+{
+  "timestamp": "2018-09-06T11:45:00-04:00",
+  "note": "Another note **bold** _italics_."
+},
+{
+  "timestamp": "2018-09-06T11:37:00-04:00",
+  "note": "A note `mono`."
+}
   ]
 }
 #+end_example



[elpa] externals/tomelr 05d2cafcd9 09/84: test: Add test for boolean scalar key-value pairs

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 05d2cafcd989b977fa3e9d05e293e9f8bae22fc4
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add test for boolean scalar key-value pairs
---
 Makefile  | 13 +
 test/all-tests.el | 24 
 test/tscalar.el   | 42 ++
 3 files changed, 79 insertions(+)

diff --git a/Makefile b/Makefile
new file mode 100644
index 00..550b82562d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+# Makefile for tomelr.el
+
+EMACS ?= emacs
+
+TEST_DIR=$(shell pwd)/test
+
+# Run all tests by default.
+MATCH ?=
+
+.PHONY: test
+
+test:
+   $(EMACS) --batch -L . -L $(TEST_DIR) -l all-tests.el -eval 
'(ert-run-tests-batch-and-exit "$(MATCH)")'
diff --git a/test/all-tests.el b/test/all-tests.el
new file mode 100644
index 00..209d39f3be
--- /dev/null
+++ b/test/all-tests.el
@@ -0,0 +1,24 @@
+;;; all-tests.el --- Tests for tomelr.el   -*- 
lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Code:
+
+(setq load-prefer-newer t)
+
+(require 'tscalar)
diff --git a/test/tscalar.el b/test/tscalar.el
new file mode 100644
index 00..695dfcc4f0
--- /dev/null
+++ b/test/tscalar.el
@@ -0,0 +1,42 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Test conversion to scalar TOML objects.
+;; https://toml.io/en/v1.0.0#keys
+
+;;; Code:
+(require 'tomelr)
+
+ Scalar - Boolean
+(ert-deftest test-scalar-bool ()
+  (let ((inp '(((bool1 . t))
+   ((bool2 . :false))
+   ((bool3 . "false"
+(ref '("bool1 = true"
+   "bool2 = false"
+   "bool3 = false"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tscalar)



[elpa] externals/tomelr 2ea3b5e032 03/84: fix!: Set boolean false using :false value

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 2ea3b5e032629a3974e2733f849cf47259e80e0d
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix!: Set boolean false using :false value

This is so that null vs false can be distinguished in JSON.

If a lisp data value is nil, that key will be absent in TOML.
---
 README.org | 61 ++---
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/README.org b/README.org
index b95617f10f..542a6b71d3 100644
--- a/README.org
+++ b/README.org
@@ -106,7 +106,7 @@ https://toml.io/en/v1.0.0#boolean
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-boolean
 '((bool1 . t)
-  (bool2 . nil))
+  (bool2 . :false))
 #+end_src
  TOML
 #+begin_src toml
@@ -122,7 +122,7 @@ bool2 = false
 #+RESULTS:
 : {
 :   "bool1": true,
-:   "bool2": null
+:   "bool2": false
 : }
 *** Date + Time with Offset
 https://toml.io/en/v1.0.0#offset-date-time
@@ -422,7 +422,7 @@ contributors = [
   (tags . ("mega front-matter" "keys" "collection" "concatenation" "merging"))
   (categories . ("cat1" "cat2"))
   (videos . ("video 1" "video 2"))
-  (draft . nil)
+  (draft . :false)
   (categories_weight . 999)
   (tags_weight . 88)
   (weight . 7)
@@ -435,19 +435,19 @@ contributors = [
   (strings-symbols . ("abc" "def" "two words"))
   (integers . (123 -5 17 1234))
   (floats . (12.3 -5.0 -1.7e-05))
-  (booleans . (t nil))
+  (booleans . (t :false))
   (dog . ((legs . 4)
   (eyes . 2)
   (friends . ("poo" "boo"
   (header . ((image . "projects/Readingabook.jpg")
  (caption . "stay hungry stay foolish")))
-  (collection . ((nothing . nil)
+  (collection . ((nothing . :false)
  (nonnil . t)
  (animals . ("dog" "cat" "penguin" "mountain gorilla"))
  (strings-symbols . ("abc" "def" "two words"))
  (integers . (123 -5 17 1234))
  (floats . (12.3 -5.0 -1.7e-05))
- (booleans . (t nil
+ (booleans . (t :false
   (menu . ((foo . ((identifier . "keyword-collection")
(weight . 10)
   (resources . (((src . "*.png")
@@ -458,7 +458,7 @@ contributors = [
 (strings-symbols . ("abc" "def" "two words"))
 (animals . ("dog" "cat" "penguin" "mountain 
gorilla"))
 (integers . (123 -5 17 1234))
-(booleans . (t nil))
+(booleans . (t :false))
 (byline . "bep"
 ((src . "image-4.png")
  (title . "The Fourth Image"))
@@ -579,7 +579,7 @@ booleans = [true, false]
 "video 1",
 "video 2"
   ],
-  "draft": null,
+  "draft": false,
   "categories_weight": 999,
   "tags_weight": 88,
   "weight": 7,
@@ -612,7 +612,7 @@ booleans = [true, false]
   ],
   "booleans": [
 true,
-null
+false
   ],
   "dog": {
 "legs": 4,
@@ -627,7 +627,7 @@ booleans = [true, false]
 "caption": "stay hungry stay foolish"
   },
   "collection": {
-"nothing": null,
+"nothing": false,
 "nonnil": true,
 "animals": [
   "dog",
@@ -653,7 +653,7 @@ booleans = [true, false]
 ],
 "booleans": [
   true,
-  null
+  false
 ]
   },
   "menu": {
@@ -693,7 +693,7 @@ booleans = [true, false]
 ],
 "booleans": [
   true,
-  null
+  false
 ],
 "byline": "bep"
   }
@@ -709,6 +709,36 @@ booleans = [true, false]
   ]
 }
 #+end_example
+** Nil
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref nil-value
+'((key1 . 123)
+  (key2 . nil)
+  (key3 . "abc")
+  (key4 . :false)
+  (key5 . t))
+#+end_src
+ TOML
+#+begin_src toml
+key1 = 123
+key3 = "abc"
+key4 = false
+key5 = true
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+: {
+:   "key1": 123,
+:   "key2": null,
+:   "key3": "abc",
+:   "key4": false,
+:   "key5": true
+: }
 * COMMENT Development
 ** Running Tests
 *** Run all tests
@@ -731,9 +761,10 @@ the above JSON examples.
 (defun json-encode-pretty (object)
   "Return prettified JSONified version of OBJECT."
   (with-temp-buffer
-(insert (json-encode object))
-(json-pretty-print-buffer)
-(buffer-substring-no-properties (point-min) (point-max
+(let ((json-false :false))
+  (insert (json-encode object))
+  (json-pretty-print-buffer)
+  (buffer-substring-no-properties (point-min) (point-max)
 #+end_src
 * Reference
 [[https://toml.io/en/v1.0.0/][TOML v1.0.0 Spec]]



[elpa] externals/tomelr 96c890a68b 23/84: feat: Convert Lisp lists to TOML arrays

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 96c890a68b9a587283bc7522c3893370cc522ca6
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Convert Lisp lists to TOML arrays
---
 README.org   | 34 --
 test/all-tests.el|  1 +
 test/{all-tests.el => tarray.el} | 28 +++-
 tomelr.el| 17 -
 4 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/README.org b/README.org
index c21b8a72e9..948d37fdaa 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [2/7]
+* Library Completion Status [3/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -27,7 +27,7 @@ specification defined below.
   - [X] Date
   - [X] Date + Time with Offset
 - [X] Nil
-- [ ] Arrays
+- [X] Arrays
 - [ ] Array of Arrays
 - [ ] Tables
 - [ ] Array of Tables
@@ -280,29 +280,33 @@ key5 = true
 : }
 ** TOML Arrays: Lists
 https://toml.io/en/v1.0.0#array
-*** Lists
+*** DONE Plain Arrays
+CLOSED: [2022-04-29 Fri 00:25]
  S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref lists
+#+begin_src emacs-lisp :eval no :noweb-ref arrays
 '((integers . (1 2 3))
   (integers2 . [1 2 3]) ;Same as above
   (colors . ("red" "yellow" "green"))
-  (string_array . ("all" "strings" "are the same" "type"))
+  ;; Mixed-type arrays are allowed
   (numbers . (0.1 0.2 0.5 1 2 5)))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 integers = [ 1, 2, 3 ]
 integers2 = [ 1, 2, 3 ]
 colors = [ "red", "yellow", "green" ]
-string_array = [ "all", 'strings', """are the same""", '''type''' ]
-
-# Mixed-type arrays are allowed
 numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
-  <>)
+  <>)
 #+end_src
 
 #+RESULTS:
@@ -323,12 +327,6 @@ numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
 "yellow",
 "green"
   ],
-  "string_array": [
-"all",
-"strings",
-"are the same",
-"type"
-  ],
   "numbers": [
 0.1,
 0.2,
@@ -339,9 +337,9 @@ numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
   ]
 }
 #+end_example
-*** Lists of lists
+*** Array of Arrays
  S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref lists-of-lists
+#+begin_src emacs-lisp :eval no :noweb-ref array-of-arrays
 '((nested_arrays_of_ints . [(1 2) (3 4 5)])
   (nested_mixed_array . [(1 2) ("a" "b" "c")])
   (contributors . ("Foo Bar "
@@ -363,7 +361,7 @@ contributors = [
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
-  <>)
+  <>)
 #+end_src
 
 #+RESULTS:
diff --git a/test/all-tests.el b/test/all-tests.el
index 5b1013864c..f89407594b 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -23,3 +23,4 @@
 
 (require 'tscalar)
 (require 'tnil)
+(require 'tarray)
diff --git a/test/all-tests.el b/test/tarray.el
similarity index 51%
copy from test/all-tests.el
copy to test/tarray.el
index 5b1013864c..1c92e55c8c 100644
--- a/test/all-tests.el
+++ b/test/tarray.el
@@ -1,4 +1,4 @@
-;;; all-tests.el --- Tests for tomelr.el   -*- 
lexical-binding: t; -*-
+;; -*- lexical-binding: t; -*-
 
 ;; Authors: Kaushal Modi 
 
@@ -17,9 +17,27 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
-;;; Code:
+;;; Commentary:
 
-(setq load-prefer-newer t)
+;; Test conversion to TOML arrays.
 
-(require 'tscalar)
-(require 'tnil)
+;;; Code:
+(require 'tomelr)
+
+ Key with array value
+(ert-deftest test-array ()
+  (let ((inp '(((integers . (1 2 3)))
+   ((integers2 . [1 2 3]));Same as above
+   ((colors . ("red" "yellow" "green")))
+   ((numbers . (0.1 0.2 0.5 1 2 5) ;Mixed-type arrays are 
allowed
+(ref '("integers = [ 1, 2, 3 ]"
+   "integers2 = [ 1, 2, 3 ]"
+   "colors = [ \"red\", \"yellow\", \"green\" ]"
+   "numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tarray)
diff --git a/tomelr.el b/tomelr.el
index cd7ff6b901..8952f920a9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -37,11 +37,6 @@
   "String used for a single indentation level during encoding.
 This value is repeated for each further nested element.")
 
-(defvar tomelr-encoding-lisp-style-closings nil
-  "If non-nil, delimiters ] and } will be formatted Lisp-style.
-This means they will be placed on the same line as the last
-element of the respective array or object, without indentation.")
-
 (defvar tomelr-encoding-object-sort-predicate nil
   "Sorting pred

[elpa] branch externals/tomelr created (now a1fa47379e)

2022-05-03 Thread ELPA Syncer
elpasync pushed a change to branch externals/tomelr.

at  a1fa47379e chore: Add CHANGELOG generated using git cliff tool

This branch includes the following new commits:

   new  61397410af Initial empty commit
   new  8bc506af5a Add s-exp->toml examples and spec
   new  2ea3b5e032 fix!: Set boolean false using :false value
   new  d96a3b235b doc: Add LOGBOOK drawer example
   new  28642f2e78 fix: dates will be strings in Lisp
   new  846676a172 feat: Add plist example
   new  732140041e doc: Discover `json-encoding-pretty-print` variable!
   new  52dc93201d feat: First cut -- Port json-encode from json.el to 
tomelr-encode
   new  05d2cafcd9 test: Add test for boolean scalar key-value pairs
   new  7cd15e79b8 tool(ci): Add GHA setup
   new  af40c0b40f fix: Require subr-x for older Emacs versions
   new  20bf9e6c54 chore(doc): Add GHA and license badges
   new  83e924559e chore(doc): Fix typo
   new  67cf7d chore(readme): Update
   new  8da825067b chore(readme): Update
   new  060c38b934 chore(readme): Limit up to 3 levels of headings for Org 
exports
   new  c872e9efc1 test: Add test for integer scalar key-value pairs
   new  9c91e0dc07 test: Add test for float scalar key-value pairs
   new  7d8d41f15b feat: Encode to multi-line TOML string automatically
   new  1d65064ffa feat: Recognize local date format -MM-DD
   new  91800b26b8 feat: Recognize RFC 3339 formatted date-time + offset
   new  69217d47a6 feat: Skip converting keys whose values are nil
   new  96c890a68b feat: Convert Lisp lists to TOML arrays
   new  0ba5f2ff69 chore(readme): Move mixed type array example to the 
'medley' example
   new  f37841cc78 test: Add test for TOML Array of Arrays
   new  98c9b8c1fc fix: Use `=` and `length` separately instead of `length=`
   new  bb85106ee9 doc: Add spec for nested tables and arrays of tables
   new  6bbe740e52 test: Test that 'false is also considered as boolean 
false in TOML
   new  cedb75df72 feat: Support basic TOML tables
   new  65653d53ee chore(doc): M-x checkdoc fixes
   new  a1f434f03a feat: Support nested TOML tables
   new  2810504e84 feat: Add basic support for S-exp plists -> TOML 
conversion
   new  c0962ba15f fix: Don't run plist to TOML conversion test on emacs 
26.3 and older
   new  3c068fb9d9 refactor: Move TOML Table detection logic to a separate 
fn
   new  ca9245038a fix: Attempt to make tomelr--toml-table-p more robust
   new  ad8366d904 feat: Support basic TOML Table Arrays
   new  4c419bcee2 fix: Support TOML tables specified as plists
   new  cff1f8aa89 fix: Support TOML tables arrays specified as plist vector
   new  bcaea16ec0 chore(doc): Clean up old code block
   new  55fefb0fa8 doc: Add few links
   new  38160ef271 fix: Stricter condition before starting TOML table array 
check
   new  0d4674f782 test: Test `tomelr--toml-table-p`
   new  0eb4fa04ac fix: Don't let array of TOML tables be recognized as 
TOML tables
   new  5959b90ffa fix: Don't let TOML tables be recognized as TOML tables 
arrays
   new  baf81228bc fix: Correct the spec for nested array of tables
   new  4dda8e6be3 chore: Style edits in a test
   new  0f4e7b4f2c fix: Better detection of nested TTA, but still wip
   new  a7b3a57037 feat: Make a very basic nested array of TTA work
   new  b64eb07e99 fix: Detect TT with sub-tables correctly
   new  a33dbd1286 fix: Detect nested TTA correctly when not present in 
first TT key
   new  10a1994aed feat: Support (lightly tested) nested TOML Table Arrays
   new  e2b313ca3b feat: Implement everything planned in the initial spec
   new  f3b6951cfe doc: Add note that the scalars need to be earlier in the 
order
   new  3aa4dc1dbd chore: Add Package-Requires and other info in the header 
comment
   new  26f1fc2f3c doc: Update the medley example
   new  f9d670e165 refactor: Clean up unused code
   new  192cb06a23 chore(style): Whitespace change only
   new  406f4922a8 test: Add tests for json.el functions used in tomelr
   new  df0e73334f Revert "doc: Update the medley example"
   new  dc9b2a63f8 doc: Remove an invalid example
   new  044b5e1a04 fix: TT with key with array value are detected correctly
   new  171e5a7682 fix: List format array of plists now detected as TOML 
Table Array
   new  d86fd721ce fix: Compatibility for emacs 26.3
   new  41ccea4ebe refactor: Remove unnecessary tomelr-encode-keyword
   new  4386d99a85 refactor(minor): Use `tomelr--toml-table-p`
   new  7c004af90d style: Remove unnecessary tomelr-encode-* functions
   new  45542fb234 chore: Bump version
   new  b3b6a28d15 doc: Add more examples
   new  6d2be83669 chore: package-lint fixes
   new  4434ccc64b chore: Bump version
   new  511240765b chore: Ignore .elc files
   new  de661716af style:

[elpa] externals/tomelr 846676a172 06/84: feat: Add plist example

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 846676a172d2bdd39e1e8b5628a7e88a3605f68b
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Add plist example
---
 README.org | 100 +
 1 file changed, 100 insertions(+)

diff --git a/README.org b/README.org
index 349d2ca75a..6c0e0711e8 100644
--- a/README.org
+++ b/README.org
@@ -786,6 +786,106 @@ key5 = true
 :   "key4": false,
 :   "key5": true
 : }
+** P-lists
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref p-list
+'(:int 123
+  :remove_this_key  nil
+  :str "abc"
+  :bool_false :false
+  :bool_true t
+  :int_list (1 2 3)
+  :str_list ("a" "b" "c")
+  :bool_list (t :false t :false)
+  :list_of_lists [(1 2) (3 4 5)]
+  :map (:key1 123
+:key2 "xyz")
+  :list_of_maps [(:key1 123
+  :key2 "xyz")
+ (:key1 567
+  :key2 "klm")])
+#+end_src
+ TOML
+#+begin_src toml
+int = 123.0
+str = "abc"
+bool_false = false
+bool_true = true
+int_list = [1.0, 2.0, 3.0]
+str_list = ["a", "b", "c"]
+bool_list = [true, false, true, false]
+list_of_lists = [ [1.0, 2.0],
+  [3.0, 4.0, 5.0] ]
+
+[map]
+  key1 = 123.0
+  key2 = "xyz"
+
+[[list_of_maps]]
+  key1 = 123.0
+  key2 = "xyz"
+[[list_of_maps]]
+  key1 = 567.0
+  key2 = "klm"
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_example
+{
+  "int": 123,
+  "remove_this_key": null,
+  "str": "abc",
+  "bool_false": false,
+  "bool_true": true,
+  "int_list": [
+1,
+2,
+3
+  ],
+  "str_list": [
+"a",
+"b",
+"c"
+  ],
+  "bool_list": [
+true,
+false,
+true,
+false
+  ],
+  "list_of_lists": [
+[
+  1,
+  2
+],
+[
+  3,
+  4,
+  5
+]
+  ],
+  "map": {
+"key1": 123,
+"key2": "xyz"
+  },
+  "list_of_maps": [
+{
+  "key1": 123,
+  "key2": "xyz"
+},
+{
+  "key1": 567,
+  "key2": "klm"
+}
+  ]
+}
+#+end_example
+
 * COMMENT Development
 ** Running Tests
 *** Run all tests



[elpa] externals/tomelr bb85106ee9 27/84: doc: Add spec for nested tables and arrays of tables

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit bb85106ee98c1ee04100db9d298510b3f57e0751
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Add spec for nested tables and arrays of tables
---
 README.org | 148 +++--
 1 file changed, 104 insertions(+), 44 deletions(-)

diff --git a/README.org b/README.org
index 607ad24589..ba51f2e6b2 100644
--- a/README.org
+++ b/README.org
@@ -30,7 +30,11 @@ specification defined below.
 - [X] Arrays
 - [X] Array of Arrays
 - [ ] Tables
+  - [ ] Basic Tables
+  - [ ] Nested Tables
 - [ ] Array of Tables
+  - [ ] Basic Array of Tables
+  - [ ] Nested Array of Tables
 - [ ] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
@@ -389,14 +393,15 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
 }
 #+end_example
 ** TOML Tables: Maps or Dictionaries or Hash Tables
-*** S-expression
+*** Basic TOML Tables
+ S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref tables
 '((table-1 . ((key1 . "some string")
   (key2 . 123)))
   (table-2 . ((key1 . "another string")
   (key2 . 456
 #+end_src
-*** TOML
+ TOML
 #+begin_src toml
 [table-1]
   key1 = "some string"
@@ -406,7 +411,7 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
   key1 = "another string"
   key2 = 456
 #+end_src
-*** JSON Reference
+ JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
   <>)
@@ -425,8 +430,48 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
   }
 }
 #+end_example
+*** Nested TOML Tables
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref nested-tables
+'((table-1 . ((table-1a . ((key1 . "some string")
+   (key2 . 123)))
+  (table-1b . ((key1 . "foo")
+   (key2 . 98765))
+#+end_src
+ TOML
+#+begin_src toml
+[table-1]
+  [table-1.table-1a]
+key1 = "some string"
+key2 = 123
+  [table-1.table-1b]
+key1 = "foo"
+key2 = 98765
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_example
+{
+  "table-1": {
+"table-1a": {
+  "key1": "some string",
+  "key2": 123
+},
+"table-1b": {
+  "key1": "foo",
+  "key2": 98765
+}
+  }
+}
+#+end_example
 ** TOML Array of Tables: Lists of Maps
-*** S-expression
+*** Basic Array of Tables
+ S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref table-arrays
 '((products . (((name . "Hammer")
 (sku . 738594937))
@@ -434,16 +479,6 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
((name . "Nail")
 (sku . 284758393)
 (color . "gray"
-
-  (fruits . (((name . "apple")
-  (physical . ((color . "red")
-   (shape . "round")))
-  (varieties . name . "red delicious"))
- ((name . "granny smith"))
- ((name . "banana")
-  (varieties . (((name . "plantain")))
-
-
   (org_logbook . (((timestamp . 2022-04-08T14:53:00-04:00)
(note . "This note addition prompt shows up on typing the 
`C-c C-z` binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."))
   ((timestamp . 2018-09-06T11:45:00-04:00)
@@ -451,7 +486,7 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
   ((timestamp . 2018-09-06T11:37:00-04:00)
(note . "A note `mono`.")
 #+end_src
-*** TOML
+ TOML
 #+begin_src toml
 [[products]]
   name = "Hammer"
@@ -462,20 +497,6 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
   sku = 284758393
   color = "gray"
 
-[[fruits]]
-  name = "apple"
-  [fruits.physical]  # subtable
-color = "red"
-shape = "round"
-  [[fruits.varieties]]  # nested array of tables
-name = "red delicious"
-  [[fruits.varieties]]
-name = "granny smith"
-[[fruits]]
-  name = "banana"
-  [[fruits.varieties]]
-name = "plantain"
-
 [[org_logbook]]
   timestamp = 2022-04-08T14:53:00-04:00
   note = """This note addition prompt shows up on typing the `C-c C-z` binding.
@@ -487,7 +508,7 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   timestamp = 2018-09-06T11:37:00-04:00
   note = """A note `mono`."""
 #+end_src
-*** JSON Reference
+ JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
   <>)
@@ -508,6 +529,58 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   "color": "gray"
 }
   ],
+  "org_logbook": [
+{
+  "timestamp": "2022-04-08T14:53:00-04:00",
+  "note": "This note addition prompt shows up on typing the `C-c C-z` 
binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."
+},
+   

[elpa] externals/tomelr 69217d47a6 22/84: feat: Skip converting keys whose values are nil

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 69217d47a65cb987d7d1ce32d3db5566a169ceca
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Skip converting keys whose values are nil
---
 README.org | 71 +++---
 test/all-tests.el  |  1 +
 test/{all-tests.el => tnil.el} | 32 ---
 tomelr.el  | 11 ---
 4 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/README.org b/README.org
index 5f1db7d305..c21b8a72e9 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [1/7]
+* Library Completion Status [2/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -26,7 +26,7 @@ specification defined below.
   - [X] String
   - [X] Date
   - [X] Date + Time with Offset
-- [ ] Nil
+- [X] Nil
 - [ ] Arrays
 - [ ] Array of Arrays
 - [ ] Tables
@@ -241,6 +241,43 @@ odt3 = 1979-05-27T00:32:00.99-07:00
 :   "odt2": "1979-05-27T00:32:00-07:00",
 :   "odt3": "1979-05-27T00:32:00.99-07:00"
 : }
+** DONE Nil
+CLOSED: [2022-04-29 Fri 00:11]
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref nil-value
+'((key1 . 123)
+  (key2 . nil)
+  (key3 . "abc")
+  (key4 . :false)
+  (key5 . t))
+#+end_src
+ TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+key1 = 123
+key3 = "abc"
+key4 = false
+key5 = true
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+: {
+:   "key1": 123,
+:   "key2": null,
+:   "key3": "abc",
+:   "key4": false,
+:   "key5": true
+: }
 ** TOML Arrays: Lists
 https://toml.io/en/v1.0.0#array
 *** Lists
@@ -827,36 +864,6 @@ booleans = [true, false]
   ]
 }
 #+end_example
-** Nil
- S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref nil-value
-'((key1 . 123)
-  (key2 . nil)
-  (key3 . "abc")
-  (key4 . :false)
-  (key5 . t))
-#+end_src
- TOML
-#+begin_src toml
-key1 = 123
-key3 = "abc"
-key4 = false
-key5 = true
-#+end_src
- JSON Reference
-#+begin_src emacs-lisp :noweb yes :exports results
-(json-encode-pretty
-  <>)
-#+end_src
-
-#+RESULTS:
-: {
-:   "key1": 123,
-:   "key2": null,
-:   "key3": "abc",
-:   "key4": false,
-:   "key5": true
-: }
 ** P-lists
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref p-list
diff --git a/test/all-tests.el b/test/all-tests.el
index 209d39f3be..5b1013864c 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -22,3 +22,4 @@
 (setq load-prefer-newer t)
 
 (require 'tscalar)
+(require 'tnil)
diff --git a/test/all-tests.el b/test/tnil.el
similarity index 54%
copy from test/all-tests.el
copy to test/tnil.el
index 209d39f3be..a5b8801e1e 100644
--- a/test/all-tests.el
+++ b/test/tnil.el
@@ -1,4 +1,4 @@
-;;; all-tests.el --- Tests for tomelr.el   -*- 
lexical-binding: t; -*-
+;; -*- lexical-binding: t; -*-
 
 ;; Authors: Kaushal Modi 
 
@@ -17,8 +17,32 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
-;;; Code:
+;;; Commentary:
 
-(setq load-prefer-newer t)
+;; Test removal of keys with nil value.
 
-(require 'tscalar)
+;;; Code:
+(require 'tomelr)
+
+ Key with nil value
+(ert-deftest test-nil ()
+  (let ((inp '(((nil_key . nil))
+   ((bool1 . t)
+(int . +99)
+(nil_key1 . nil)
+(bool2 . :false)
+(nil_key2 . nil)
+(bool3 . "false"))
+   ))
+(ref '(""
+   "bool1 = true
+int = 99
+bool2 = false
+bool3 = false"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tnil)
diff --git a/tomelr.el b/tomelr.el
index 341417f53c..cd7ff6b901 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -225,10 +225,12 @@ Signal `tomelr-key-format' if it cannot be encoded as a 
string."
  Objects
 (defun tomelr--print-pair (key val)
   "Insert TOML representation of KEY-VAL pair at point."
-  (tomelr--print-indentation) ;Newline before each key in a key-value pair
-  (tomelr--print-key key)
-  (insert tomelr--print-keyval-separator)
-  (tomelr--print val))
+  ;; (message "[tomelr--print-pair DBG] key = %S, val = %S" key val)
+  (when val ;Don't print the key if val is nil
+(tomelr--print-indentation) ;Newline before each key in a key-value pair
+(tomelr--print-key key)
+(insert tomelr--print-keyval-separator)
+(tomelr--print val)))
 
 (defun tomelr--print-map (map)
   "Insert TOML object representation of MAP at point.
@@ -311,6 +313,7 @@ ARRAY can also be a list."
 ((hash-table-p object)  (tomelr--print-unordered-map object))

[elpa] externals/tomelr c872e9efc1 17/84: test: Add test for integer scalar key-value pairs

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit c872e9efc1bcf0d9310160f825032c602500c346
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add test for integer scalar key-value pairs
---
 README.org  | 63 -
 test/tscalar.el | 15 ++
 2 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/README.org b/README.org
index 1682bf52f5..10368005c4 100644
--- a/README.org
+++ b/README.org
@@ -21,8 +21,8 @@ specification defined below.
 * Library Completion Status [0/6]
 - [-] Scalar
   - [X] Boolean
+  - [X] Integer
   - [ ] String
-  - [ ] Integer
   - [ ] Float
   - [ ] Date + Time with Offset
   - [ ] Date
@@ -47,14 +47,16 @@ https://toml.io/en/v1.0.0#boolean
   (bool2 . :false))
 #+end_src
  TOML
-#+begin_src emacs-lisp :noweb yes :exports results
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
 (tomelr-encode
   <>)
 #+end_src
 
 #+RESULTS:
-: bool1 = true
-: bool2 = false
+#+begin_src toml
+bool1 = true
+bool2 = false
+#+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
@@ -66,29 +68,8 @@ https://toml.io/en/v1.0.0#boolean
 :   "bool1": true,
 :   "bool2": false
 : }
-*** String
-https://toml.io/en/v1.0.0#string
- S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
-'((str . "Roses are red\nViolets are blue"))
-#+end_src
- TOML
-#+begin_src toml
-str = """
-Roses are red
-Violets are blue"""
-#+end_src
- JSON Reference
-#+begin_src emacs-lisp :noweb yes :exports results
-(json-encode-pretty
-  <>)
-#+end_src
-
-#+RESULTS:
-: {
-:   "str": "Roses are red\nViolets are blue"
-: }
-*** Integer
+*** DONE Integer
+CLOSED: [2022-04-28 Thu 17:11]
 https://toml.io/en/v1.0.0#integer
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-integer
@@ -98,6 +79,12 @@ https://toml.io/en/v1.0.0#integer
   (int4 . -17))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 int1 = 99
 int2 = 42
@@ -117,6 +104,28 @@ int4 = -17
 :   "int3": 0,
 :   "int4": -17
 : }
+*** String
+https://toml.io/en/v1.0.0#string
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
+'((str . "Roses are red\nViolets are blue"))
+#+end_src
+ TOML
+#+begin_src toml
+str = """
+Roses are red
+Violets are blue"""
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+: {
+:   "str": "Roses are red\nViolets are blue"
+: }
 *** Float
 https://toml.io/en/v1.0.0#float
  S-expression
diff --git a/test/tscalar.el b/test/tscalar.el
index 695dfcc4f0..b3cbe62137 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -38,5 +38,20 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Scalar - Integer
+(ert-deftest test-scalar-int ()
+  (let ((inp '(((int1 . +99))
+   ((int2 . 42))
+   ((int3 . 0))
+   ((int4 . -17
+(ref '("int1 = 99"
+   "int2 = 42"
+   "int3 = 0"
+   "int4 = -17"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'tscalar)



[elpa] externals/tomelr 52dc93201d 08/84: feat: First cut -- Port json-encode from json.el to tomelr-encode

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 52dc93201deb02a3d380d841e839f5f3e5f32c95
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: First cut -- Port json-encode from json.el to tomelr-encode

Contains only the fixes needed to make the boolean key-value pair look
right in TOML.
---
 tomelr.el | 288 ++
 1 file changed, 288 insertions(+)

diff --git a/tomelr.el b/tomelr.el
new file mode 100644
index 00..2a60f9d0e2
--- /dev/null
+++ b/tomelr.el
@@ -0,0 +1,288 @@
+;;; tomelr.el --- Convert Emacs s-expressions to TOML   -*- 
lexical-binding: t -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; tomelr.el is a library that provides functions to convert Emacs
+;; symbolic expressions to TOML.
+
+;;; Code:
+
+(require 'map)
+
+
+;;; Variables
+
+(defvar tomelr-false '(:false 'false "false")
+  "S-exp values to be interpreted as TOML `false'.")
+
+(defvar tomelr-encoding-default-indentation "  "
+  "String used for a single indentation level during encoding.
+This value is repeated for each further nested element.")
+
+(defvar tomelr-encoding-lisp-style-closings nil
+  "If non-nil, delimiters ] and } will be formatted Lisp-style.
+This means they will be placed on the same line as the last
+element of the respective array or object, without indentation.")
+
+(defvar tomelr-encoding-object-sort-predicate nil
+  "Sorting predicate for TOML object keys during encoding.
+If nil, no sorting is performed.  Else, TOML object keys are
+ordered by the specified sort predicate during encoding.  For
+instance, setting this to `string<' will have TOML object keys
+ordered alphabetically.")
+
+ Internal Variables
+(defvar tomelr--print-indentation-prefix "\n"
+  "String used to start indentation during encoding.")
+
+(defvar tomelr--print-indentation-depth -1
+  "Current indentation level during encoding.
+Dictates repetitions of `tomelr-encoding-default-indentation'.")
+
+(defvar tomelr--print-keyval-separator " = "
+  "String used to separate key-value pairs during encoding.")
+
+
+
+;;; Error conditions
+
+(define-error 'tomelr-error "Unknown TOML error")
+(define-error 'tomelr-key-format "Bad TOML object key" 'tomelr-error)
+
+
+
+;;; Utilities
+
+(defun tomelr-alist-p (list)
+  "Non-nil if and only if LIST is an alist with simple keys."
+  (declare (pure t) (side-effect-free error-free))
+  (while (and (consp (car-safe list))
+  (atom (caar list))
+  (setq list (cdr list
+  (null list))
+
+(defun tomelr-plist-p (list)
+  "Non-nil if and only if LIST is a plist with keyword keys."
+  (declare (pure t) (side-effect-free error-free))
+  (while (and (keywordp (car-safe list))
+  (consp (cdr list))
+  (setq list (cddr list
+  (null list))
+
+(defmacro tomelr--with-output-to-string (&rest body)
+  "Eval BODY in a temporary buffer bound to `standard-output'.
+Return the resulting buffer contents as a string."
+  (declare (indent 0) (debug t))
+  `(with-output-to-string
+ (with-current-buffer standard-output
+   ;; This affords decent performance gains.
+   (setq-local inhibit-modification-hooks t)
+   ,@body)))
+
+(defmacro tomelr--with-indentation (&rest body)
+  "Eval BODY with the TOML encoding nesting incremented by one step.
+This macro sets up appropriate variable bindings for
+`tomelr--print-indentation' to produce the correct indentation."
+  (declare (debug t) (indent 0))
+  `(let ((tomelr--print-indentation-depth (1+ 
tomelr--print-indentation-depth)))
+ ,@body))
+
+(defun tomelr--print-indentation ()
+  "Insert the current indentation for TOML encoding at point."
+  (insert tomelr--print-indentation-prefix)
+  (dotimes (_ tomelr--print-indentation-depth)
+(insert tomelr-encoding-default-indentation)))
+
+
+
+;;; Encoding
+
+ Keywords
+(defun tomelr-encode-keyword (keyword)
+  "Encode KEYWORD as a TOML value."
+  (declare (side-effect-free t))
+  ;; (message "[tomelr-encode-keyword DBG] keyword = %S" keyword)
+  (cond ((eq keyword t)"true")
+((member keyword tomelr-false) "false")))
+
+(defun tomelr--print-keyword (keyword)
+  "Insert KEYWORD as a TOML value at point.
+Return nil if KEYWORD is not recognized as a TOML keyword."
+  (

[elpa] externals/tomelr 8bc506af5a 02/84: Add s-exp->toml examples and spec

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 8bc506af5acd6e8f3ce47890185c5f4db1c3eb3e
Author: Kaushal Modi 
Commit: Kaushal Modi 

Add s-exp->toml examples and spec
---
 LICENSE| 674 +++
 README.org | 743 +
 2 files changed, 1417 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00..f288702d2f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propag

[elpa] externals/tomelr 1d65064ffa 20/84: feat: Recognize local date format YYYY-MM-DD

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 1d65064ffa0c6e1d5e9cb14a31de8ada38dc3395
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Recognize local date format -MM-DD
---
 README.org  | 49 ++--
 test/tscalar.el | 10 +++
 tomelr.el   | 86 ++---
 3 files changed, 90 insertions(+), 55 deletions(-)

diff --git a/README.org b/README.org
index 6583e6dcca..757e641f7b 100644
--- a/README.org
+++ b/README.org
@@ -24,8 +24,8 @@ specification defined below.
   - [X] Integer
   - [X] Float
   - [X] String
+  - [X] Date
   - [ ] Date + Time with Offset
-  - [ ] Date
   - [ ] Nil
 - [ ] Arrays
 - [ ] Array of Arrays
@@ -181,51 +181,58 @@ Violets are blue"""
 :   "str1": "Roses are red",
 :   "str2": "Roses are red\nViolets are blue"
 : }
-*** Date + Time with Offset
-https://toml.io/en/v1.0.0#offset-date-time
+*** DONE Date
+CLOSED: [2022-04-28 Thu 22:40]
+https://toml.io/en/v1.0.0#local-date
  S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-odt
-'((odt1 . "1979-05-27T07:32:00Z")
-  (odt2 . "1979-05-27T00:32:00-07:00")
-  (odt3 . "1979-05-27T00:32:00.99-07:00"))
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-date
+'((ld1 . "1979-05-27"))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
-odt1 = 1979-05-27T07:32:00Z
-odt2 = 1979-05-27T00:32:00-07:00
-odt3 = 1979-05-27T00:32:00.99-07:00
+ld1 = 1979-05-27
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
-  <>)
+  <>)
 #+end_src
 
 #+RESULTS:
 : {
-:   "odt1": "1979-05-27T07:32:00Z",
-:   "odt2": "1979-05-27T00:32:00-07:00",
-:   "odt3": "1979-05-27T00:32:00.99-07:00"
+:   "ld1": "1979-05-27"
 : }
-*** Date
-https://toml.io/en/v1.0.0#local-date
+*** Date + Time with Offset
+https://toml.io/en/v1.0.0#offset-date-time
  S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-date
-'((ld1 . "1979-05-27"))
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-odt
+'((odt1 . "1979-05-27T07:32:00Z")
+  (odt2 . "1979-05-27T00:32:00-07:00")
+  (odt3 . "1979-05-27T00:32:00.99-07:00"))
 #+end_src
  TOML
 #+begin_src toml
-ld1 = 1979-05-27
+odt1 = 1979-05-27T07:32:00Z
+odt2 = 1979-05-27T00:32:00-07:00
+odt3 = 1979-05-27T00:32:00.99-07:00
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
-  <>)
+  <>)
 #+end_src
 
 #+RESULTS:
 : {
-:   "ld1": "1979-05-27"
+:   "odt1": "1979-05-27T07:32:00Z",
+:   "odt2": "1979-05-27T00:32:00-07:00",
+:   "odt3": "1979-05-27T00:32:00.99-07:00"
 : }
 ** TOML Arrays: Lists
 https://toml.io/en/v1.0.0#array
diff --git a/test/tscalar.el b/test/tscalar.el
index 27fd940d00..12ebb081fa 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -90,5 +90,15 @@ Violets are blue\"\"\""
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Scalar - Local Date
+(ert-deftest test-scalar-date ()
+  (let ((inp '(((date . "1979-05-27"
+(ref '("date = 1979-05-27"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
 
 (provide 'tscalar)
diff --git a/tomelr.el b/tomelr.el
index 342ba01a5d..28cf4b242d 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -60,6 +60,22 @@ Dictates repetitions of 
`tomelr-encoding-default-indentation'.")
 (defvar tomelr--print-keyval-separator " = "
   "String used to separate key-value pairs during encoding.")
 
+(defvar tomelr--date-time-regexp
+  (concat "\\`[[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}"
+  "\\(?:[T 
][[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}\\(?:\\.[[:digit:]]+\\)*"
+  "\\(?:Z\\|[+-][[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}\\)*\\)*\\'")
+  "Regexp to match RFC 3339 formatted date-time with offset.
+
+- https://toml.io/en/v1.0.0#offset-date-time
+- https://tools.ietf.org/html/rfc3339#section-5.8
+
+Examples:
+  1979-05-27
+  1979-05-27T07:32:00Z
+  1979-05-27 07:32:00Z
+  1979-05-27T00:32:00-07:00
+  1979-05-27T00:32:00.99+04:00.")
+
 
 
 ;;; Error conditions
@@ -142,43 +158,45 @@ Return the same STRING passed as input."
  (?\\ . ?\\)))
 special-chars-re
 begin-q end-q)
-;; Use multi-line string quotation if the string contains a " char
-;; or a newline.
-(if (string-match-p "\n\\|\"" string)
-(progn  ;Triple quotation """STRING"""
-  ;; From https://toml.io/en/v1.0.0#string, Any Unicode
-  ;; character may be used except those that must be escaped:
-  ;; backslash and the control characters other than tab, line
-  ;; feed, and carriage return (U+ to U+0008, U+000B,
-  ;; U+000C, U+000E to U+001F, U+007F).
-  (setq special-chars-re (rx (in ?\\
- (?

[elpa] externals/tomelr cedb75df72 29/84: feat: Support basic TOML tables

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit cedb75df72f9aed0ad990b631f32d71f6ba1b79d
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Support basic TOML tables
---
 README.org   | 14 +++---
 test/all-tests.el|  1 +
 test/{all-tests.el => ttable.el} | 31 +-
 tomelr.el| 57 
 4 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/README.org b/README.org
index ba51f2e6b2..2acd5d41be 100644
--- a/README.org
+++ b/README.org
@@ -29,8 +29,8 @@ specification defined below.
 - [X] Nil
 - [X] Arrays
 - [X] Array of Arrays
-- [ ] Tables
-  - [ ] Basic Tables
+- [-] Tables
+  - [X] Basic Tables
   - [ ] Nested Tables
 - [ ] Array of Tables
   - [ ] Basic Array of Tables
@@ -393,7 +393,8 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
 }
 #+end_example
 ** TOML Tables: Maps or Dictionaries or Hash Tables
-*** Basic TOML Tables
+*** DONE Basic TOML Tables
+CLOSED: [2022-04-29 Fri 13:41]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref tables
 '((table-1 . ((key1 . "some string")
@@ -402,11 +403,16 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
   (key2 . 456
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 [table-1]
   key1 = "some string"
   key2 = 123
-
 [table-2]
   key1 = "another string"
   key2 = 456
diff --git a/test/all-tests.el b/test/all-tests.el
index f89407594b..a28528c2c0 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -24,3 +24,4 @@
 (require 'tscalar)
 (require 'tnil)
 (require 'tarray)
+(require 'ttable)
diff --git a/test/all-tests.el b/test/ttable.el
similarity index 55%
copy from test/all-tests.el
copy to test/ttable.el
index f89407594b..fdcafa87f4 100644
--- a/test/all-tests.el
+++ b/test/ttable.el
@@ -1,4 +1,4 @@
-;;; all-tests.el --- Tests for tomelr.el   -*- 
lexical-binding: t; -*-
+;; -*- lexical-binding: t; -*-
 
 ;; Authors: Kaushal Modi 
 
@@ -17,10 +17,29 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
-;;; Code:
+;;; Commentary:
 
-(setq load-prefer-newer t)
+;; Test conversion to TOML tables.
 
-(require 'tscalar)
-(require 'tnil)
-(require 'tarray)
+;;; Code:
+(require 'tomelr)
+
+ Simple tables
+(ert-deftest test-table ()
+  (let ((inp '(((table-1 . ((key1 . "some string")
+(key2 . 123
+   ((table-2 . ((key1 . "another string")
+(key2 . 456))
+(ref '("[table-1]
+  key1 = \"some string\"
+  key2 = 123"
+   "[table-2]
+  key1 = \"another string\"
+  key2 = 456"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'ttable)
diff --git a/tomelr.el b/tomelr.el
index f4ed83e757..ce1ebd4e9d 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -196,40 +196,63 @@ Return the same STRING passed as input."
   "Return a TOML representation of STRING."
   (tomelr--with-output-to-string (tomelr--print-string string)))
 
-(defun tomelr--print-stringlike (object)
+(defun tomelr--print-stringlike (object &optional type)
   "Insert OBJECT encoded as a TOML string at point.
+
+TYPE is set to `table' if OBJECT is a TOML Table key.
+
 Return nil if OBJECT cannot be encoded as a TOML string."
   (cond ((stringp object)
- ;; (message "[tomelr--print-stringlike DBG] string")
+ ;; (message "[tomelr--print-stringlike DBG] %S is string" object)
  (tomelr--print-string object))
 ((keywordp object)
- ;; (message "[tomelr--print-stringlike DBG] keyword")
+ ;; (message "[tomelr--print-stringlike DBG] %S is keyword" object)
  (tomelr--print-string (symbol-name object) 1))
 ((symbolp object)
- ;; (message "[tomelr--print-stringlike DBG] symbol")
- (princ (symbol-name object))
- ;; (tomelr--print-string (symbol-name object))
- )))
+ ;; (message "[tomelr--print-stringlike DBG] %S is symbol" object)
+ (cond
+  ((equal type 'table)
+   (princ (format "[%s]" (symbol-name object
+  (t
+   (princ (symbol-name object)))
+
+(defun tomelr--print-key (key &optional type)
+  "Insert a TOML key representation of KEY at point.
+
+TYPE is set to `table' if KEY is a TOML Table key.
 
-(defun tomelr--print-key (object)
-  "Insert a TOML key representation of OBJECT at point.
 Signal `tomelr-key-format' if it cannot be encoded as a string."
-  (or (tomelr--print-stringlike object)
-  (signal 'tomelr-key-format (list object
+  (or (tomelr--print-stringlike key type)
+  (signal 'tomelr-key-format (list key
 
  Objects
 (defun tomelr--print-pair (key val)
   "Insert TOML representation of KEY-VAL pair at po

[elpa] externals/tomelr 0f4e7b4f2c 47/84: fix: Better detection of nested TTA, but still wip

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 0f4e7b4f2c40a2cdce735d614eba9b7ac4640d06
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Better detection of nested TTA, but still wip

This fix also breaks the plist support for TTA
---
 README.org|  7 +++
 test/tinternal.el | 10 ++
 test/tplist.el| 23 ---
 tomelr.el | 33 ++---
 4 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/README.org b/README.org
index 4944ec5fcb..e44d71aea8 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [6/7]
+* Library Completion Status [5/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -35,7 +35,7 @@ specification defined below.
 - [-] Array of Tables
   - [X] Basic Array of Tables
   - [ ] Nested Array of Tables
-- [X] Property Lists
+- [ ] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
 
@@ -952,8 +952,7 @@ contributors = [
   ]
 }
 #+end_example
-** DONE P-lists
-CLOSED: [2022-04-29 Fri 18:42]
+** TODO P-lists
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref p-list
 '(:int 123
diff --git a/test/tinternal.el b/test/tinternal.el
index 5b4e1bb5d8..0e46b57ebb 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -47,7 +47,17 @@
  tomelr--toml-table-array-p
 (ert-deftest test-internal-valid-tta ()
   (let ((inp '(
+   ;; ;; TTA with 1 table of 1 key-val pair
(((a . 1)))
+   ((:a  1))
+   ;; ;; TTA with 2 tables of 2 key-val pairs
+   (((a . 1) (b . 2))
+((a . 100) (b . 200)))
+   ((:a 1 :b 2)
+(:a 100 :b 200))
+   ;; TTA with 1 table nesting another TTA
+   (((a . (((b . 2))
+   ((:a ((:b 2
)))
 (dolist (el inp)
   (should (equal t (tomelr--toml-table-array-p el))
diff --git a/test/tplist.el b/test/tplist.el
index 6798e137cf..2191d305f9 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -40,10 +40,11 @@
   :list_of_lists [(1 2) (3 4 5)]
   :map (:key1 123
 :key2 "xyz")
-  :list_of_maps [(:key1 123
-  :key2 "xyz")
- (:key1 567
-  :key2 "klm")])))
+  ;; :list_of_maps [(:key1 123
+  ;; :key2 "xyz")
+  ;;(:key1 567
+  ;; :key2 "klm")]
+  )))
   (ref '("int = 123
 str = \"abc\"
 bool_false = false
@@ -54,13 +55,13 @@ bool_list = [ true, false, true, false ]
 list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
 [map]
   key1 = 123
-  key2 = \"xyz\"
-[[list_of_maps]]
-  key1 = 123
-  key2 = \"xyz\"
-[[list_of_maps]]
-  key1 = 567
-  key2 = \"klm\""))
+  key2 = \"xyz\""))
+  ;; [[list_of_maps]]
+  ;;   key1 = 123
+  ;;   key2 = \"xyz\"
+  ;; [[list_of_maps]]
+  ;;   key1 = 567
+  ;;   key2 = \"klm\""))
   out)
   (dolist (el inp)
 (push (tomelr-encode el) out))
diff --git a/tomelr.el b/tomelr.el
index 2c3ed32b74..f61c10db9d 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -378,13 +378,32 @@ Definition of a TOML Table Array (TTA):
 
 - OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
   TOML Table (TT)."
-  (when (and (not (tomelr--toml-table-p object))
- (not (stringp object))
- (mapp object)) ;Because `mapp' is non-nil for strings too
-(seq-every-p
- (lambda (elem)
-   (tomelr--toml-table-p elem))
- object)))
+  (let (ttap)
+(when (and (not (tomelr--toml-table-p object))
+   (listp object))
+  ;; (message "[tomelr--toml-table-array-p DBG] object = %S, type = %S, 
len = %d"
+  ;;  object (type-of object) (safe-length object))
+  (setq ttap (cond
+  ((seq-every-p
+(lambda (elem)
+  ;; (message "  [tomelr--toml-table-array-p DBG] elem = 
%S, type = %S, len = %d"
+  ;;  elem (type-of elem) (safe-length elem))
+  ;; (when (listp elem)
+  ;;   (message "  [tomelr--toml-table-array-p DBG] 
sub-elem 0 = %S, type = %S, len = %d"
+  ;;(car elem) (type-of (car elem)) 
(safe-length (car elem
+  (tomelr--toml-table-p elem))
+object)
+   t)
+  ;; Handling the case of a nested TTA.
+  ;; Example: (((a . (((b . 
2))
+  ((and (listp (car objec

[elpa] externals/tomelr 28642f2e78 05/84: fix: dates will be strings in Lisp

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 28642f2e787a5424ebff30bbb6f7df2af54d6329
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: dates will be strings in Lisp

refactor: Move "lists of lists" to a different section
---
 README.org | 94 ++
 1 file changed, 58 insertions(+), 36 deletions(-)

diff --git a/README.org b/README.org
index 0d290b5e0f..349d2ca75a 100644
--- a/README.org
+++ b/README.org
@@ -40,7 +40,7 @@ https://toml.io/en/v1.0.0#integer
 #+end_src
  TOML
 #+begin_src toml
-int1 = +99
+int1 = 99
 int2 = 42
 int3 = 0
 int4 = -17
@@ -73,7 +73,7 @@ https://toml.io/en/v1.0.0#float
  TOML
 #+begin_src toml
 # fractional
-flt1 = +1.0
+flt1 = 1.0
 flt2 = 3.1415
 flt3 = -0.01
 
@@ -128,9 +128,9 @@ bool2 = false
 https://toml.io/en/v1.0.0#offset-date-time
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-odt
-'((odt1 . 1979-05-27T07:32:00Z)
-  (odt2 . 1979-05-27T00:32:00-07:00)
-  (odt3 . 1979-05-27T00:32:00.99-07:00))
+'((odt1 . "1979-05-27T07:32:00Z")
+  (odt2 . "1979-05-27T00:32:00-07:00")
+  (odt3 . "1979-05-27T00:32:00.99-07:00"))
 #+end_src
  TOML
 #+begin_src toml
@@ -154,7 +154,7 @@ odt3 = 1979-05-27T00:32:00.99-07:00
 https://toml.io/en/v1.0.0#local-date
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-date
-'((ld1 . 1979-05-27))
+'((ld1 . "1979-05-27"))
 #+end_src
  TOML
 #+begin_src toml
@@ -172,36 +172,26 @@ ld1 = 1979-05-27
 : }
 ** TOML Arrays: Lists
 https://toml.io/en/v1.0.0#array
-*** S-expression
+*** Lists
+ S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref lists
 '((integers . (1 2 3))
   (integers2 . [1 2 3]) ;Same as above
   (colors . ("red" "yellow" "green"))
-  (nested_arrays_of_ints . [(1 2) (3 4 5)])
-  (nested_mixed_array . [(1 2) ("a" "b" "c")])
   (string_array . ("all" "strings" "are the same" "type"))
-  (numbers . (0.1 0.2 0.5 1 2 5))
-  (contributors . ("Foo Bar "
-   ((name . "Baz Qux")
-(email . "baz...@example.com")
-(url . "https://example.com/bazqux";)
+  (numbers . (0.1 0.2 0.5 1 2 5)))
 #+end_src
-*** TOML
+ TOML
 #+begin_src toml
 integers = [ 1, 2, 3 ]
+integers2 = [ 1, 2, 3 ]
 colors = [ "red", "yellow", "green" ]
-nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
-nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
 string_array = [ "all", 'strings', """are the same""", '''type''' ]
 
 # Mixed-type arrays are allowed
 numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
-contributors = [
-  "Foo Bar ",
-  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
-]
 #+end_src
-*** JSON Reference
+ JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty
   <>)
@@ -225,6 +215,52 @@ contributors = [
 "yellow",
 "green"
   ],
+  "string_array": [
+"all",
+"strings",
+"are the same",
+"type"
+  ],
+  "numbers": [
+0.1,
+0.2,
+0.5,
+1,
+2,
+5
+  ]
+}
+#+end_example
+*** Lists of lists
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref lists-of-lists
+'((nested_arrays_of_ints . [(1 2) (3 4 5)])
+  (nested_mixed_array . [(1 2) ("a" "b" "c")])
+  (contributors . ("Foo Bar "
+   ((name . "Baz Qux")
+(email . "baz...@example.com")
+(url . "https://example.com/bazqux";)
+#+end_src
+ TOML
+#+begin_src toml
+nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
+nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
+
+# Mixed-type arrays are allowed
+contributors = [
+  "Foo Bar ",
+  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
+]
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_example
+{
   "nested_arrays_of_ints": [
 [
   1,
@@ -247,20 +283,6 @@ contributors = [
   "c"
 ]
   ],
-  "string_array": [
-"all",
-"strings",
-"are the same",
-"type"
-  ],
-  "numbers": [
-0.1,
-0.2,
-0.5,
-1,
-2,
-5
-  ],
   "contributors": [
 "Foo Bar ",
 {



[elpa] externals/tomelr 060c38b934 16/84: chore(readme): Limit up to 3 levels of headings for Org exports

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 060c38b934d2e7a51cbf3e1320782cb3203310db
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(readme): Limit up to 3 levels of headings for Org exports
---
 README.org | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.org b/README.org
index 8768d21280..1682bf52f5 100644
--- a/README.org
+++ b/README.org
@@ -1,6 +1,8 @@
 #+title: Emacs-Lisp Library for converting S-expressions to TOML
 #+author: Kaushal Modi
 
+#+options: H:3
+
 #+property: header-args :eval never-export
 
 *NOTE*: This library is in a severe beta stage. It is not ready for any use!! 
:poop:



[elpa] externals/tomelr 98c9b8c1fc 26/84: fix: Use `=` and `length` separately instead of `length=`

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 98c9b8c1fc9eb3fbc0016d6692ae8aed95bbe003
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Use `=` and `length` separately instead of `length=`

length= does not exist on 27.2 and older Emacs versions.

It was added in Emacs 28.1 in

https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9809f7ed2c639bd51abd4a28bd5d1a37f0d46a3d.
---
 tomelr.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 8952f920a9..f4ed83e757 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -277,7 +277,7 @@ non-nil.  Sorting can optionally be DESTRUCTIVE for speed."
 (defun tomelr--print-array (array)
   "Like `tomelr-encode-array', but insert the TOML at point."
   (insert "[ ")
-  (unless (length= array 0)
+  (unless (= 0 (length array))
 (tomelr--with-indentation
   (let ((first t))
 (mapc (lambda (elt)
@@ -285,8 +285,9 @@ non-nil.  Sorting can optionally be DESTRUCTIVE for speed."
 (setq first nil)
   (insert ", "))
 (tomelr--print elt))
-  array
-  (insert " ]"))
+  array)))
+(insert " "))
+  (insert "]"))
 
 (defun tomelr-encode-array (array)
   "Return a TOML representation of ARRAY.



[elpa] externals/tomelr 4386d99a85 65/84: refactor(minor): Use `tomelr--toml-table-p`

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 4386d99a8596fa244c818b8ae9f341feeeb0b677
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor(minor): Use `tomelr--toml-table-p`
---
 tomelr.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 434a67885f..20d9a3190e 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -290,8 +290,7 @@ This works for any MAP satisfying `mapp'."
  Lists (including alists and plists)
 (defun tomelr--print-list (list)
   "Insert a TOML representation of LIST at point."
-  (cond ((or (tomelr-alist-p list)
- (json-plist-p list))
+  (cond ((tomelr--toml-table-p list)
  (tomelr--print-map list))
 ((listp list)
  (tomelr--print-array list))



[elpa] externals/tomelr 000067cf7d 14/84: chore(readme): Update

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 67cf7db0a836d9c312a1ba78f25d8d667398
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(readme): Update
---
 README.org | 59 ---
 1 file changed, 36 insertions(+), 23 deletions(-)

diff --git a/README.org b/README.org
index 6c03b754b0..b3b4c0ae91 100644
--- a/README.org
+++ b/README.org
@@ -10,10 +10,46 @@
 * Installation
 Clone this repo, have ~tomelr.el~ in the ~load-path~ and ~(require
 'tomelr)~.
+* Credit
+This library started off by extracting the JSON Encoding pieces from
+the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/json.el][*json.el*]].
+
+It will then be gradually refactored so that it meets the
+specification defined below.
 * Specification and Conversion Examples
+[[https://scripter.co/defining-tomelr/][Companion blog post]]
+
 Below examples are shown on how S-expressions get translated to
 various TOML object types.
 ** Scalars
+*** DONE Boolean
+CLOSED: [2022-04-28 Thu 16:48]
+https://toml.io/en/v1.0.0#boolean
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-boolean
+'((bool1 . t)
+  (bool2 . :false))
+#+end_src
+ TOML
+#+begin_src emacs-lisp :noweb yes :exports results
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+: bool1 = true
+: bool2 = false
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+: {
+:   "bool1": true,
+:   "bool2": false
+: }
 *** String
 https://toml.io/en/v1.0.0#string
  S-expression
@@ -108,29 +144,6 @@ flt7 = 6.626e-34
 :   "flt6": -0.02,
 :   "flt7": 6.626e-34
 : }
-*** Boolean
-https://toml.io/en/v1.0.0#boolean
- S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-boolean
-'((bool1 . t)
-  (bool2 . :false))
-#+end_src
- TOML
-#+begin_src toml
-bool1 = true
-bool2 = false
-#+end_src
- JSON Reference
-#+begin_src emacs-lisp :noweb yes :exports results
-(json-encode-pretty
-  <>)
-#+end_src
-
-#+RESULTS:
-: {
-:   "bool1": true,
-:   "bool2": false
-: }
 *** Date + Time with Offset
 https://toml.io/en/v1.0.0#offset-date-time
  S-expression



[elpa] externals/tomelr f37841cc78 25/84: test: Add test for TOML Array of Arrays

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit f37841cc781ce322ba31806cf9ef1ca7578f5714
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add test for TOML Array of Arrays
---
 README.org | 17 -
 test/tarray.el | 13 -
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 937d0c9462..607ad24589 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [3/7]
+* Library Completion Status [4/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -28,7 +28,7 @@ specification defined below.
   - [X] Date + Time with Offset
 - [X] Nil
 - [X] Arrays
-- [ ] Array of Arrays
+- [X] Array of Arrays
 - [ ] Tables
 - [ ] Array of Tables
 - [ ] Property Lists
@@ -337,16 +337,23 @@ numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
   ]
 }
 #+end_example
-*** Array of Arrays
+*** DONE Array of Arrays
+CLOSED: [2022-04-29 Fri 00:34]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref array-of-arrays
 '((nested_arrays_of_ints . [(1 2) (3 4 5)])
   (nested_mixed_array . [(1 2) ("a" "b" "c")]))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
-nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
-nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
+nested_arrays_of_ints = [ [ 1, 2 ], [ 3, 4, 5 ] ]
+nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
diff --git a/test/tarray.el b/test/tarray.el
index 1c92e55c8c..604855613a 100644
--- a/test/tarray.el
+++ b/test/tarray.el
@@ -24,7 +24,7 @@
 ;;; Code:
 (require 'tomelr)
 
- Key with array value
+ Simple arrays
 (ert-deftest test-array ()
   (let ((inp '(((integers . (1 2 3)))
((integers2 . [1 2 3]));Same as above
@@ -39,5 +39,16 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Array of arrays
+(ert-deftest test-array-of-arrays ()
+  (let ((inp '(((nested_arrays_of_ints . [(1 2) (3 4 5)]))
+   ((nested_mixed_array . [(1 2) ("a" "b" "c")]
+(ref '("nested_arrays_of_ints = [ [ 1, 2 ], [ 3, 4, 5 ] ]"
+   "nested_mixed_array = [ [ 1, 2 ], [ \"a\", \"b\", \"c\" ] ]"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'tarray)



[elpa] externals/tomelr 192cb06a23 57/84: chore(style): Whitespace change only

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 192cb06a2374ef6a0d24eeca4d4f4062848edbd7
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(style): Whitespace change only
---
 test/ttable.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/ttable.el b/test/ttable.el
index 3898b187cd..477324dc3f 100644
--- a/test/ttable.el
+++ b/test/ttable.el
@@ -26,16 +26,20 @@
 
  Simple tables
 (ert-deftest test-table ()
-  (let ((inp '(((table-1 . ((key1 . "some string")
+  (let ((inp '(
+   ((table-1 . ((key1 . "some string")
 (key2 . 123
((table-2 . ((key1 . "another string")
-(key2 . 456))
-(ref '("[table-1]
+(key2 . 456
+   ))
+(ref '(
+   "[table-1]
   key1 = \"some string\"
   key2 = 123"
"[table-2]
   key1 = \"another string\"
-  key2 = 456"))
+  key2 = 456"
+   ))
 out)
 (dolist (el inp)
   (push (tomelr-encode el) out))



[elpa] externals/tomelr 55fefb0fa8 40/84: doc: Add few links

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 55fefb0fa83d90a47817c0cc0ae0d1e17e73739f
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Add few links

[skip ci]
---
 README.org | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.org b/README.org
index daf1673d9a..b3513273e4 100644
--- a/README.org
+++ b/README.org
@@ -393,6 +393,7 @@ nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
 }
 #+end_example
 ** TOML Tables: Maps or Dictionaries or Hash Tables
+https://toml.io/en/v1.0.0#table
 *** DONE Basic TOML Tables
 CLOSED: [2022-04-29 Fri 13:41]
  S-expression
@@ -483,6 +484,7 @@ CLOSED: [2022-04-29 Fri 14:30]
 }
 #+end_example
 ** TOML Array of Tables: Lists of Maps
+https://toml.io/en/v1.0.0#array-of-tables
 *** DONE Basic Array of Tables
 CLOSED: [2022-04-29 Fri 18:14]
  S-expression



[elpa] externals/tomelr 6d2be83669 69/84: chore: package-lint fixes

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 6d2be83669f3daf65b53689df9346824673f86a5
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: package-lint fixes
---
 tomelr.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index b97d2e77b2..faa2402f88 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -1,10 +1,10 @@
-;;; tomelr.el --- Convert Emacs s-expressions to TOML   -*- 
lexical-binding: t -*-
+;;; tomelr.el --- Convert s-expressions to TOML   -*- lexical-binding: 
t -*-
 
 ;; Authors: Kaushal Modi 
 ;; URL: https://github.com/kaushalmodi/tomelr
 ;; Package-Requires: ((emacs "26.3"))
-;; Keywords: TOML, config
-;; Version: v0.0.2
+;; Keywords: data, tools
+;; Version: 0.0.2
 
 ;; This file is not part of GNU Emacs.
 
@@ -23,8 +23,8 @@
 
 ;;; Commentary:
 
-;; tomelr.el is a library that provides functions to convert Emacs
-;; symbolic expressions to TOML.
+;; tomelr.el is a library for converting Lisp data expressions to TOML
+;; (https://toml.io/en/).
 
 ;;; Code:
 



[elpa] externals/tomelr 4dda8e6be3 46/84: chore: Style edits in a test

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 4dda8e6be3563a01b55ce494c7e300b75e0768a6
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Style edits in a test
---
 test/tarray.el | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/tarray.el b/test/tarray.el
index 604855613a..2669c7ac94 100644
--- a/test/tarray.el
+++ b/test/tarray.el
@@ -25,15 +25,19 @@
 (require 'tomelr)
 
  Simple arrays
-(ert-deftest test-array ()
-  (let ((inp '(((integers . (1 2 3)))
+(ert-deftest test-basic-arrays ()
+  (let ((inp '(
+   ((integers . (1 2 3)))
((integers2 . [1 2 3]));Same as above
((colors . ("red" "yellow" "green")))
-   ((numbers . (0.1 0.2 0.5 1 2 5) ;Mixed-type arrays are 
allowed
-(ref '("integers = [ 1, 2, 3 ]"
+   ((numbers . (0.1 0.2 0.5 1 2 5))) ;Mixed-type arrays are allowed
+   ))
+(ref '(
+   "integers = [ 1, 2, 3 ]"
"integers2 = [ 1, 2, 3 ]"
"colors = [ \"red\", \"yellow\", \"green\" ]"
-   "numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]"))
+   "numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]"
+   ))
 out)
 (dolist (el inp)
   (push (tomelr-encode el) out))



[elpa] externals/tomelr a7b3a57037 48/84: feat: Make a very basic nested array of TTA work

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a7b3a5703729682e88d6352932e235cbe04deb28
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Make a very basic nested array of TTA work
---
 test/ttable-array.el | 37 +
 tomelr.el| 15 ++-
 2 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/test/ttable-array.el b/test/ttable-array.el
index 37392ba28d..5d1b2c4333 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -62,5 +62,42 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Nested array of tables
+(ert-deftest test-nested-array-of-tables ()
+  (let ((inp '(
+   ((fruits . (((varieties . (((name . "red delicious"))
+  ((name . "granny smith"
+   ;; ((fruits . (((name . "apple")
+   ;;  (physical . ((color . "red")
+   ;;   (shape . "round")))
+   ;;  (varieties . (((name . "red delicious"))
+   ;;((name . "granny smith")
+   ;; ((name . "banana")
+   ;;  (varieties . (((name . "plantain"
+   ))
+(ref '("[[fruits]]
+  [[fruits.varieties]]
+name = \"red delicious\"
+  [[fruits.varieties]]
+name = \"granny smith\""
+   ;; "[[fruits]]
+   ;; name = \"apple\"
+   ;; [fruits.physical]
+   ;; color = \"red\"
+   ;; shape = \"round\"
+   ;; [[fruits.varieties]]
+   ;; name = \"red delicious\"
+   ;; [[fruits.varieties]]
+   ;; name = \"granny smith\"
+   ;; [[fruits]]
+   ;; name = \"banana\"
+   ;; [[fruits.varieties]]
+   ;; name = \"plantain\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'ttable-array)
diff --git a/tomelr.el b/tomelr.el
index f61c10db9d..fc5bdc72a9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -54,7 +54,9 @@ ordered alphabetically.")
 Dictates repetitions of `tomelr-encoding-default-indentation'.")
 
 (defvar tomelr--print-table-hierarchy ()
-  "Internal variable used to save the TOML Table hierarchy.")
+  "Internal variable used to save TOML Table hierarchies.
+This variable is used for both TOML Tables and Arrays of TOML
+Tables.")
 
 (defvar tomelr--print-table-array-key ""
   "Internal variable used to save the TOML Table Array name.")
@@ -219,8 +221,7 @@ Return nil if OBJECT cannot be encoded as a TOML string."
  (string-trim-left (symbol-name object) ":"))
 ((symbolp object)
  (symbol-name object)
-(cond
- ((equal type 'table)
+(when type
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
   ;;  object type tomelr--print-indentation-depth)
   (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
@@ -236,9 +237,12 @@ Return nil if OBJECT cannot be encoded as a TOML string."
   sym-name))
   ;; (message "[tomelr--print-stringlike DBG] table hier: %S"
   ;;  tomelr--print-table-hierarchy)
+  )
+(cond
+ ((equal type 'table)
   (princ (format "[%s]" (string-join tomelr--print-table-hierarchy "."
  ((equal type 'table-array)
-  (let ((tta-name (format "[[%s]]" sym-name)))
+  (let ((tta-name (format "[[%s]]" (string-join 
tomelr--print-table-hierarchy "."
 (setq tomelr--print-table-array-key tta-name)
 (princ tta-name)))
  ((stringp object)
@@ -417,7 +421,8 @@ See `tomelr-encode-array' that returns the same as a 
string."
 (mapc (lambda (elt)
 (if first
 (setq first nil)
-  (insert (format "\n%s" tomelr--print-table-array-key)))
+  (tomelr--print-indentation)
+  (insert tomelr--print-table-array-key))
 (tomelr--print elt))
   array
(t



[elpa] externals/tomelr 9c91e0dc07 18/84: test: Add test for float scalar key-value pairs

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 9c91e0dc07291aae8a8b2b4dd1cea52583165e14
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add test for float scalar key-value pairs
---
 README.org  | 64 +
 test/tscalar.el | 21 +++
 2 files changed, 54 insertions(+), 31 deletions(-)

diff --git a/README.org b/README.org
index 10368005c4..176979b7ed 100644
--- a/README.org
+++ b/README.org
@@ -22,8 +22,8 @@ specification defined below.
 - [-] Scalar
   - [X] Boolean
   - [X] Integer
+  - [X] Float
   - [ ] String
-  - [ ] Float
   - [ ] Date + Time with Offset
   - [ ] Date
   - [ ] Nil
@@ -104,29 +104,8 @@ int4 = -17
 :   "int3": 0,
 :   "int4": -17
 : }
-*** String
-https://toml.io/en/v1.0.0#string
- S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
-'((str . "Roses are red\nViolets are blue"))
-#+end_src
- TOML
-#+begin_src toml
-str = """
-Roses are red
-Violets are blue"""
-#+end_src
- JSON Reference
-#+begin_src emacs-lisp :noweb yes :exports results
-(json-encode-pretty
-  <>)
-#+end_src
-
-#+RESULTS:
-: {
-:   "str": "Roses are red\nViolets are blue"
-: }
-*** Float
+*** DONE Float
+CLOSED: [2022-04-28 Thu 17:29]
 https://toml.io/en/v1.0.0#float
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-float
@@ -139,18 +118,19 @@ https://toml.io/en/v1.0.0#float
   (flt7 . 6.626e-34))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
-# fractional
 flt1 = 1.0
 flt2 = 3.1415
 flt3 = -0.01
-
-# exponent
 flt4 = 5e+22
-flt5 = 1e06
-flt6 = -2E-2
-
-# both
+flt5 = 100.0
+flt6 = -0.02
 flt7 = 6.626e-34
 #+end_src
  JSON Reference
@@ -169,6 +149,28 @@ flt7 = 6.626e-34
 :   "flt6": -0.02,
 :   "flt7": 6.626e-34
 : }
+*** String
+https://toml.io/en/v1.0.0#string
+ S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
+'((str . "Roses are red\nViolets are blue"))
+#+end_src
+ TOML
+#+begin_src toml
+str = """
+Roses are red
+Violets are blue"""
+#+end_src
+ JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+  <>)
+#+end_src
+
+#+RESULTS:
+: {
+:   "str": "Roses are red\nViolets are blue"
+: }
 *** Date + Time with Offset
 https://toml.io/en/v1.0.0#offset-date-time
  S-expression
diff --git a/test/tscalar.el b/test/tscalar.el
index b3cbe62137..a052eff7db 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -53,5 +53,26 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Scalar - Float
+(ert-deftest test-scalar-float ()
+  (let ((inp '(((float1 . +1.0))
+   ((float2 . 3.1415))
+   ((float3 . -0.01))
+   ((float4 . 5e+22))
+   ((float5 . 1e06))
+   ((float6 . -2E-2))
+   ((float7 . 6.626e-34
+(ref '("float1 = 1.0"
+   "float2 = 3.1415"
+   "float3 = -0.01"
+   "float4 = 5e+22"
+   "float5 = 100.0"
+   "float6 = -0.02"
+   "float7 = 6.626e-34"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'tscalar)



[elpa] externals/tomelr f3b6951cfe 53/84: doc: Add note that the scalars need to be earlier in the order

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit f3b6951cfe000bb82a727d6917245716c46b3d6a
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Add note that the scalars need to be earlier in the order

[skip ci]
---
 README.org | 61 +
 1 file changed, 53 insertions(+), 8 deletions(-)

diff --git a/README.org b/README.org
index 5240692b1c..21f1f0540d 100644
--- a/README.org
+++ b/README.org
@@ -14,9 +14,59 @@ Clone this repo, have ~tomelr.el~ in the ~load-path~ and 
~(require
 This library started off by extracting the JSON Encoding pieces from
 the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/json.el][*json.el*]].
 
-It will then be gradually refactored so that it meets the
-specification defined below.
-* Library Completion Status [7/7]
+It was then refactored to meet the specification defined below.
+* Limitation
+Right now, the scalars and tables/array of tables does not get ordered
+in the right order automatically. So the user needs to ensure that the
+S-exp has all the scalars in the very beginning and then followed by
+TOML tables and arrays of tables.
+** Correct Example
+​:white_check_mark: Put the scalars first and then maps or tables.
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-tables-order-correct
+'((title . "Hello")   ;First the scalar
+  (img . ((file . "foo.png")  ;Then the map or table
+  (credit . "Bar Zoo"
+#+end_src
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+title = "Hello"
+[img]
+  file = "foo.png"
+  credit = "Bar Zoo"
+#+end_src
+** Wrong Example
+​:x: *Don't do this!*: Map or table first and then scalar.
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-tables-order-wrong
+'((img . ((file . "foo.png")
+  (credit . "Bar Zoo")))
+  (title . "Hello"))
+#+end_src
+
+*Incorrect order!* Now the ~title~ became part of the ~[img]~ table!
+
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+[img]
+  file = "foo.png"
+  credit = "Bar Zoo"
+title = "Hello"
+#+end_src
+* Specification and Conversion Examples
+[[https://scripter.co/defining-tomelr/][Companion blog post]]
+
+Below examples are shown on how S-expressions get translated to
+various TOML object types.
+** Library Completion Status [7/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -34,11 +84,6 @@ specification defined below.
   - [X] Basic Array of Tables
   - [X] Nested Array of Tables
 - [X] Property Lists
-* Specification and Conversion Examples
-[[https://scripter.co/defining-tomelr/][Companion blog post]]
-
-Below examples are shown on how S-expressions get translated to
-various TOML object types.
 ** Scalars
 *** DONE Boolean
 CLOSED: [2022-04-28 Thu 16:48]



[elpa] externals/tomelr 83e924559e 13/84: chore(doc): Fix typo

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 83e924559eb79effcfdad2737c6efa06c9ff0caf
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(doc): Fix typo
---
 README.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index d24eb3ff3b..6c03b754b0 100644
--- a/README.org
+++ b/README.org
@@ -8,8 +8,8 @@
 
[[https://github.com/kaushalmodi/tomelr/actions][https://github.com/kaushalmodi/tomelr/actions/workflows/test.yml/badge.svg]]
 
[[https://www.gnu.org/licenses/gpl-3.0][https://img.shields.io/badge/License-GPL%20v3-blue.svg]]
 
 * Installation
-Clone this repo, have ~baser.el~ in the ~load-path~ and ~(require
-'baser)~.
+Clone this repo, have ~tomelr.el~ in the ~load-path~ and ~(require
+'tomelr)~.
 * Specification and Conversion Examples
 Below examples are shown on how S-expressions get translated to
 various TOML object types.



[elpa] externals/tomelr e2b313ca3b 52/84: feat: Implement everything planned in the initial spec

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit e2b313ca3b3e4c98c18749671ac59bc1fe319c52
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Implement everything planned in the initial spec

Fix converting of array of TOML tables represented by S-exp vectors.
---
 README.org|  9 -
 test/tinternal.el |  3 +++
 test/tplist.el| 22 +++---
 tomelr.el | 22 +-
 4 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/README.org b/README.org
index 7a03d4bd7d..5240692b1c 100644
--- a/README.org
+++ b/README.org
@@ -5,8 +5,6 @@
 
 #+property: header-args :eval never-export
 
-*NOTE*: This library is in a severe beta stage. It is not ready for any use!! 
:poop:
-
 
[[https://github.com/kaushalmodi/tomelr/actions][https://github.com/kaushalmodi/tomelr/actions/workflows/test.yml/badge.svg]]
 
[[https://www.gnu.org/licenses/gpl-3.0][https://img.shields.io/badge/License-GPL%20v3-blue.svg]]
 
 * Installation
@@ -18,7 +16,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [6/7]
+* Library Completion Status [7/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -35,7 +33,7 @@ specification defined below.
 - [X] Array of Tables
   - [X] Basic Array of Tables
   - [X] Nested Array of Tables
-- [ ] Property Lists
+- [X] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
 
@@ -954,7 +952,8 @@ contributors = [
   ]
 }
 #+end_example
-** TODO P-lists
+** DONE P-lists
+CLOSED: [2022-04-30 Sat 01:55]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref p-list
 '(:int 123
diff --git a/test/tinternal.el b/test/tinternal.el
index 63e58a7fab..187b5dbe3e 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -66,6 +66,9 @@
;; TTA with 1 table nesting another TTA
(((a . (((b . 2))
((:a ((:b 2
+   ;; TTA with vector notation
+   [(:a 100 :b "foo")
+(:a 200 :b "bar")]
)))
 (dolist (el inp)
   (should (equal t (tomelr--toml-table-array-p el))
diff --git a/test/tplist.el b/test/tplist.el
index 2191d305f9..b49196ec6d 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -40,10 +40,10 @@
   :list_of_lists [(1 2) (3 4 5)]
   :map (:key1 123
 :key2 "xyz")
-  ;; :list_of_maps [(:key1 123
-  ;; :key2 "xyz")
-  ;;(:key1 567
-  ;; :key2 "klm")]
+  :list_of_maps [(:key1 123
+  :key2 "xyz")
+ (:key1 567
+  :key2 "klm")]
   )))
   (ref '("int = 123
 str = \"abc\"
@@ -55,13 +55,13 @@ bool_list = [ true, false, true, false ]
 list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
 [map]
   key1 = 123
-  key2 = \"xyz\""))
-  ;; [[list_of_maps]]
-  ;;   key1 = 123
-  ;;   key2 = \"xyz\"
-  ;; [[list_of_maps]]
-  ;;   key1 = 567
-  ;;   key2 = \"klm\""))
+  key2 = \"xyz\"
+[[list_of_maps]]
+  key1 = 123
+  key2 = \"xyz\"
+[[list_of_maps]]
+  key1 = 567
+  key2 = \"klm\""))
   out)
   (dolist (el inp)
 (push (tomelr-encode el) out))
diff --git a/tomelr.el b/tomelr.el
index 4611a92b31..1ef27faaa9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -393,7 +393,8 @@ Definition of a TOML Table Array (TTA):
   TOML Table (TT)."
   (let (ttap)
 (when (and (not (tomelr--toml-table-p object))
-   (listp object))
+   (or (listp object)
+   (vectorp object)))
   ;; (message "[tomelr--toml-table-array-p DBG] object = %S, type = %S, 
len = %d"
   ;;  object (type-of object) (safe-length object))
   (setq ttap (cond
@@ -404,18 +405,21 @@ Definition of a TOML Table Array (TTA):
   ;; (when (listp elem)
   ;;   (message "  [tomelr--toml-table-array-p DBG] 
sub-elem 0 = %S, type = %S, len = %d"
   ;;(car elem) (type-of (car elem)) 
(safe-length (car elem
-  (tomelr--toml-table-p elem))
+  (or
+   (tomelr--toml-table-p elem)
+   ;; Handling the case of a nested TTA.
+   ;; Example:(((a . (((b . 2))
+   (and (listp elem) ; ((a . (((b . 2)
+(listp (car elem))   ;  (a . (((b . 2
+(symbolp (car (car elem)))   ;   a  <- symbol
+;;   --(((b . 2)))-  <-- 
This will be a TTA.
+

[elpa] externals/tomelr 26f1fc2f3c 55/84: doc: Update the medley example

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 26f1fc2f3c0245e69c8c72b0cd01024f9d53078b
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Update the medley example

[skip ci]
---
 README.org | 129 -
 1 file changed, 60 insertions(+), 69 deletions(-)

diff --git a/README.org b/README.org
index 21f1f0540d..e6a77a1f5a 100644
--- a/README.org
+++ b/README.org
@@ -708,51 +708,53 @@ CLOSED: [2022-04-30 Sat 01:32]
   (integers . (123 -5 17 1234))
   (floats . (12.3 -5.0 -1.7e-05))
   (booleans . (t :false))
-  (contributors . ("Foo Bar "
-   ((name . "Baz Qux")
-(email . "baz...@example.com")
-(url . "https://example.com/bazqux";
-  (dog . ((legs . 4)
-  (eyes . 2)
-  (friends . ("poo" "boo"
+  (dog . (:legs 4
+  :eyes 2
+  :friends ("poo" "boo")))
   (header . ((image . "projects/Readingabook.jpg")
  (caption . "stay hungry stay foolish")))
-  (collection . ((nothing . :false)
- (nonnil . t)
- (animals . ("dog" "cat" "penguin" "mountain gorilla"))
- (strings-symbols . ("abc" "def" "two words"))
- (integers . (123 -5 17 1234))
- (floats . (12.3 -5.0 -1.7e-05))
- (booleans . (t :false
+  (collection . (:nothing :false
+ :nonnil t
+ :animals ("dog" "cat" "penguin" "mountain gorilla")
+ :strings-symbols ("abc" "def" "two words")
+ :integers (123 -5 17 1234)
+ :floats (12.3 -5.0 -1.7e-05)
+ :booleans (t :false)))
   (menu . ((foo . ((identifier . "keyword-collection")
(weight . 10)
-  (resources . (((src . "*.png")
- (name . "my-cool-image-:counter")
- (title . "The Image #:counter")
- (params . ((foo . "bar")
-(floats . (12.3 -5.0 -1.7e-05))
-(strings-symbols . ("abc" "def" "two words"))
-(animals . ("dog" "cat" "penguin" "mountain 
gorilla"))
-(integers . (123 -5 17 1234))
-(booleans . (t :false))
-(byline . "bep"
-((src . "image-4.png")
- (title . "The Fourth Image"))
-((src . "*.jpg")
- (title . "JPEG Image #:counter")
+  (resources . [(:src "*.png"
+ :name "my-cool-image-:counter"
+ :title "The Image #:counter"
+ :params (:foo "bar"
+  :floats (12.3 -5.0 -1.7e-05)
+  :strings-symbols ("abc" "def" "two words")
+  :animals ("dog" "cat" "penguin" "mountain gorilla")
+  :integers (123 -5 17 1234)
+  :booleans (t :false)
+  :byline "bep"))
+(:src "image-4.png"
+ :title "The Fourth Image")
+(:src "*.jpg"
+ :title "JPEG Image #:counter")]))
 #+end_src
 *** TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 title = "Keyword Collection"
-author = ["firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3"]
-aliases = ["/posts/keyword-concatenation", "/posts/keyword-merging"]
-images = ["image 1", "image 2"]
-keywords = ["keyword1", "keyword2", "three word keywords3"]
-outputs = ["html", "json"]
-series = ["series 1", "series 2"]
-tags = ["mega front-matter", "keys", "collection", "concatenation", "merging"]
-categories = ["cat1", "cat2"]
-videos = ["video 1", "video 2"]
+author = [ "firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3" ]
+aliases = [ "/posts/keyword-concatenation", "/posts/keyword-merging" ]
+images = [ "image 1", "image 2" ]
+keywords = [ "keyword1", "keyword2", "three word keywords3" ]
+outputs = [ "html", "json" ]
+series = [ "series 1", "series 2" ]
+tags = [ "mega front-matter", "keys", "collection", "concatenation", "merging" 
]
+categories = [ "cat1", "cat2" ]
+videos = [ "video 1", "video 2" ]
 draft = false
 categories_weight = 999
 tags_weight = 88
@@ -762,44 +764,41 @@ mybaz = "zoo"
 alpha = 1
 beta = "two words"
 gamma = 10
-animals = ["dog", "cat", "penguin", "mountain gorilla"]
-strings-symbols = ["abc", "def", "two words"]
-integers = [123, -5, 17, 1_234]
-floats = [12.3, -5.0, -1.7e-05]
-booleans = [true, false]
-contributors = [
-  "Foo Bar ",
-  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
-]
+animals = [ "dog", "cat", "penguin", "mountain gorilla" ]
+strings-symbols = [ "abc", "def", "two words" ]
+integers = [ 123, -5, 17, 1234 ]
+floats = [ 12.3, -5.0, -1.7e-05 ]
+booleans = [ true, false ]
 [dog]
   legs = 4
   e

[elpa] externals/tomelr 41ccea4ebe 64/84: refactor: Remove unnecessary tomelr-encode-keyword

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 41ccea4ebe0619bd6d38d3d8c2174e0b27587df0
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor: Remove unnecessary tomelr-encode-keyword

Also, The "keyword" term was confusing here; "boolean" makes more
sense.
---
 tomelr.el | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index e84c96b10d..434a67885f 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -113,19 +113,13 @@ This macro sets up appropriate variable bindings for
 
 ;;; Encoding
 
- Keywords
-(defun tomelr-encode-keyword (keyword)
-  "Encode KEYWORD as a TOML value."
-  (declare (side-effect-free t))
-  ;; (message "[tomelr-encode-keyword DBG] keyword = %S" keyword)
-  (cond ((eq keyword t)"true")
-((member keyword tomelr-false) "false")))
-
-(defun tomelr--print-keyword (keyword)
-  "Insert KEYWORD as a TOML value at point.
-Return nil if KEYWORD is not recognized as a TOML keyword."
-  (prog1 (setq keyword (tomelr-encode-keyword keyword))
-(and keyword (insert keyword
+ Booleans
+(defun tomelr--print-boolean (object)
+  "Insert TOML boolean true or false at point if OBJECT is a boolean.
+Return nil if OBJECT is not recognized as a TOML boolean."
+  (prog1 (setq object (cond ((eq object t) "true")
+((member object tomelr-false) "false")))
+(and object (insert object
 
  Strings
 (defun tomelr--print-string (string &optional type)
@@ -368,7 +362,7 @@ ARRAY can also be a list."
 (defun tomelr--print (object)
   "Insert a TOML representation of OBJECT at point.
 See `tomelr-encode' that returns the same as a string."
-  (cond ((tomelr--print-keyword object))
+  (cond ((tomelr--print-boolean object))
 ((listp object) (tomelr--print-list object))
 ((tomelr--print-stringlike object))
 ((numberp object)   (prin1 object))



[elpa] externals/tomelr c0962ba15f 33/84: fix: Don't run plist to TOML conversion test on emacs 26.3 and older

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit c0962ba15f0cf7ff944e822f623b2800b5ebfd73
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Don't run plist to TOML conversion test on emacs 26.3 and older
---
 test/tplist.el | 41 ++---
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/test/tplist.el b/test/tplist.el
index db2e7152c2..844ec11101 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -24,22 +24,25 @@
 ;;; Code:
 (require 'tomelr)
 
+;; The plist conversion to TOML fails on emacs 26.3 and older
+;; versions.
+(unless (version< emacs-version "27")
  S-exp objects as plists
-(ert-deftest test-plist ()
-  (let ((inp '((:int 123
-:remove_this_key  nil
-:str "abc"
-:bool_false :false
-:bool_true t
-:int_list (1 2 3)
-:str_list ("a" "b" "c")
-:bool_list (t :false t :false)
-:list_of_lists [(1 2) (3 4 5)]
-;; TODO plist specification of TOML tables is not yet 
supported.
-;; :map (:key1 123
-;;   :key2 "xyz")
-)))
-(ref '("int = 123
+  (ert-deftest test-plist ()
+(let ((inp '((:int 123
+  :remove_this_key  nil
+  :str "abc"
+  :bool_false :false
+  :bool_true t
+  :int_list (1 2 3)
+  :str_list ("a" "b" "c")
+  :bool_list (t :false t :false)
+  :list_of_lists [(1 2) (3 4 5)]
+  ;; TODO plist specification of TOML tables is not yet 
supported.
+  ;; :map (:key1 123
+  ;;   :key2 "xyz")
+  )))
+  (ref '("int = 123
 str = \"abc\"
 bool_false = false
 bool_true = true
@@ -47,10 +50,10 @@ int_list = [ 1, 2, 3 ]
 str_list = [ \"a\", \"b\", \"c\" ]
 bool_list = [ true, false, true, false ]
 list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]"))
-out)
-(dolist (el inp)
-  (push (tomelr-encode el) out))
-(should (equal ref (nreverse out)
+  out)
+  (dolist (el inp)
+(push (tomelr-encode el) out))
+  (should (equal ref (nreverse out))
 
 
 (provide 'tplist)



[elpa] externals/tomelr 91800b26b8 21/84: feat: Recognize RFC 3339 formatted date-time + offset

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 91800b26b8bff6b89fce887fbcadb9e956f412dd
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Recognize RFC 3339 formatted date-time + offset
---
 README.org  | 17 -
 test/tscalar.el | 14 ++
 tomelr.el   | 22 ++
 3 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/README.org b/README.org
index 757e641f7b..5f1db7d305 100644
--- a/README.org
+++ b/README.org
@@ -18,15 +18,15 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [0/6]
-- [-] Scalar
+* Library Completion Status [1/7]
+- [X] Scalar
   - [X] Boolean
   - [X] Integer
   - [X] Float
   - [X] String
   - [X] Date
-  - [ ] Date + Time with Offset
-  - [ ] Nil
+  - [X] Date + Time with Offset
+- [ ] Nil
 - [ ] Arrays
 - [ ] Array of Arrays
 - [ ] Tables
@@ -208,7 +208,8 @@ ld1 = 1979-05-27
 : {
 :   "ld1": "1979-05-27"
 : }
-*** Date + Time with Offset
+*** DONE Date + Time with Offset
+CLOSED: [2022-04-28 Thu 22:55]
 https://toml.io/en/v1.0.0#offset-date-time
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref scalar-odt
@@ -217,6 +218,12 @@ https://toml.io/en/v1.0.0#offset-date-time
   (odt3 . "1979-05-27T00:32:00.99-07:00"))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 odt1 = 1979-05-27T07:32:00Z
 odt2 = 1979-05-27T00:32:00-07:00
diff --git a/test/tscalar.el b/test/tscalar.el
index 12ebb081fa..bddb946414 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -99,6 +99,20 @@ Violets are blue\"\"\""
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Scalar - Date + Time
+(ert-deftest test-scalar-date-time ()
+  (let ((inp '(((odt1 . "1979-05-27T07:32:00Z"))
+   ((odt2 . "1979-05-27 07:32:00Z"))
+   ((odt3 . "1979-05-27T00:32:00-07:00"))
+   ((odt4 . "1979-05-27T00:32:00.99+04:00"
+(ref '("odt1 = 1979-05-27T07:32:00Z"
+   "odt2 = 1979-05-27 07:32:00Z"
+   "odt3 = 1979-05-27T00:32:00-07:00"
+   "odt4 = 1979-05-27T00:32:00.99+04:00"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
 
 
 (provide 'tscalar)
diff --git a/tomelr.el b/tomelr.el
index 28cf4b242d..341417f53c 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -153,10 +153,11 @@ If TRIM-INIT-CHARS is positive, those many initial 
characters
 of the STRING are not inserted.
 
 Return the same STRING passed as input."
+  ;; (message "[tomelr--print-string DBG] string = `%s'" string)
   (let ((special-chars '((?b . ?\b) ;U+0008
  (?f . ?\f) ;U+000C
  (?\\ . ?\\)))
-special-chars-re
+(special-chars-re (rx (in ?\" ?\\ cntrl ?\u007F))) ;cntrl is same as 
(?\u . ?\u001F)
 begin-q end-q)
 (cond
  ((string-match-p tomelr--date-time-regexp string)) ;RFC 3339 formatted 
date-time with offset
@@ -176,26 +177,23 @@ Return the same STRING passed as input."
   (setq begin-q "\"\"\"\n")
   (setq end-q "\"\"\""))
  (t ;Basic quotation "STRING"
-  (setq special-chars-re (rx (in ?\" ?\\ cntrl ?\u007F))) ;cntrl is same 
as (?\u . ?\u001F)
   (push '(?\" . ?\") special-chars)
   (push '(?t . ?\t) special-chars) ;U+0009
   (push '(?n . ?\n) special-chars) ;U+000A
   (push '(?r . ?\r) special-chars) ;U+000D
   (setq begin-q "\"")
   (setq end-q begin-q)))
-;; (message "[tomelr--print-string DBG] string = `%s'" string)
 (and begin-q (insert begin-q))
 (goto-char (prog1 (point) (princ string)))
 (and trim-init-chars (delete-char trim-init-chars))
-(when special-chars-re
-  (while (re-search-forward special-chars-re nil :noerror)
-(let ((char (preceding-char)))
-  (delete-char -1)
-  (insert ?\\ (or
-   ;; Escape special characters
-   (car (rassq char special-chars))
-   ;; Fallback: UCS code point in \u form.
-   (format "u%04x" char))
+(while (re-search-forward special-chars-re nil :noerror)
+  (let ((char (preceding-char)))
+(delete-char -1)
+(insert ?\\ (or
+ ;; Escape special characters
+ (car (rassq char special-chars))
+ ;; Fallback: UCS code point in \u form.
+ (format "u%04x" char)
 (and end-q (insert end-q))
 string))
 



[elpa] externals/tomelr ec381fd723 79/84: fix: Auto-stringify and auto-quote symbol values

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ec381fd723c9801caa2353a40d41e8cc8096ea29
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Auto-stringify and auto-quote symbol values
---
 test/tscalar.el |  16 +++--
 tomelr.el   | 108 
 2 files changed, 75 insertions(+), 49 deletions(-)

diff --git a/test/tscalar.el b/test/tscalar.el
index cb93af2c27..d8002e7de1 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -84,7 +84,6 @@
((string3 . "\"Hello!\"")) ;Quote in string
((string4 . "Line 1\n\nLine 3\n\n  Line 5 with 2 space 
indentation\n\nLine 7")) ;Blank lines in string
((audio . "audio path with space.mp3")) ;String with 
non-alphameric chars like space and period
-   ((version . 1.10.1))
))
 (ref '(
"string1 = \"Roses are red\""
@@ -102,7 +101,6 @@ Line 3
 
 Line 7\"\"\""
"audio = \"audio path with space.mp3\""
-   "version = \"1.10.1\""
))
 out)
 (dolist (el inp)
@@ -133,5 +131,19 @@ Line 7\"\"\""
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+(ert-deftest test-scalar-auto-quote ()
+  (let ((inp '(
+   ((key . 1.10.1))
+   ((key . foo))
+   ))
+(ref '(
+   "key = \"1.10.1\""
+   "key = \"foo\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'tscalar)
diff --git a/tomelr.el b/tomelr.el
index 35cfd1f142..5f768c13d9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -139,13 +139,9 @@ Return nil if OBJECT is not recognized as a TOML boolean."
 (and object (insert object
 
  Strings
-(defun tomelr--print-string (string &optional type)
+(defun tomelr--print-string (string)
   "Insert a TOML representation of STRING at point.
 
-Optional TYPE arg gives more information about the input STRING.
-For example, if the string is the name of a TOML key, it will be
-set to `keyword'.
-
 Return the same STRING passed as input."
   ;; (message "[tomelr--print-string DBG] string = `%s'" string)
   (let ((special-chars '((?b . ?\b) ;U+0008
@@ -154,9 +150,6 @@ Return the same STRING passed as input."
 (special-chars-re (rx (in cntrl ?\u007F)))
 begin-q end-q)
 (cond
- ;; plist keywords, normal keys, table keys, table-array keys
- (type)
- ((string-match-p tomelr--date-time-regexp string)) ;RFC 3339 formatted 
date-time with offset
  ;; Use multi-line string quotation if the string contains a "
  ;; char or a newline - """STRING""", and only if the string
  ;; doesn't have a "key type".
@@ -194,44 +187,59 @@ Return the same STRING passed as input."
 (and end-q (insert end-q))
 string))
 
-(defun tomelr--print-stringlike (object &optional type)
+(defun tomelr--quote-string-maybe (str)
+  "Return STR wrapped in quotes if it's not already."
+  (let ((quoted-str (or str "")))
+(unless (or ;; RFC 3339 formatted date-time with offset.
+ (string-match-p tomelr--date-time-regexp str)
+ ;; str is already wrapped with quotes.
+ (and (string= (substring str 0 1) "\"")
+  (string= (substring str -1) "\"")))
+  (setq quoted-str (format "\"%s\"" quoted-str)))
+quoted-str))
+
+(defun tomelr--print-stringlike (object &optional key-type)
   "Insert OBJECT encoded as a TOML string at point.
 
-Possible values of TYPE are `normal-key', `table-key',
-`table-array-key', `keyword', or nil.
+Possible values of KEY-TYPE are `normal-key', `table-key',
+`table-array-key', or nil.
 
 Return nil if OBJECT cannot be encoded as a TOML string."
-  ;; (message "[tomelr--print-stringlike DBG] object = %S" object)
-  (let ((sym-name (cond ((and type (stringp object))
- ;; https://toml.io/en/v1.0.0#keys
- ;; Bare keys may only contain ASCII letters, ASCII 
digits,
- ;; underscores, and dashes (A-Za-z0-9_-).
- (if (string-match-p "\\`[A-Za-z0-9_-]+\\'" object)
- object
-   ;; Wrap string in double-quotes if it
-   ;; doesn't contain only A-Za-z0-9_- chars.
-   (format "\"%s\"" object)))
-((and (null type) (stringp object))
- object)
-;; Symbol beginning with `:', like `:some_key'
-((keywordp object)
- (string-trim-left (symbol-name object) ":"))
-((symbolp object)
- (let ((str (symbol-name object)))
-   (unless (or ;; RFC 3339 formatted date-time with 
offset
-   (string-match-p 
tomelr--date-time-regexp str)

[elpa] externals/tomelr 10a1994aed 51/84: feat: Support (lightly tested) nested TOML Table Arrays

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 10a1994aedcbd95c35096b257cf1e9e6fd4554cb
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Support (lightly tested) nested TOML Table Arrays
---
 README.org   | 14 --
 test/ttable-array.el | 40 
 tomelr.el| 23 +++
 3 files changed, 43 insertions(+), 34 deletions(-)

diff --git a/README.org b/README.org
index e44d71aea8..7a03d4bd7d 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [5/7]
+* Library Completion Status [6/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -32,9 +32,9 @@ specification defined below.
 - [X] Tables
   - [X] Basic Tables
   - [X] Nested Tables
-- [-] Array of Tables
+- [X] Array of Tables
   - [X] Basic Array of Tables
-  - [ ] Nested Array of Tables
+  - [X] Nested Array of Tables
 - [ ] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
@@ -567,7 +567,8 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   ]
 }
 #+end_example
-*** Nested Array of Tables
+*** DONE Nested Array of Tables
+CLOSED: [2022-04-30 Sat 01:32]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref nested-table-arrays
 '((fruits . (((name . "apple")
@@ -584,13 +585,14 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   <>)
 #+end_src
 
+#+RESULTS:
 #+begin_src toml
 [[fruits]]
   name = "apple"
-  [fruits.physical]  # subtable
+  [fruits.physical]
 color = "red"
 shape = "round"
-  [[fruits.varieties]]  # nested array of tables
+  [[fruits.varieties]]
 name = "red delicious"
   [[fruits.varieties]]
 name = "granny smith"
diff --git a/test/ttable-array.el b/test/ttable-array.el
index 7247f9d132..2b3deb3851 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -86,13 +86,13 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
((fruits . (((name . "apple")
 (varieties . (((name . "red delicious"))
   ((name . "granny smith"
-   ;; ((fruits . (((name . "apple")
-   ;;  (physical . ((color . "red")
-   ;;   (shape . "round")))
-   ;;  (varieties . (((name . "red delicious"))
-   ;;((name . "granny smith")
-   ;; ((name . "banana")
-   ;;  (varieties . (((name . "plantain"
+   ((fruits . (((name . "apple")
+(physical . ((color . "red")
+ (shape . "round")))
+(varieties . (((name . "red delicious"))
+  ((name . "granny smith")
+   ((name . "banana")
+(varieties . (((name . "plantain"
))
 (ref '(
"[[fruits]]
@@ -106,19 +106,19 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
 name = \"red delicious\"
   [[fruits.varieties]]
 name = \"granny smith\""
-   ;; "[[fruits]]
-   ;; name = \"apple\"
-   ;; [fruits.physical]
-   ;; color = \"red\"
-   ;; shape = \"round\"
-   ;; [[fruits.varieties]]
-   ;; name = \"red delicious\"
-   ;; [[fruits.varieties]]
-   ;; name = \"granny smith\"
-   ;; [[fruits]]
-   ;; name = \"banana\"
-   ;; [[fruits.varieties]]
-   ;; name = \"plantain\""
+   "[[fruits]]
+  name = \"apple\"
+  [fruits.physical]
+color = \"red\"
+shape = \"round\"
+  [[fruits.varieties]]
+name = \"red delicious\"
+  [[fruits.varieties]]
+name = \"granny smith\"
+[[fruits]]
+  name = \"banana\"
+  [[fruits.varieties]]
+name = \"plantain\""
))
 out)
 (dolist (el inp)
diff --git a/tomelr.el b/tomelr.el
index 0c97552b62..4611a92b31 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -58,9 +58,6 @@ Dictates repetitions of 
`tomelr-encoding-default-indentation'.")
 This variable is used for both TOML Tables and Arrays of TOML
 Tables.")
 
-(defvar tomelr--print-table-array-key ""
-  "Internal variable used to save the TOML Table Array name.")
-
 (defvar tomelr--print-keyval-separator " = "
   "String used to separate key-value pairs during encoding.")
 
@@ -242,9 +239,7 @@ Return nil if OBJECT cannot be encoded as a TOML string."
  ((equal type 'table)
   (princ (format "[%s]" (string-join tomelr--

[elpa] externals/tomelr ae983711be 78/84: fix: Auto-stringify symbols like 1.10.1

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ae983711be15d95abd22ae4d7b8c116031de60a0
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Auto-stringify symbols like 1.10.1
---
 test/tscalar.el |  4 
 tomelr.el   | 11 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/tscalar.el b/test/tscalar.el
index e6ede6d85a..cb93af2c27 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -83,6 +83,8 @@
((string2 . "Roses are red\nViolets are blue")) ;Newline in 
string
((string3 . "\"Hello!\"")) ;Quote in string
((string4 . "Line 1\n\nLine 3\n\n  Line 5 with 2 space 
indentation\n\nLine 7")) ;Blank lines in string
+   ((audio . "audio path with space.mp3")) ;String with 
non-alphameric chars like space and period
+   ((version . 1.10.1))
))
 (ref '(
"string1 = \"Roses are red\""
@@ -99,6 +101,8 @@ Line 3
   Line 5 with 2 space indentation
 
 Line 7\"\"\""
+   "audio = \"audio path with space.mp3\""
+   "version = \"1.10.1\""
))
 out)
 (dolist (el inp)
diff --git a/tomelr.el b/tomelr.el
index 3a93c750c8..35cfd1f142 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -201,6 +201,7 @@ Possible values of TYPE are `normal-key', `table-key',
 `table-array-key', `keyword', or nil.
 
 Return nil if OBJECT cannot be encoded as a TOML string."
+  ;; (message "[tomelr--print-stringlike DBG] object = %S" object)
   (let ((sym-name (cond ((and type (stringp object))
  ;; https://toml.io/en/v1.0.0#keys
  ;; Bare keys may only contain ASCII letters, ASCII 
digits,
@@ -216,7 +217,15 @@ Return nil if OBJECT cannot be encoded as a TOML string."
 ((keywordp object)
  (string-trim-left (symbol-name object) ":"))
 ((symbolp object)
- (symbol-name object)
+ (let ((str (symbol-name object)))
+   (unless (or ;; RFC 3339 formatted date-time with 
offset
+   (string-match-p 
tomelr--date-time-regexp str)
+   (string-match-p "\\`[A-Za-z0-9_-]+\\'" 
str))
+ ;; Wrap string in double-quotes if it's
+ ;; neither a date-time symbol not
+ ;; contains only A-Za-z0-9_- chars.
+ (setq str (format "\"%s\"" str)))
+   str)
 (when (member type '(table-key table-array-key))
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
   ;;  object type tomelr--print-indentation-depth)



[elpa] externals/tomelr 406f4922a8 58/84: test: Add tests for json.el functions used in tomelr

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 406f4922a8677f07d14190d48061ae60169825d5
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add tests for json.el functions used in tomelr
---
 test/all-tests.el   |  1 +
 test/tjson-utils.el | 81 +
 2 files changed, 82 insertions(+)

diff --git a/test/all-tests.el b/test/all-tests.el
index 45c5442ab4..adab51f609 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -21,6 +21,7 @@
 
 (setq load-prefer-newer t)
 
+(require 'tjson-utils)
 (require 'tinternal)
 
 (require 'tscalar)
diff --git a/test/tjson-utils.el b/test/tjson-utils.el
new file mode 100644
index 00..4cf6e9d2e5
--- /dev/null
+++ b/test/tjson-utils.el
@@ -0,0 +1,81 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Tests for json.el functions used in tomelr.
+
+;;; Code:
+(require 'tomelr)
+
+ json-alist-p (TOML Tables)
+(ert-deftest test-internal-json-alist-p-true ()
+  (let ((inp '(
+   ((a . 1))
+   ((a . 1) (b . 2))
+   ;; Nested TT
+   ((a . 1)
+(b . ((c . 3)
+  (d . 4
+   ;; Nested TTA
+   ((a . 1)
+(b . (((c . 3))
+  ((c . 300)
+   )))
+(dolist (el inp)
+  (should (equal t (json-alist-p el))
+
+(ert-deftest test-internal-json-alist-p-false ()
+  (let ((inp '(
+   (a 1)
+   ;; FIXME: `json-alist-p' returns non-nil for below TTA as well.
+   ;; ((:a 1));This is an array of TOML table
+   (((a . 1))) ;This is an array of TOML table
+   )))
+(dolist (el inp)
+  (should (equal nil (json-alist-p el))
+
+ json-plist-p (TOML Tables)
+(ert-deftest test-internal-json-plist-p-true ()
+  (let ((inp '(
+   (:a 1)
+   (:a 1 :b 2)
+   ;; Nested TT
+   (:a 1
+:b (:c 3
+:d 4))
+   ;; Nested TTA
+   (:a 1
+:b ((:c 3)
+(:c 300)))
+   )))
+(dolist (el inp)
+  (should (equal t (json-plist-p el))
+
+(ert-deftest test-internal-json-plist-p-false ()
+  (let ((inp '(
+   (a 1)
+   ((:a 1));This is an array of TOML table
+   (((a . 1))) ;This is an array of TOML table
+   )))
+(dolist (el inp)
+  (should (equal nil (json-plist-p el))
+
+
+(provide 'tjson-utils)



[elpa] externals/tomelr 334b7cba54 76/84: refactor: Don't attempt to triple-quote TOML keys

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 334b7cba54001708e6819b9df0abf0c553c0d0a2
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor: Don't attempt to triple-quote TOML keys

Triple-quote only when the `type' input of `tomelr--print-stringlike'
is nil.
---
 tomelr.el | 53 +
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 08f877d562..858da82d89 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -148,17 +148,18 @@ set to `keyword'.
 
 Return the same STRING passed as input."
   ;; (message "[tomelr--print-string DBG] string = `%s'" string)
-  (setq string (string-trim string "\"" "\""))
   (let ((special-chars '((?b . ?\b) ;U+0008
  (?f . ?\f) ;U+000C
  (?\\ . ?\\)))
-(special-chars-re (rx (in ?\" ?\\ cntrl ?\u007F))) ;cntrl is same as 
(?\u . ?\u001F)
+(special-chars-re (rx (in cntrl ?\u007F)))
 begin-q end-q)
 (cond
- ((equal type 'keyword))
+ ;; plist keywords, normal keys, table keys, table-array keys
+ (type)
  ((string-match-p tomelr--date-time-regexp string)) ;RFC 3339 formatted 
date-time with offset
- ;; Use multi-line string quotation if the string contains a " char
- ;; or a newline - """STRING"""
+ ;; Use multi-line string quotation if the string contains a "
+ ;; char or a newline - """STRING""", and only if the string
+ ;; doesn't have a "key type".
  ((string-match-p "\n\\|\"" string)
   ;; From https://toml.io/en/v1.0.0#string, Any Unicode
   ;; character may be used except those that must be escaped:
@@ -173,6 +174,7 @@ Return the same STRING passed as input."
   (setq begin-q "\"\"\"\n")
   (setq end-q "\"\"\""))
  (t ;Basic quotation "STRING"
+  (setq special-chars-re (rx (in ?\" ?\\ cntrl ?\u007F))) ;cntrl is same 
as (?\u . ?\u001F)
   (push '(?\" . ?\") special-chars)
   (push '(?t . ?\t) special-chars) ;U+0009
   (push '(?n . ?\n) special-chars) ;U+000A
@@ -195,10 +197,11 @@ Return the same STRING passed as input."
 (defun tomelr--print-stringlike (object &optional type)
   "Insert OBJECT encoded as a TOML string at point.
 
-Possible value of TYPE are `table', `table-array' or nil.
+Possible values of TYPE are `normal-key', `table-key',
+`table-array-key', `keyword', or nil.
 
 Return nil if OBJECT cannot be encoded as a TOML string."
-  (let ((sym-name (cond ((stringp object)
+  (let ((sym-name (cond ((and type (stringp object))
  ;; https://toml.io/en/v1.0.0#keys
  ;; Bare keys may only contain ASCII letters, ASCII 
digits,
  ;; underscores, and dashes (A-Za-z0-9_-).
@@ -207,12 +210,14 @@ Return nil if OBJECT cannot be encoded as a TOML string."
;; Wrap string in double-quotes if it
;; doesn't contain only A-Za-z0-9_- chars.
(format "\"%s\"" object)))
+((and (null type) (stringp object))
+ object)
 ;; Symbol beginning with `:', like `:some_key'
 ((keywordp object)
  (string-trim-left (symbol-name object) ":"))
 ((symbolp object)
  (symbol-name object)
-(when type
+(when (member type '(table-key table-array-key))
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
   ;;  object type tomelr--print-indentation-depth)
   (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
@@ -230,26 +235,27 @@ Return nil if OBJECT cannot be encoded as a TOML string."
   ;;  tomelr--print-table-hierarchy)
   )
 (cond
- ((equal type 'table)
+ ((equal type 'table-key)
   (princ (format "[%s]" (string-join tomelr--print-table-hierarchy "."
- ((equal type 'table-array)
+ ((equal type 'table-array-key)
   (princ (format "[[%s]]" (string-join tomelr--print-table-hierarchy 
"."
  ((stringp object)
   ;; (message "[tomelr--print-stringlike DBG] %S is string" object)
-  (tomelr--print-string sym-name))
+  (tomelr--print-string sym-name type))
  ((keywordp object)
   ;; (message "[tomelr--print-stringlike DBG] %S is keyword" object)
   (tomelr--print-string sym-name 'keyword))
  (sym-name
   (princ sym-name)
 
-(defun tomelr--print-key (key &optional type)
+(defun tomelr--print-key (key &optional key-type)
   "Insert a TOML key representation of KEY at point.
 
-TYPE is set to `table' if KEY is a TOML Table key.
+KEY-TYPE represents the type of key: `normal-key', `table-key' or
+`table-array-key'.
 
 Signal `tomelr-key-format' if it cannot be encoded as a string."
-  (or (tomelr--print-stringlike key type)
+  (or (tomelr--

[elpa] externals/tomelr 3c068fb9d9 34/84: refactor: Move TOML Table detection logic to a separate fn

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 3c068fb9d9319d2876de359d2bc9068b857e091b
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor: Move TOML Table detection logic to a separate fn
---
 tomelr.el | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index fca625c9f0..99fc776d99 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -249,20 +249,21 @@ Signal `tomelr-key-format' if it cannot be encoded as a 
string."
   (signal 'tomelr-key-format (list key
 
  Objects
+(defun tomelr--toml-table-p (object)
+  "Return non-nil if OBJECT can represent a TOML Table."
+  ;; TODO: Need to find a robust way of detecting TOML tables.
+  ;; (message "[tomelr--print-pair DBG] object type = %S" (type-of object))
+  (and (mapp object)
+   (consp object) ;  object = ((KEY . VAL)) <- cons
+   (consp (car object ;(car object) =  (KEY . VAL)  <- also cons
+
 (defun tomelr--print-pair (key val)
   "Insert TOML representation of KEY - VAL pair at point."
   (let ((type (cond
-   ;; TODO: Need to find a robust way of detecting TOML tables.
-   ((and (mapp val)
- (consp val)   ;  val = ((KEY . VAL)) <- cons
- (consp (car val)) ;(car val) = (KEY . VAL)   <- also cons
- )
-'table)
-   (t
-nil
+   ((tomelr--toml-table-p val) 'table)
+   (t nil
 ;; (message "[tomelr--print-pair DBG] key = %S, val = %S, type = %S"
 ;;  key val type)
-;; (message "[tomelr--print-pair DBG] val type = %S" (type-of val))
 (when val ;Don't print the key if val is nil
   (tomelr--print-indentation) ;Newline before each key in a key-value pair
   (tomelr--print-key key type)



[elpa] externals/tomelr a1f434f03a 31/84: feat: Support nested TOML tables

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a1f434f03a761c50cd9813e27d5441d6b2c2902d
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Support nested TOML tables
---
 README.org | 15 +++
 test/ttable.el | 18 ++
 tomelr.el  | 30 --
 3 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index 2acd5d41be..6a43d4df76 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [4/7]
+* Library Completion Status [5/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -29,9 +29,9 @@ specification defined below.
 - [X] Nil
 - [X] Arrays
 - [X] Array of Arrays
-- [-] Tables
+- [X] Tables
   - [X] Basic Tables
-  - [ ] Nested Tables
+  - [X] Nested Tables
 - [ ] Array of Tables
   - [ ] Basic Array of Tables
   - [ ] Nested Array of Tables
@@ -436,7 +436,8 @@ CLOSED: [2022-04-29 Fri 13:41]
   }
 }
 #+end_example
-*** Nested TOML Tables
+*** DONE Nested TOML Tables
+CLOSED: [2022-04-29 Fri 14:30]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref nested-tables
 '((table-1 . ((table-1a . ((key1 . "some string")
@@ -445,6 +446,12 @@ CLOSED: [2022-04-29 Fri 13:41]
(key2 . 98765))
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
 [table-1]
   [table-1.table-1a]
diff --git a/test/ttable.el b/test/ttable.el
index fdcafa87f4..3898b187cd 100644
--- a/test/ttable.el
+++ b/test/ttable.el
@@ -41,5 +41,23 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Nested tables
+(ert-deftest test-nested-table ()
+  (let ((inp '(((table-1 . ((table-1a . ((key1 . "some string")
+ (key2 . 123)))
+(table-1b . ((key1 . "foo")
+ (key2 . 98765
+(ref '("[table-1]
+  [table-1.table-1a]
+key1 = \"some string\"
+key2 = 123
+  [table-1.table-1b]
+key1 = \"foo\"
+key2 = 98765"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'ttable)
diff --git a/tomelr.el b/tomelr.el
index 4cbfbe45dc..55b3b07d73 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -52,6 +52,9 @@ ordered alphabetically.")
   "Current indentation level during encoding.
 Dictates repetitions of `tomelr-encoding-default-indentation'.")
 
+(defvar tomelr--print-table-hierarchy ()
+  "Internal variable used to save the TOML table hierarchy.")
+
 (defvar tomelr--print-keyval-separator " = "
   "String used to separate key-value pairs during encoding.")
 
@@ -211,12 +214,27 @@ Return nil if OBJECT cannot be encoded as a TOML string."
  ;; (message "[tomelr--print-stringlike DBG] %S is keyword" object)
  (tomelr--print-string (symbol-name object) 1))
 ((symbolp object)
- ;; (message "[tomelr--print-stringlike DBG] %S is symbol" object)
- (cond
-  ((equal type 'table)
-   (princ (format "[%s]" (symbol-name object
-  (t
-   (princ (symbol-name object)))
+ (let ((sym-name (symbol-name object)))
+   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = 
%S, depth = %d"
+   ;;  object type tomelr--print-indentation-depth)
+   (cond
+((equal type 'table)
+ (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
+ (progn
+   (push sym-name tomelr--print-table-hierarchy)
+   (setq tomelr--print-table-hierarchy (nreverse 
tomelr--print-table-hierarchy)))
+   ;; Throw away table keys collected at higher depths, if
+   ;; any, from earlier runs of this function.
+   (setq tomelr--print-table-hierarchy
+ (seq-take tomelr--print-table-hierarchy
+   (1+ tomelr--print-indentation-depth)))
+   (setf (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy)
+ sym-name))
+ ;; (message "[tomelr--print-stringlike DBG] table hier: %S"
+ ;;  tomelr--print-table-hierarchy)
+ (princ (format "[%s]" (string-join tomelr--print-table-hierarchy 
"."
+(t
+ (princ sym-name)))
 
 (defun tomelr--print-key (key &optional type)
   "Insert a TOML key representation of KEY at point.



[elpa] externals/tomelr ebe5959174 75/84: feat: Auto-coerce string to boolean

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ebe5959174812ffc3cf7d88040b854599b15a88a
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Auto-coerce string to boolean
---
 test/all-tests.el |  1 +
 test/tcoerce.el   | 59 +++
 tomelr.el | 23 +++---
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/test/all-tests.el b/test/all-tests.el
index c25fd78e48..03f614f844 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -31,3 +31,4 @@
 (require 'ttable)
 (require 'ttable-array)
 (require 'tplist)
+(require 'tcoerce)
diff --git a/test/tcoerce.el b/test/tcoerce.el
new file mode 100644
index 00..4e10dd7714
--- /dev/null
+++ b/test/tcoerce.el
@@ -0,0 +1,59 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Test type coercing from strings.
+
+;;; Code:
+(require 'tomelr)
+
+ Boolean Coercing
+(ert-deftest test-coerce-boolean-yes ()
+  (let ((tomelr-coerce-to-types '(boolean))
+(inp '(
+   ((key1 . "true"))
+   ((key2 . "false"))
+   ))
+(ref '(
+   "key1 = true"
+   "key2 = false"
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+(ert-deftest test-coerce-boolean-no ()
+  (let ((tomelr-coerce-to-types '())
+(inp '(
+   ((key1 . "true"))
+   ((key2 . "false"))
+   ))
+(ref '(
+   "key1 = \"true\""
+   "key2 = \"false\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tcoerce)
diff --git a/tomelr.el b/tomelr.el
index c9a0694ced..08f877d562 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -35,13 +35,22 @@
 
 ;;; Variables
 
-(defvar tomelr-false '(:false 'false "false")
+(defvar tomelr-false '(:false 'false)
   "S-exp values to be interpreted as TOML `false'.")
 
 (defvar tomelr-encoding-default-indentation "  "
   "String used for a single indentation level during encoding.
 This value is repeated for each further nested element.")
 
+(defvar tomelr-coerce-to-types '(boolean)
+  "List of TOML types to which the TOML strings will be attempted to be 
coerced.
+
+Valid symbols that can be present in this list: boolean, integer, float
+
+For example, if this list contains `boolean' and if a string
+value is exactly \"true\", it will coerce to TOML boolean
+`true'.")
+
  Internal Variables
 (defvar tomelr--print-indentation-prefix "\n"
   "String used to start indentation during encoding.")
@@ -117,8 +126,16 @@ This macro sets up appropriate variable bindings for
 (defun tomelr--print-boolean (object)
   "Insert TOML boolean true or false at point if OBJECT is a boolean.
 Return nil if OBJECT is not recognized as a TOML boolean."
-  (prog1 (setq object (cond ((eq object t) "true")
-((member object tomelr-false) "false")))
+  (prog1 (setq object (cond ((or
+  (eq object t)
+  (and (member 'boolean tomelr-coerce-to-types)
+   (equal object "true")))
+ "true")
+((or
+  (member object tomelr-false)
+  (and (member 'boolean tomelr-coerce-to-types)
+   (equal object "false")))
+ "false")))
 (and object (insert object
 
  Strings



[elpa] externals/tomelr cff1f8aa89 38/84: fix: Support TOML tables arrays specified as plist vector

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit cff1f8aa890d8c08fe26243870d59aa39f602156
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Support TOML tables arrays specified as plist vector
---
 README.org |  7 ---
 test/tplist.el | 19 +++
 tomelr.el  |  2 +-
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/README.org b/README.org
index 18d1b37754..ffac82b330 100644
--- a/README.org
+++ b/README.org
@@ -18,7 +18,7 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
-* Library Completion Status [5/7]
+* Library Completion Status [6/7]
 - [X] Scalar
   - [X] Boolean
   - [X] Integer
@@ -35,7 +35,7 @@ specification defined below.
 - [-] Array of Tables
   - [X] Basic Array of Tables
   - [ ] Nested Array of Tables
-- [ ] Property Lists
+- [X] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
 
@@ -969,7 +969,8 @@ contributors = [
   ]
 }
 #+end_example
-** P-lists
+** DONE P-lists
+CLOSED: [2022-04-29 Fri 18:42]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref p-list
 '(:int 123
diff --git a/test/tplist.el b/test/tplist.el
index a8ebf8086f..6798e137cf 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -40,13 +40,10 @@
   :list_of_lists [(1 2) (3 4 5)]
   :map (:key1 123
 :key2 "xyz")
-  ;; TODO plist specification of TOML tables arrays is
-  ;; not yet supported.
-  ;; :list_of_maps [(:key1 123
-  ;; :key2 "xyz")
-  ;;(:key1 567
-  ;; :key2 "klm")]
-  )))
+  :list_of_maps [(:key1 123
+  :key2 "xyz")
+ (:key1 567
+  :key2 "klm")])))
   (ref '("int = 123
 str = \"abc\"
 bool_false = false
@@ -57,7 +54,13 @@ bool_list = [ true, false, true, false ]
 list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
 [map]
   key1 = 123
-  key2 = \"xyz\""))
+  key2 = \"xyz\"
+[[list_of_maps]]
+  key1 = 123
+  key2 = \"xyz\"
+[[list_of_maps]]
+  key1 = 567
+  key2 = \"klm\""))
   out)
   (dolist (el inp)
 (push (tomelr-encode el) out))
diff --git a/tomelr.el b/tomelr.el
index 2ba7549787..1e3a29baab 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -377,7 +377,7 @@ Definition of a TOML Table Array (TTA):
 
 - OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
   TOML Table (TT)."
-  (when (listp object)
+  (when (mapp object)
 (seq-every-p
  (lambda (elem)
(tomelr--toml-table-p elem))



[elpa] externals/tomelr c2d1328c44 80/84: fix: Boolean coercing when value is a symbol true or false

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit c2d1328c4404e6af920dc431ba57ee00eef4ba36
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Boolean coercing when value is a symbol true or false
---
 test/tcoerce.el | 4 
 tomelr.el   | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/tcoerce.el b/test/tcoerce.el
index 975f8625b8..9b5295adef 100644
--- a/test/tcoerce.el
+++ b/test/tcoerce.el
@@ -30,10 +30,12 @@
 (inp '(
((key1 . "true"))
((key2 . "false"))
+   ((key3 . (false true)))
))
 (ref '(
"key1 = true"
"key2 = false"
+   "key3 = [false, true]"
))
 out)
 (dolist (el inp)
@@ -45,10 +47,12 @@
 (inp '(
((key1 . "true"))
((key2 . "false"))
+   ((key3 . (false true)))
))
 (ref '(
"key1 = \"true\""
"key2 = \"false\""
+   "key3 = [\"false\", \"true\"]"
))
 out)
 (dolist (el inp)
diff --git a/tomelr.el b/tomelr.el
index 5f768c13d9..1bd2de3ead 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -129,12 +129,12 @@ Return nil if OBJECT is not recognized as a TOML boolean."
   (prog1 (setq object (cond ((or
   (eq object t)
   (and (member 'boolean tomelr-coerce-to-types)
-   (equal object "true")))
+   (member object '("true" true
  "true")
 ((or
   (member object tomelr-false)
   (and (member 'boolean tomelr-coerce-to-types)
-   (equal object "false")))
+   (member object '("false" false
  "false")))
 (and object (insert object
 



[elpa] externals/tomelr af40c0b40f 11/84: fix: Require subr-x for older Emacs versions

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit af40c0b40f8d3fe61ac711c00a32d6747d4e55e7
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Require subr-x for older Emacs versions
---
 tomelr.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tomelr.el b/tomelr.el
index 2a60f9d0e2..805dcdb8a9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -25,6 +25,7 @@
 ;;; Code:
 
 (require 'map)
+(require 'subr-x)  ;For `string-trim' on Emacs versions 27.2 and older
 
 
 ;;; Variables



[elpa] externals/tomelr 7cd15e79b8 10/84: tool(ci): Add GHA setup

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 7cd15e79b81697aa72a911fd48f3503e1cb16286
Author: Kaushal Modi 
Commit: Kaushal Modi 

tool(ci): Add GHA setup
---
 .github/workflows/test.yml | 36 
 1 file changed, 36 insertions(+)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00..cd1997b37d
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,36 @@
+name: RunTests
+
+on:
+  pull_request:
+types:
+  - '*'
+  push:
+branches:
+  - main
+  schedule:
+# Every week: https://crontab.guru/#0_0_*_*_0
+- cron: '0 0 * * 0'
+
+jobs:
+  run_tests:
+strategy:
+  fail-fast: false
+  matrix:
+os:
+  - 'ubuntu-latest'
+emacs_version:
+  - 'snapshot'
+  - '28.1'
+  - '27.2'
+  - '26.3'
+# runs-on: ubuntu-latest
+runs-on: ${{ matrix.os }}
+continue-on-error: ${{ matrix.emacs_version == 'snapshot' }}
+steps:
+  - uses: actions/checkout@v2
+  - uses: purcell/setup-emacs@master
+with:
+  version: ${{ matrix.emacs_version }}
+  - name: Run tests
+run: |
+  make --no-print-directory -j8 test



[elpa] externals/tomelr a676192b43 81/84: fix: Integer coercing of a number strings with underscores

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a676192b435474fbff53fe361dbf983e3b8ac799
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Integer coercing of a number strings with underscores
---
 test/tcoerce.el |  8 
 tomelr.el   | 64 ++---
 2 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/test/tcoerce.el b/test/tcoerce.el
index 9b5295adef..f2c91c3199 100644
--- a/test/tcoerce.el
+++ b/test/tcoerce.el
@@ -70,12 +70,16 @@
;; (fixnump (string-to-number "10040216507682529280")) ;=> nil
;; So this number won't be coerced.
((key . "10040216507682529280"))
+   ((key . ("123" "-5" "17" "1_234")))
+   ((key . (123 -5 17 1_234)))
))
 (ref '(
"key = -123"
"key = 0"
"key = 123"
"key = \"10040216507682529280\""
+   "key = [123, -5, 17, 1_234]"
+   "key = [123, -5, 17, 1_234]"
))
 out)
 (dolist (el inp)
@@ -87,10 +91,14 @@
 (inp '(
((key . "123"))
((key . "10040216507682529280"))
+   ((key . ("123" "-5" "17" "1_234")))
+   ((key . (123 -5 17 1_234)))
))
 (ref '(
"key = \"123\""
"key = \"10040216507682529280\""
+   "key = [\"123\", \"-5\", \"17\", \"1_234\"]"
+   "key = [123, -5, 17, 1_234]"
))
 out)
 (dolist (el inp)
diff --git a/tomelr.el b/tomelr.el
index 1bd2de3ead..650328e5ce 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -187,17 +187,6 @@ Return the same STRING passed as input."
 (and end-q (insert end-q))
 string))
 
-(defun tomelr--quote-string-maybe (str)
-  "Return STR wrapped in quotes if it's not already."
-  (let ((quoted-str (or str "")))
-(unless (or ;; RFC 3339 formatted date-time with offset.
- (string-match-p tomelr--date-time-regexp str)
- ;; str is already wrapped with quotes.
- (and (string= (substring str 0 1) "\"")
-  (string= (substring str -1) "\"")))
-  (setq quoted-str (format "\"%s\"" quoted-str)))
-quoted-str))
-
 (defun tomelr--print-stringlike (object &optional key-type)
   "Insert OBJECT encoded as a TOML string at point.
 
@@ -230,10 +219,10 @@ Return nil if OBJECT cannot be encoded as a TOML string."
 
   ;; Cases where object is a key value.
   ((symbolp object)
-   (tomelr--quote-string-maybe (symbol-name object)))
+   (symbol-name object))
   ((stringp object)
object
-
+;; (message "[tomelr--print-stringlike DBG] str = %S" str)
 (when (member key-type '(table-key table-array-key))
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
   ;;  object type tomelr--print-indentation-depth)
@@ -261,29 +250,34 @@ Return nil if OBJECT cannot be encoded as a TOML string."
  ;; Normal keys (Alist and Plist keys)
  ((equal key-type 'normal-key)
   (princ str))
- ;; Date/Time
- ((and (stringp object)
-   (string-match-p tomelr--date-time-regexp object))
-  (princ object))
+ ;; Coercing
+ ((and (stringp str)
+   (or
+;; RFC 3339 Date/Time
+(string-match-p tomelr--date-time-regexp str)
+
+;; Integer that can be stored in the system as a fixnum.
+;; For example, if `object' is "10040216507682529280" that
+;; needs more than 64 bits to be stored as a signed
+;; integer, it will be automatically stored as a float.
+;; So (integerp (string-to-number object)) will return nil
+;; [or `fixnump' instead of `integerp' in Emacs 27 or
+;; newer].
+;; https://github.com/toml-lang/toml#integer
+;; Integer examples: 7, +7, -7, 7_000
+(and (or (symbolp object)
+ (member 'integer tomelr-coerce-to-types))
+ (string-match-p "\\`[+-]?[[:digit:]_]+\\'" str)
+ (if (functionp #'fixnump) ;`fixnump' and `bignump' get 
introduced in Emacs 27.x
+ (fixnump (string-to-number str))
+   ;; On older Emacsen, `integerp' behaved the same as the
+   ;; new `fixnump'.
+   (integerp (string-to-number str))
+  (princ str))
+ ((symbolp object)
+  (princ (format "%S" str)))
  ((stringp object)
-  (cond
-   ;; If it an integer that can be stored in the system as a
-   ;; fixnum.  For example, if `object' is "10040216507682529280"
-   ;; that needs more than 64 bits to be stored as a signed
-   ;; integer, it will be automatically stored as a float.  So
-   ;; (integerp (string-to-number object)) will return nil [or
-   ;; `fixnump' instead

[elpa] externals/tomelr 4c419bcee2 37/84: fix: Support TOML tables specified as plists

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 4c419bcee218a95d6669a5b198d1b71f6a8e7691
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Support TOML tables specified as plists
---
 test/tplist.el | 16 +
 tomelr.el  | 76 +++---
 2 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/test/tplist.el b/test/tplist.el
index 844ec11101..a8ebf8086f 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -38,9 +38,14 @@
   :str_list ("a" "b" "c")
   :bool_list (t :false t :false)
   :list_of_lists [(1 2) (3 4 5)]
-  ;; TODO plist specification of TOML tables is not yet 
supported.
-  ;; :map (:key1 123
-  ;;   :key2 "xyz")
+  :map (:key1 123
+:key2 "xyz")
+  ;; TODO plist specification of TOML tables arrays is
+  ;; not yet supported.
+  ;; :list_of_maps [(:key1 123
+  ;; :key2 "xyz")
+  ;;(:key1 567
+  ;; :key2 "klm")]
   )))
   (ref '("int = 123
 str = \"abc\"
@@ -49,7 +54,10 @@ bool_true = true
 int_list = [ 1, 2, 3 ]
 str_list = [ \"a\", \"b\", \"c\" ]
 bool_list = [ true, false, true, false ]
-list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]"))
+list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
+[map]
+  key1 = 123
+  key2 = \"xyz\""))
   out)
   (dolist (el inp)
 (push (tomelr-encode el) out))
diff --git a/tomelr.el b/tomelr.el
index 5561d5604e..2ba7549787 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -24,6 +24,7 @@
 
 ;;; Code:
 
+(require 'json)
 (require 'map)
 (require 'subr-x)  ;For `string-trim' on Emacs versions 27.2 and older
 
@@ -208,43 +209,46 @@ returns the TOML representation as a string."
 (defun tomelr--print-stringlike (object &optional type)
   "Insert OBJECT encoded as a TOML string at point.
 
-TYPE is set to `table' if OBJECT is a TOML Table key.
+Possible value of TYPE are `table', `table-array' or nil.
 
 Return nil if OBJECT cannot be encoded as a TOML string."
-  (cond ((stringp object)
- ;; (message "[tomelr--print-stringlike DBG] %S is string" object)
- (tomelr--print-string object))
-((keywordp object) ;Symbol beginning with `:', like `:some_key'
- ;; (message "[tomelr--print-stringlike DBG] %S is keyword" object)
- (tomelr--print-string
-  (string-trim-left (symbol-name object) ":")
-  'keyword))
-((symbolp object)
- (let ((sym-name (symbol-name object)))
-   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = 
%S, depth = %d"
-   ;;  object type tomelr--print-indentation-depth)
-   (cond
-((equal type 'table)
- (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
- (progn
-   (push sym-name tomelr--print-table-hierarchy)
-   (setq tomelr--print-table-hierarchy (nreverse 
tomelr--print-table-hierarchy)))
-   ;; Throw away table keys collected at higher depths, if
-   ;; any, from earlier runs of this function.
-   (setq tomelr--print-table-hierarchy
- (seq-take tomelr--print-table-hierarchy
-   (1+ tomelr--print-indentation-depth)))
-   (setf (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy)
- sym-name))
- ;; (message "[tomelr--print-stringlike DBG] table hier: %S"
- ;;  tomelr--print-table-hierarchy)
- (princ (format "[%s]" (string-join tomelr--print-table-hierarchy 
"."
-((equal type 'table-array)
- (let ((tta-name (format "[[%s]]" sym-name)))
-   (setq tomelr--print-table-array-key tta-name)
-   (princ tta-name)))
-(t
- (princ sym-name)))
+  (let ((sym-name (cond ((stringp object)
+ object)
+;; Symbol beginning with `:', like `:some_key'
+((keywordp object)
+ (string-trim-left (symbol-name object) ":"))
+((symbolp object)
+ (symbol-name object)
+(cond
+ ((equal type 'table)
+  ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
+  ;;  object type tomelr--print-indentation-depth)
+  (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
+  (progn
+(push sym-name tomelr--print-table-hierarchy)
+(setq tomelr--print-table-hierarchy (nreverse 
tomelr--print-table-hierarchy)))
+;; Throw away table keys collected at higher depths, if
+;; any, from earlier runs of this function.

[elpa] externals/tomelr 6bbe740e52 28/84: test: Test that 'false is also considered as boolean false in TOML

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 6bbe740e52d40a5d87d62805af3ed89cc16779b9
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Test that 'false is also considered as boolean false in TOML
---
 test/tscalar.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/tscalar.el b/test/tscalar.el
index bddb946414..47d38167be 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -29,10 +29,12 @@
 (ert-deftest test-scalar-bool ()
   (let ((inp '(((bool1 . t))
((bool2 . :false))
-   ((bool3 . "false"
+   ((bool3 . 'false))
+   ((bool4 . "false"
 (ref '("bool1 = true"
"bool2 = false"
-   "bool3 = false"))
+   "bool3 = false"
+   "bool4 = false"))
 out)
 (dolist (el inp)
   (push (tomelr-encode el) out))



[elpa] externals/tomelr 61397410af 01/84: Initial empty commit

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 61397410afa010935d3f0c66e97fe6cc8413cbb8
Author: Kaushal Modi 
Commit: Kaushal Modi 

Initial empty commit



[elpa] externals/tomelr 20bf9e6c54 12/84: chore(doc): Add GHA and license badges

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 20bf9e6c5480a29159b1db216b9da2a6279590fe
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(doc): Add GHA and license badges
---
 README.org | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/README.org b/README.org
index 3db9373425..d24eb3ff3b 100644
--- a/README.org
+++ b/README.org
@@ -3,6 +3,13 @@
 
 #+property: header-args :eval never-export
 
+*NOTE*: This library is in a severe beta stage. It is not ready for any use!! 
:poop:
+
+[[https://github.com/kaushalmodi/tomelr/actions][https://github.com/kaushalmodi/tomelr/actions/workflows/test.yml/badge.svg]]
 
[[https://www.gnu.org/licenses/gpl-3.0][https://img.shields.io/badge/License-GPL%20v3-blue.svg]]
+
+* Installation
+Clone this repo, have ~baser.el~ in the ~load-path~ and ~(require
+'baser)~.
 * Specification and Conversion Examples
 Below examples are shown on how S-expressions get translated to
 various TOML object types.



[elpa] externals/tomelr 0ba5f2ff69 24/84: chore(readme): Move mixed type array example to the 'medley' example

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 0ba5f2ff69b1c6a3f4fcfe89e6b54bca11b4d1d2
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(readme): Move mixed type array example to the 'medley' example
---
 README.org | 36 +---
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/README.org b/README.org
index 948d37fdaa..937d0c9462 100644
--- a/README.org
+++ b/README.org
@@ -341,22 +341,12 @@ numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref array-of-arrays
 '((nested_arrays_of_ints . [(1 2) (3 4 5)])
-  (nested_mixed_array . [(1 2) ("a" "b" "c")])
-  (contributors . ("Foo Bar "
-   ((name . "Baz Qux")
-(email . "baz...@example.com")
-(url . "https://example.com/bazqux";)
+  (nested_mixed_array . [(1 2) ("a" "b" "c")]))
 #+end_src
  TOML
 #+begin_src toml
 nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
 nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
-
-# Mixed-type arrays are allowed
-contributors = [
-  "Foo Bar ",
-  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
-]
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
@@ -388,14 +378,6 @@ contributors = [
   "b",
   "c"
 ]
-  ],
-  "contributors": [
-"Foo Bar ",
-{
-  "name": "Baz Qux",
-  "email": "baz...@example.com",
-  "url": "https://example.com/bazqux";
-}
   ]
 }
 #+end_example
@@ -589,6 +571,10 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   (integers . (123 -5 17 1234))
   (floats . (12.3 -5.0 -1.7e-05))
   (booleans . (t :false))
+  (contributors . ("Foo Bar "
+   ((name . "Baz Qux")
+(email . "baz...@example.com")
+(url . "https://example.com/bazqux";
   (dog . ((legs . 4)
   (eyes . 2)
   (friends . ("poo" "boo"
@@ -644,6 +630,10 @@ strings-symbols = ["abc", "def", "two words"]
 integers = [123, -5, 17, 1_234]
 floats = [12.3, -5.0, -1.7e-05]
 booleans = [true, false]
+contributors = [
+  "Foo Bar ",
+  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
+]
 [dog]
   legs = 4
   eyes = 2
@@ -767,6 +757,14 @@ booleans = [true, false]
 true,
 false
   ],
+  "contributors": [
+"Foo Bar ",
+{
+  "name": "Baz Qux",
+  "email": "baz...@example.com",
+  "url": "https://example.com/bazqux";
+}
+  ],
   "dog": {
 "legs": 4,
 "eyes": 2,



[elpa] externals/tomelr 38160ef271 41/84: fix: Stricter condition before starting TOML table array check

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 38160ef271493293166f81ce1a3d52b58a484a8e
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Stricter condition before starting TOML table array check
---
 tomelr.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tomelr.el b/tomelr.el
index 1e3a29baab..edbf7e6aa4 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -377,7 +377,8 @@ Definition of a TOML Table Array (TTA):
 
 - OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
   TOML Table (TT)."
-  (when (mapp object)
+  (when (and (not (stringp object))
+ (mapp object)) ;Because `mapp' is non-nil for strings too
 (seq-every-p
  (lambda (elem)
(tomelr--toml-table-p elem))



[elpa] externals/tomelr 2810504e84 32/84: feat: Add basic support for S-exp plists -> TOML conversion

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 2810504e840d8038b9a06fff732889f0f8cc73c8
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Add basic support for S-exp plists -> TOML conversion

Support added for scalars and lists.
Pending: tables, arrays of tables, etc.
---
 README.org| 25 ++---
 test/all-tests.el |  1 +
 test/tplist.el| 56 +++
 tomelr.el | 15 +--
 4 files changed, 80 insertions(+), 17 deletions(-)

diff --git a/README.org b/README.org
index 6a43d4df76..6e45a61a8f 100644
--- a/README.org
+++ b/README.org
@@ -960,26 +960,29 @@ contributors = [
   :key2 "klm")])
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
 #+begin_src toml
-int = 123.0
+int = 123
 str = "abc"
 bool_false = false
 bool_true = true
-int_list = [1.0, 2.0, 3.0]
-str_list = ["a", "b", "c"]
-bool_list = [true, false, true, false]
-list_of_lists = [ [1.0, 2.0],
-  [3.0, 4.0, 5.0] ]
-
+int_list = [ 1, 2, 3 ]
+str_list = [ "a", "b", "c" ]
+bool_list = [ true, false, true, false ]
+list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
 [map]
-  key1 = 123.0
+  key1 = 123
   key2 = "xyz"
-
 [[list_of_maps]]
-  key1 = 123.0
+  key1 = 123
   key2 = "xyz"
 [[list_of_maps]]
-  key1 = 567.0
+  key1 = 567
   key2 = "klm"
 #+end_src
  JSON Reference
diff --git a/test/all-tests.el b/test/all-tests.el
index a28528c2c0..8a19f4a81a 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -25,3 +25,4 @@
 (require 'tnil)
 (require 'tarray)
 (require 'ttable)
+(require 'tplist)
diff --git a/test/tplist.el b/test/tplist.el
new file mode 100644
index 00..db2e7152c2
--- /dev/null
+++ b/test/tplist.el
@@ -0,0 +1,56 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Test conversion of S-exp plists to TOML.
+
+;;; Code:
+(require 'tomelr)
+
+ S-exp objects as plists
+(ert-deftest test-plist ()
+  (let ((inp '((:int 123
+:remove_this_key  nil
+:str "abc"
+:bool_false :false
+:bool_true t
+:int_list (1 2 3)
+:str_list ("a" "b" "c")
+:bool_list (t :false t :false)
+:list_of_lists [(1 2) (3 4 5)]
+;; TODO plist specification of TOML tables is not yet 
supported.
+;; :map (:key1 123
+;;   :key2 "xyz")
+)))
+(ref '("int = 123
+str = \"abc\"
+bool_false = false
+bool_true = true
+int_list = [ 1, 2, 3 ]
+str_list = [ \"a\", \"b\", \"c\" ]
+bool_list = [ true, false, true, false ]
+list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]"))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tplist)
diff --git a/tomelr.el b/tomelr.el
index 55b3b07d73..fca625c9f0 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -144,11 +144,12 @@ Return nil if KEYWORD is not recognized as a TOML 
keyword."
 (and keyword (insert keyword
 
  Strings
-(defun tomelr--print-string (string &optional trim-init-chars)
+(defun tomelr--print-string (string &optional type)
   "Insert a TOML representation of STRING at point.
 
-If TRIM-INIT-CHARS is positive, those many initial characters
-of the STRING are not inserted.
+Optional TYPE arg gives more information about the input STRING.
+For example, if the string is the name of a TOML key, it will be
+set to `keyword'.
 
 Return the same STRING passed as input.  See
 `tomelr-encode-string' instead if you need a function that
@@ -160,6 +161,7 @@ returns the TOML representation as a string."
 (special-chars-re (rx (in ?\" ?\\ cntrl ?\u007F))) ;cntrl is same as 
(?\u . ?\u001F)
 begin-q end-q)
 (cond
+ ((equal type 'keyword))
  ((string-match-p tomelr--date-time-regexp string)) ;RFC 3339 formatted 
date-time with offset
  ;; Use multi-line string quotation if the string contains a " char
  ;; or a newline - """STRING"""
@@ -185,7 +187,6 @@ returns the TOML representation as a string."
   (setq end-q begin-q)))
 (and begin-q (insert begin-q))
 (goto-char (prog1 (point) (pri

[elpa] externals/tomelr baf81228bc 45/84: fix: Correct the spec for nested array of tables

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit baf81228bc812de55e4df9340dd34cc8cc5a2ab8
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Correct the spec for nested array of tables
---
 README.org | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index b3513273e4..4944ec5fcb 100644
--- a/README.org
+++ b/README.org
@@ -573,12 +573,17 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
 '((fruits . (((name . "apple")
   (physical . ((color . "red")
(shape . "round")))
-  (varieties . name . "red delicious"))
- ((name . "granny smith"))
+  (varieties . (((name . "red delicious"))
+((name . "granny smith")
  ((name . "banana")
   (varieties . (((name . "plantain"
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
 #+begin_src toml
 [[fruits]]
   name = "apple"
@@ -611,14 +616,12 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
 "shape": "round"
   },
   "varieties": [
-[
-  {
-"name": "red delicious"
-  },
-  {
-"name": "granny smith"
-  }
-]
+{
+  "name": "red delicious"
+},
+{
+  "name": "granny smith"
+}
   ]
 },
 {



[elpa] externals/tomelr 8da825067b 15/84: chore(readme): Update

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 8da825067b69d9c3e8a18f7f553403e25be846fc
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(readme): Update
---
 README.org | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index b3b4c0ae91..8768d21280 100644
--- a/README.org
+++ b/README.org
@@ -16,6 +16,20 @@ the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
 
 It will then be gradually refactored so that it meets the
 specification defined below.
+* Library Completion Status [0/6]
+- [-] Scalar
+  - [X] Boolean
+  - [ ] String
+  - [ ] Integer
+  - [ ] Float
+  - [ ] Date + Time with Offset
+  - [ ] Date
+  - [ ] Nil
+- [ ] Arrays
+- [ ] Array of Arrays
+- [ ] Tables
+- [ ] Array of Tables
+- [ ] Property Lists
 * Specification and Conversion Examples
 [[https://scripter.co/defining-tomelr/][Companion blog post]]
 
@@ -906,7 +920,7 @@ list_of_lists = [ [1.0, 2.0],
 }
 #+end_example
 
-* COMMENT Development
+* Development
 ** Running Tests
 *** Run all tests
 #+begin_src shell
@@ -932,8 +946,9 @@ the above JSON examples.
   (json-encoding-pretty-print t))
   (json-encode object
 #+end_src
-* Reference
-[[https://toml.io/en/v1.0.0/][TOML v1.0.0 Spec]]
+* References
+- [[https://toml.io/en/v1.0.0/][TOML v1.0.0 Spec]]
+- [[https://toolkit.site/format.html][Online JSON/TOML/YAML converter]]
 * COMMENT Local Variables   
:ARCHIVE:
 # Local Variables:
 # eval: (setq-local org-fold-core-style 'overlays)



[elpa] externals/tomelr b64eb07e99 49/84: fix: Detect TT with sub-tables correctly

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit b64eb07e99e9ab45cc88dc6b628f8bc828a0dc28
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Detect TT with sub-tables correctly
---
 test/tinternal.el|  8 ++--
 test/ttable-array.el | 16 
 tomelr.el| 14 --
 3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/test/tinternal.el b/test/tinternal.el
index 0e46b57ebb..29346b43bf 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -31,6 +31,10 @@
(:a 1)
((a . 1) (b . 2))
(:a 1 :b 2)
+   ;; Nested TT
+   ((a . 1)
+(b . ((c . 3)
+  (d . 4
)))
 (dolist (el inp)
   (should (equal t (tomelr--toml-table-p el))
@@ -47,10 +51,10 @@
  tomelr--toml-table-array-p
 (ert-deftest test-internal-valid-tta ()
   (let ((inp '(
-   ;; ;; TTA with 1 table of 1 key-val pair
+   ;; TTA with 1 table of 1 key-val pair
(((a . 1)))
((:a  1))
-   ;; ;; TTA with 2 tables of 2 key-val pairs
+   ;; TTA with 2 tables of 2 key-val pairs
(((a . 1) (b . 2))
 ((a . 100) (b . 200)))
((:a 1 :b 2)
diff --git a/test/ttable-array.el b/test/ttable-array.el
index 5d1b2c4333..740cf10de9 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -62,6 +62,22 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Sub-table in a TOML Table Array
+(ert-deftest test-subtable-in-tta ()
+  (let ((inp '(
+   ((fruits . (((name . "apple")
+(physical . ((color . "red")
+ (shape . "round")
+(ref '("[[fruits]]
+  name = \"apple\"
+  [fruits.physical]
+color = \"red\"
+shape = \"round\""))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
  Nested array of tables
 (ert-deftest test-nested-array-of-tables ()
   (let ((inp '(
diff --git a/tomelr.el b/tomelr.el
index fc5bdc72a9..01b652b0f4 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -292,16 +292,18 @@ Definition of a TOML Table (TT):
  ;; (when (listp elem)
  ;;   (message "  [tomelr--toml-table-p DBG] sub-elem 0 = %S, 
type = %S, len = %d"
  ;;(car elem) (type-of (car elem)) (safe-length 
(car elem
- (and (consp elem)
-  (= 1 (safe-length elem))
-  (not (consp (car elem)
+ (or (and (consp elem)
+  (= 1 (safe-length elem))
+  (not (consp (car elem
+ (and (listp elem)
+  (symbolp (car elem))
+  (tomelr--toml-table-p (cdr elem)
object)
   t)
- ((and (listp (car object))
-   (symbolp (car (car object
-  (tomelr--toml-table-p (cdr (car object
  (t
   nil
+;; (message "[tomelr--toml-table-p DBG] tablep = %S" tablep)
+;; (message "=")
 tablep))
 
 (defun tomelr--print-pair (key val)



[elpa] externals/tomelr 65653d53ee 30/84: chore(doc): M-x checkdoc fixes

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 65653d53eef32eb4c9735c2e36aea175c9b15881
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(doc): M-x checkdoc fixes
---
 tomelr.el | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index ce1ebd4e9d..4cbfbe45dc 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -147,7 +147,9 @@ Return nil if KEYWORD is not recognized as a TOML keyword."
 If TRIM-INIT-CHARS is positive, those many initial characters
 of the STRING are not inserted.
 
-Return the same STRING passed as input."
+Return the same STRING passed as input.  See
+`tomelr-encode-string' instead if you need a function that
+returns the TOML representation as a string."
   ;; (message "[tomelr--print-string DBG] string = `%s'" string)
   (let ((special-chars '((?b . ?\b) ;U+0008
  (?f . ?\f) ;U+000C
@@ -227,7 +229,7 @@ Signal `tomelr-key-format' if it cannot be encoded as a 
string."
 
  Objects
 (defun tomelr--print-pair (key val)
-  "Insert TOML representation of KEY-VAL pair at point."
+  "Insert TOML representation of KEY - VAL pair at point."
   (let ((type (cond
;; TODO: Need to find a robust way of detecting TOML tables.
((and (mapp val)
@@ -250,7 +252,7 @@ Signal `tomelr-key-format' if it cannot be encoded as a 
string."
   (tomelr--print val
 
 (defun tomelr--print-map (map)
-  "Insert TOML object representation of MAP at point.
+  "Insert a TOML representation of MAP at point.
 This works for any MAP satisfying `mapp'."
   ;; (message "[tomelr--print-map DBG] map = %S" map)
   (unless (map-empty-p map)
@@ -258,9 +260,12 @@ This works for any MAP satisfying `mapp'."
   (map-do #'tomelr--print-pair map
 
 (defun tomelr--print-unordered-map (map)
-  "Like `tomelr--print-map', but optionally sort MAP first.
+  "Insert a TOML representation of MAP at point, but optionally sort MAP first.
+
 If `tomelr-encoding-object-sort-predicate' is non-nil, this first
-transforms an unsortable MAP into a sortable alist."
+transforms an unsortable MAP into a sortable alist.
+
+See `tomelr-encode-plist' that returns the same as a string."
   (if (and tomelr-encoding-object-sort-predicate
(not (map-empty-p map)))
   (tomelr--print-alist (map-pairs map) t)
@@ -269,8 +274,11 @@ transforms an unsortable MAP into a sortable alist."
  Lists (including alists and plists)
 (defun tomelr--print-alist (alist &optional destructive)
   "Insert a TOML representation of ALIST at point.
+
 Sort ALIST first if `tomelr-encoding-object-sort-predicate' is
-non-nil.  Sorting can optionally be DESTRUCTIVE for speed."
+non-nil.  Sorting can optionally be DESTRUCTIVE for speed.
+
+See `tomelr-encode-alist' that returns the same as a string."
   (tomelr--print-map (if (and tomelr-encoding-object-sort-predicate alist)
  (sort (if destructive alist (copy-sequence alist))
(lambda (a b)
@@ -290,7 +298,7 @@ non-nil.  Sorting can optionally be DESTRUCTIVE for speed."
 ;;
 
 (defun tomelr--print-list (list)
-  "Like `tomelr-encode-list', but insert the TOML at point."
+  "Insert a TOML representation of LIST at point."
   (cond ((tomelr-alist-p list) (tomelr--print-alist list))
 ((tomelr-plist-p list) (tomelr--print-unordered-map list))
 ((listp list)  (tomelr--print-array list))
@@ -298,7 +306,8 @@ non-nil.  Sorting can optionally be DESTRUCTIVE for speed."
 
  Arrays
 (defun tomelr--print-array (array)
-  "Like `tomelr-encode-array', but insert the TOML at point."
+  "Insert a TOML representation of ARRAY at point.
+See `tomelr-encode-array' that returns the same as a string."
   (insert "[ ")
   (unless (= 0 (length array))
 (tomelr--with-indentation
@@ -319,7 +328,8 @@ ARRAY can also be a list."
 
  Print wrapper
 (defun tomelr--print (object)
-  "Like `tomelr-encode', but insert or print the TOML at point."
+  "Insert a TOML representation of OBJECT at point.
+See `tomelr-encode' that returns the same as a string."
   (cond ((tomelr--print-keyword object))
 ((listp object) (tomelr--print-list object))
 ((tomelr--print-stringlike object))



[elpa] externals/tomelr ad8366d904 36/84: feat: Support basic TOML Table Arrays

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ad8366d904dea6fc3f4af5bf57bcd92c6b37f57e
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Support basic TOML Table Arrays
---
 README.org   | 35 +---
 test/all-tests.el|  1 +
 test/ttable-array.el | 66 
 tomelr.el| 50 ---
 4 files changed, 141 insertions(+), 11 deletions(-)

diff --git a/README.org b/README.org
index 6e45a61a8f..18d1b37754 100644
--- a/README.org
+++ b/README.org
@@ -32,8 +32,8 @@ specification defined below.
 - [X] Tables
   - [X] Basic Tables
   - [X] Nested Tables
-- [ ] Array of Tables
-  - [ ] Basic Array of Tables
+- [-] Array of Tables
+  - [X] Basic Array of Tables
   - [ ] Nested Array of Tables
 - [ ] Property Lists
 * Specification and Conversion Examples
@@ -483,7 +483,8 @@ CLOSED: [2022-04-29 Fri 14:30]
 }
 #+end_example
 ** TOML Array of Tables: Lists of Maps
-*** Basic Array of Tables
+*** DONE Basic Array of Tables
+CLOSED: [2022-04-29 Fri 18:14]
  S-expression
 #+begin_src emacs-lisp :eval no :noweb-ref table-arrays
 '((products . (((name . "Hammer")
@@ -500,6 +501,34 @@ CLOSED: [2022-04-29 Fri 14:30]
(note . "A note `mono`.")
 #+end_src
  TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+[[products]]
+  name = "Hammer"
+  sku = 738594937
+[[products]]
+[[products]]
+  name = "Nail"
+  sku = 284758393
+  color = "gray"
+[[org_logbook]]
+  timestamp = 2022-04-08T14:53:00-04:00
+  note = """
+This note addition prompt shows up on typing the `C-c C-z` binding.
+See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
+[[org_logbook]]
+  timestamp = 2018-09-06T11:45:00-04:00
+  note = "Another note **bold** _italics_."
+[[org_logbook]]
+  timestamp = 2018-09-06T11:37:00-04:00
+  note = "A note `mono`."
+#+end_src
+
 #+begin_src toml
 [[products]]
   name = "Hammer"
diff --git a/test/all-tests.el b/test/all-tests.el
index 8a19f4a81a..b031e739ec 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -25,4 +25,5 @@
 (require 'tnil)
 (require 'tarray)
 (require 'ttable)
+(require 'ttable-array)
 (require 'tplist)
diff --git a/test/ttable-array.el b/test/ttable-array.el
new file mode 100644
index 00..37392ba28d
--- /dev/null
+++ b/test/ttable-array.el
@@ -0,0 +1,66 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Test conversion to TOML tables.
+
+;;; Code:
+(require 'tomelr)
+
+ Basic array of tables
+(ert-deftest test-array-of-tables ()
+  (let ((inp '(((products . (((name . "Hammer")
+  (sku . 738594937))
+ ()
+ ((name . "Nail")
+  (sku . 284758393)
+  (color . "gray"
+(org_logbook . (((timestamp . 2022-04-08T14:53:00-04:00)
+ (note . "This note addition prompt shows up 
on typing the `C-c C-z` binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."))
+((timestamp . 2018-09-06T11:45:00-04:00)
+ (note . "Another note **bold** _italics_."))
+((timestamp . 2018-09-06T11:37:00-04:00)
+ (note . "A note `mono`.")))
+(ref '("[[products]]
+  name = \"Hammer\"
+  sku = 738594937
+[[products]]
+[[products]]
+  name = \"Nail\"
+  sku = 284758393
+  color = \"gray\"
+[[org_logbook]]
+  timestamp = 2022-04-08T14:53:00-04:00
+  note = \"\"\"
+This note addition prompt shows up on typing the `C-c C-z` binding.
+See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers).\"\"\"
+[[org_logbook]]
+  timestamp = 2018-09-06T11:45:00-04:00
+  note = \"Another note **bold** _italics_.\"
+[[org_logbook]]
+  timestamp = 2018-09-06T11:37:00-04:00
+  note = \"A note `mono`.\""))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'ttable-array)
diff --git a/tomelr.

[elpa] externals/tomelr bcaea16ec0 39/84: chore(doc): Clean up old code block

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit bcaea16ec0d0d03827b619c2f64c01ccc324db38
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(doc): Clean up old code block
---
 README.org | 22 --
 1 file changed, 22 deletions(-)

diff --git a/README.org b/README.org
index ffac82b330..daf1673d9a 100644
--- a/README.org
+++ b/README.org
@@ -528,28 +528,6 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   timestamp = 2018-09-06T11:37:00-04:00
   note = "A note `mono`."
 #+end_src
-
-#+begin_src toml
-[[products]]
-  name = "Hammer"
-  sku = 738594937
-[[products]]  # empty table within the array
-[[products]]
-  name = "Nail"
-  sku = 284758393
-  color = "gray"
-
-[[org_logbook]]
-  timestamp = 2022-04-08T14:53:00-04:00
-  note = """This note addition prompt shows up on typing the `C-c C-z` binding.
-See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
-[[org_logbook]]
-  timestamp = 2018-09-06T11:45:00-04:00
-  note = """Another note **bold** _italics_."""
-[[org_logbook]]
-  timestamp = 2018-09-06T11:37:00-04:00
-  note = """A note `mono`."""
-#+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
 (json-encode-pretty



[elpa] externals/tomelr de661716af 72/84: style: Remove space from after and before [ and ] brackets

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit de661716af55da2a102551f51def4a2468f9593f
Author: Kaushal Modi 
Commit: Kaushal Modi 

style: Remove space from after and before [ and ] brackets
---
 README.org | 80 +-
 test/tarray.el | 12 -
 test/tplist.el |  8 +++---
 test/ttable.el |  2 +-
 tomelr.el  |  5 ++--
 5 files changed, 53 insertions(+), 54 deletions(-)

diff --git a/README.org b/README.org
index 6afaf2fb0b..3bf0b13e59 100644
--- a/README.org
+++ b/README.org
@@ -19,7 +19,7 @@ It was then refactored to meet the specification defined 
below.
 This library has only one entry point for simplicity: ~tomelr-encode~.
 
 - Input :: Lisp data expression in Alist or Plist format
-- Ouput :: TOML string
+- Output :: TOML string
 ** Example
 *** Alist data
 #+begin_src emacs-lisp :eval no :noweb-ref data-example-alist
@@ -46,13 +46,13 @@ This library has only one entry point for simplicity: 
~tomelr-encode~.
 #+RESULTS:
 #+begin_src toml
 title = "Some Title"
-author = [ "fn ln" ]
+author = ["fn ln"]
 description = """
 some long description
 that spans multiple
 lines"""
 date = 2022-03-14T01:49:00-04:00
-tags = [ "tag1", "tag2" ]
+tags = ["tag1", "tag2"]
 draft = false
 [versions]
   emacs = "28.1.50"
@@ -95,13 +95,13 @@ You will get the below TOML output for either of the above 
input data.
 #+RESULTS:
 #+begin_src toml
 title = "Some Title"
-author = [ "fn ln" ]
+author = ["fn ln"]
 description = """
 some long description
 that spans multiple
 lines"""
 date = 2022-03-14T01:49:00-04:00
-tags = [ "tag1", "tag2" ]
+tags = ["tag1", "tag2"]
 draft = false
 [versions]
   emacs = "28.1.50"
@@ -448,10 +448,10 @@ CLOSED: [2022-04-29 Fri 00:25]
 
 #+RESULTS:
 #+begin_src toml
-integers = [ 1, 2, 3 ]
-integers2 = [ 1, 2, 3 ]
-colors = [ "red", "yellow", "green" ]
-numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
+integers = [1, 2, 3]
+integers2 = [1, 2, 3]
+colors = ["red", "yellow", "green"]
+numbers = [0.1, 0.2, 0.5, 1, 2, 5]
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
@@ -502,8 +502,8 @@ CLOSED: [2022-04-29 Fri 00:34]
 
 #+RESULTS:
 #+begin_src toml
-nested_arrays_of_ints = [ [ 1, 2 ], [ 3, 4, 5 ] ]
-nested_mixed_array = [ [ 1, 2 ], [ "a", "b", "c" ] ]
+nested_arrays_of_ints = [[1, 2], [3, 4, 5]]
+nested_mixed_array = [[1, 2], ["a", "b", "c"]]
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
@@ -850,15 +850,15 @@ CLOSED: [2022-05-02 Mon 10:29]
 #+RESULTS:
 #+begin_src toml
 title = "Keyword Collection"
-author = [ "firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3" ]
-aliases = [ "/posts/keyword-concatenation", "/posts/keyword-merging" ]
-images = [ "image 1", "image 2" ]
-keywords = [ "keyword1", "keyword2", "three word keywords3" ]
-outputs = [ "html", "json" ]
-series = [ "series 1", "series 2" ]
-tags = [ "mega front-matter", "keys", "collection", "concatenation", "merging" 
]
-categories = [ "cat1", "cat2" ]
-videos = [ "video 1", "video 2" ]
+author = ["firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3"]
+aliases = ["/posts/keyword-concatenation", "/posts/keyword-merging"]
+images = ["image 1", "image 2"]
+keywords = ["keyword1", "keyword2", "three word keywords3"]
+outputs = ["html", "json"]
+series = ["series 1", "series 2"]
+tags = ["mega front-matter", "keys", "collection", "concatenation", "merging"]
+categories = ["cat1", "cat2"]
+videos = ["video 1", "video 2"]
 draft = false
 categories_weight = 999
 tags_weight = 88
@@ -868,26 +868,26 @@ mybaz = "zoo"
 alpha = 1
 beta = "two words"
 gamma = 10
-animals = [ "dog", "cat", "penguin", "mountain gorilla" ]
-strings-symbols = [ "abc", "def", "two words" ]
-integers = [ 123, -5, 17, 1234 ]
-floats = [ 12.3, -5.0, -1.7e-05 ]
-booleans = [ true, false ]
+animals = ["dog", "cat", "penguin", "mountain gorilla"]
+strings-symbols = ["abc", "def", "two words"]
+integers = [123, -5, 17, 1234]
+floats = [12.3, -5.0, -1.7e-05]
+booleans = [true, false]
 [dog]
   legs = 4
   eyes = 2
-  friends = [ "poo", "boo" ]
+  friends = ["poo", "boo"]
 [header]
   image = "projects/Readingabook.jpg"
   caption = "stay hungry stay foolish"
 [collection]
   nothing = false
   nonnil = true
-  animals = [ "dog", "cat", "penguin", "mountain gorilla" ]
-  strings-symbols = [ "abc", "def", "two words" ]
-  integers = [ 123, -5, 17, 1234 ]
-  floats = [ 12.3, -5.0, -1.7e-05 ]
-  booleans = [ true, false ]
+  animals = ["dog", "cat", "penguin", "mountain gorilla"]
+  strings-symbols = ["abc", "def", "two words"]
+  integers = [123, -5, 17, 1234]
+  floats = [12.3, -5.0, -1.7e-05]
+  booleans = [true, false]
 [menu]
   [menu.foo]
 identifier = "keyword-collection"
@@ -898,11 +898,11 @@ booleans = [ true, false ]
   title = "The Image #:counter"
   [resources.params]
 foo = "bar"
-floats = [ 12.3, -5.0, -1.7e-05 ]
-strings-symbols = [ "abc", "def", "two words" ]
-animals = [ "dog", "cat", "penguin", "mo

[elpa] externals/tomelr ca9245038a 35/84: fix: Attempt to make tomelr--toml-table-p more robust

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ca9245038a74f272b246979271cbf2adef09eb89
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Attempt to make tomelr--toml-table-p more robust
---
 tomelr.el | 41 +++--
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 99fc776d99..fc504b5a29 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -250,12 +250,41 @@ Signal `tomelr-key-format' if it cannot be encoded as a 
string."
 
  Objects
 (defun tomelr--toml-table-p (object)
-  "Return non-nil if OBJECT can represent a TOML Table."
-  ;; TODO: Need to find a robust way of detecting TOML tables.
-  ;; (message "[tomelr--print-pair DBG] object type = %S" (type-of object))
-  (and (mapp object)
-   (consp object) ;  object = ((KEY . VAL)) <- cons
-   (consp (car object ;(car object) =  (KEY . VAL)  <- also cons
+  "Return non-nil if OBJECT can represent a TOML Table.
+
+Definition of a TOML Table (TT):
+
+- OBJECT is TT if it is of type ((KEY1 . VAL1) (KEY2 . VAL2) ..)
+- If OBJECT if of type ((SYMBOL . (WHATEVER))), it's possible that
+  OBJECT is a nested TT.  In that case, pass (WHATEVER) to
+  `tomelr--toml-table-p'."
+  (let (tablep)
+;; (message "[tomelr--toml-table-p DBG] object = %S, type = %S, mapp = %S, 
length = %d"
+;;  object (type-of object) (mapp object) (safe-length object))
+(when (listp object)
+  ;; (message "[tomelr--toml-table-p DBG] first elem = %S, type = %S"
+  ;;  (car object) (type-of (car object)))
+  (setq tablep
+(cond
+ ((seq-every-p
+   ;; Ensure that every element in the `object' is a (KEY
+   ;; . VAL) kind of cons.
+   (lambda (elem)
+ ;; (message "  [tomelr--toml-table-p DBG] elem = %S, type = 
%S"
+ ;;  elem (type-of elem))
+ ;; (when (listp elem)
+ ;;   (message "  [tomelr--toml-table-p DBG] sub-elem 0 = %S, 
type = %S"
+ ;;(nth 0 elem) (type-of (nth 0 elem
+ (and (consp elem)
+  (= 1 (safe-length elem
+   object)
+  t)
+ ((and (listp (car object))
+   (symbolp (car (car object
+  (tomelr--toml-table-p (cdr (car object
+ (t
+  nil
+tablep))
 
 (defun tomelr--print-pair (key val)
   "Insert TOML representation of KEY - VAL pair at point."



[elpa] externals/tomelr 3aa4dc1dbd 54/84: chore: Add Package-Requires and other info in the header comment

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 3aa4dc1dbdce5875166b9db76b6de0a0ad679b33
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Add Package-Requires and other info in the header comment
---
 tomelr.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/tomelr.el b/tomelr.el
index 1ef27faaa9..520b702cf5 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -1,6 +1,10 @@
 ;;; tomelr.el --- Convert Emacs s-expressions to TOML   -*- 
lexical-binding: t -*-
 
 ;; Authors: Kaushal Modi 
+;; URL: https://github.com/kaushalmodi/tomelr
+;; Package-Requires: ((emacs "26.3"))
+;; Keywords: TOML, config
+;; Version: v0.0.1
 
 ;; This file is not part of GNU Emacs.
 



[elpa] externals/tomelr 0d4674f782 42/84: test: Test `tomelr--toml-table-p`

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 0d4674f782bee99ee36aca079ede57adeccc384f
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Test `tomelr--toml-table-p`
---
 test/all-tests.el   |  2 ++
 test/{all-tests.el => tinternal.el} | 36 +++-
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/test/all-tests.el b/test/all-tests.el
index b031e739ec..45c5442ab4 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -21,6 +21,8 @@
 
 (setq load-prefer-newer t)
 
+(require 'tinternal)
+
 (require 'tscalar)
 (require 'tnil)
 (require 'tarray)
diff --git a/test/all-tests.el b/test/tinternal.el
similarity index 52%
copy from test/all-tests.el
copy to test/tinternal.el
index b031e739ec..9564b5c9af 100644
--- a/test/all-tests.el
+++ b/test/tinternal.el
@@ -1,4 +1,4 @@
-;;; all-tests.el --- Tests for tomelr.el   -*- 
lexical-binding: t; -*-
+;; -*- lexical-binding: t; -*-
 
 ;; Authors: Kaushal Modi 
 
@@ -17,13 +17,31 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see .
 
-;;; Code:
+;;; Commentary:
 
-(setq load-prefer-newer t)
+;; Tests for some internal functions.
 
-(require 'tscalar)
-(require 'tnil)
-(require 'tarray)
-(require 'ttable)
-(require 'ttable-array)
-(require 'tplist)
+;;; Code:
+(require 'tomelr)
+
+ tomelr--toml-table-p
+(ert-deftest test-internal-valid-toml-tables ()
+  (let ((inp '(
+   ((a . 1))
+   (:a 1)
+   ((a . 1) (b . 2))
+   (:a 1 :b 2)
+   )))
+(dolist (el inp)
+  (should (equal t (tomelr--toml-table-p el))
+
+(ert-deftest test-internal-invalid-toml-tables ()
+  (let ((inp '(
+   (a 1)
+   ;; (((a . 1))) ;This is an array of TOML table
+   )))
+(dolist (el inp)
+  (should (equal nil (tomelr--toml-table-p el))
+
+
+(provide 'tinternal)



[elpa] externals/tomelr a33dbd1286 50/84: fix: Detect nested TTA correctly when not present in first TT key

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a33dbd1286cd1f539c1e07bd21dc60464dd2f667
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Detect nested TTA correctly when not present in first TT key
---
 test/tinternal.el|  4 
 test/ttable-array.el | 12 +++-
 tomelr.el| 24 ++--
 3 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/test/tinternal.el b/test/tinternal.el
index 29346b43bf..63e58a7fab 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -35,6 +35,10 @@
((a . 1)
 (b . ((c . 3)
   (d . 4
+   ;; Nested TTA
+   ((a . 1)
+(b . (((c . 3))
+  ((c . 300)
)))
 (dolist (el inp)
   (should (equal t (tomelr--toml-table-p el))
diff --git a/test/ttable-array.el b/test/ttable-array.el
index 740cf10de9..7247f9d132 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -83,6 +83,9 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   (let ((inp '(
((fruits . (((varieties . (((name . "red delicious"))
   ((name . "granny smith"
+   ((fruits . (((name . "apple")
+(varieties . (((name . "red delicious"))
+  ((name . "granny smith"
;; ((fruits . (((name . "apple")
;;  (physical . ((color . "red")
;;   (shape . "round")))
@@ -91,7 +94,14 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
;; ((name . "banana")
;;  (varieties . (((name . "plantain"
))
-(ref '("[[fruits]]
+(ref '(
+   "[[fruits]]
+  [[fruits.varieties]]
+name = \"red delicious\"
+  [[fruits.varieties]]
+name = \"granny smith\""
+   "[[fruits]]
+  name = \"apple\"
   [[fruits.varieties]]
 name = \"red delicious\"
   [[fruits.varieties]]
diff --git a/tomelr.el b/tomelr.el
index 01b652b0f4..0c97552b62 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -292,12 +292,24 @@ Definition of a TOML Table (TT):
  ;; (when (listp elem)
  ;;   (message "  [tomelr--toml-table-p DBG] sub-elem 0 = %S, 
type = %S, len = %d"
  ;;(car elem) (type-of (car elem)) (safe-length 
(car elem
- (or (and (consp elem)
-  (= 1 (safe-length elem))
-  (not (consp (car elem
- (and (listp elem)
-  (symbolp (car elem))
-  (tomelr--toml-table-p (cdr elem)
+ (or
+  ;; Basic TT case
+  ;; ((a . 1)
+  ;;  (b . 2))
+  (and (consp elem)
+   (= 1 (safe-length elem))
+   (not (consp (car elem
+  (and (listp elem)
+   (symbolp (car elem))
+   (or
+;; Nested TT case
+;; ((b . ((c . 3)
+;;(d . 4
+(tomelr--toml-table-p (cdr elem))
+;; Nested TTA case
+;; ((b . (((c . 3))
+;;((c . 300)
+(tomelr--toml-table-array-p (cdr elem))
object)
   t)
  (t



[elpa] externals/tomelr 5959b90ffa 44/84: fix: Don't let TOML tables be recognized as TOML tables arrays

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 5959b90ffa499281306473c83b669353ecb85073
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Don't let TOML tables be recognized as TOML tables arrays
---
 test/tinternal.el | 15 +++
 tomelr.el |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/test/tinternal.el b/test/tinternal.el
index b80950b434..5b4e1bb5d8 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -44,5 +44,20 @@
 (dolist (el inp)
   (should (equal nil (tomelr--toml-table-p el))
 
+ tomelr--toml-table-array-p
+(ert-deftest test-internal-valid-tta ()
+  (let ((inp '(
+   (((a . 1)))
+   )))
+(dolist (el inp)
+  (should (equal t (tomelr--toml-table-array-p el))
+
+(ert-deftest test-internal-invalid-tta ()
+  (let ((inp '(
+   ((a . 1))   ;This is a TOML table
+   )))
+(dolist (el inp)
+  (should (equal nil (tomelr--toml-table-array-p el))
+
 
 (provide 'tinternal)
diff --git a/tomelr.el b/tomelr.el
index c6ef0ba4f8..2c3ed32b74 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -378,7 +378,8 @@ Definition of a TOML Table Array (TTA):
 
 - OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
   TOML Table (TT)."
-  (when (and (not (stringp object))
+  (when (and (not (tomelr--toml-table-p object))
+ (not (stringp object))
  (mapp object)) ;Because `mapp' is non-nil for strings too
 (seq-every-p
  (lambda (elem)



[elpa] externals/tomelr b3b6a28d15 68/84: doc: Add more examples

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit b3b6a28d158845d04f64309f43aab0a9f150c9d1
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Add more examples

[skip ci]
---
 README.org | 103 +
 1 file changed, 103 insertions(+)

diff --git a/README.org b/README.org
index 6cc67ef18e..6afaf2fb0b 100644
--- a/README.org
+++ b/README.org
@@ -15,6 +15,109 @@ This library started off by extracting the JSON Encoding 
pieces from
 the Emacs core library 
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/json.el][*json.el*]].
 
 It was then refactored to meet the specification defined below.
+* API
+This library has only one entry point for simplicity: ~tomelr-encode~.
+
+- Input :: Lisp data expression in Alist or Plist format
+- Ouput :: TOML string
+** Example
+*** Alist data
+#+begin_src emacs-lisp :eval no :noweb-ref data-example-alist
+'((title . "Some Title") ;String
+  (author . ("fn ln"))   ;List
+  (description . "some long description\nthat spans multiple\nlines") 
;Multi-line string
+  (date . 2022-03-14T01:49:00-04:00);RFC 3339 date format
+  (tags . ("tag1" "tag2"))
+  (draft . "false") ;Boolean
+  (versions . ((emacs . "28.1.50") (org . "release_9.5-532-gf6813d"))) ;Map or 
TOML Table
+  (org_logbook . (((timestamp . 2022-04-08T14:53:00-04:00) ;Array of maps or 
TOML Tables
+   (note . "This note addition prompt shows up on typing the 
`C-c C-z` binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."))
+  ((timestamp . 2018-09-06T11:45:00-04:00)
+   (note . "Another note **bold** _italics_."))
+  ((timestamp . 2018-09-06T11:37:00-04:00)
+   (note . "A note `mono`.")
+#+end_src
+
+#+begin_src emacs-lisp :noweb yes :exports none :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+title = "Some Title"
+author = [ "fn ln" ]
+description = """
+some long description
+that spans multiple
+lines"""
+date = 2022-03-14T01:49:00-04:00
+tags = [ "tag1", "tag2" ]
+draft = false
+[versions]
+  emacs = "28.1.50"
+  org = "release_9.5-532-gf6813d"
+[[org_logbook]]
+  timestamp = 2022-04-08T14:53:00-04:00
+  note = """
+This note addition prompt shows up on typing the `C-c C-z` binding.
+See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
+[[org_logbook]]
+  timestamp = 2018-09-06T11:45:00-04:00
+  note = "Another note **bold** _italics_."
+[[org_logbook]]
+  timestamp = 2018-09-06T11:37:00-04:00
+  note = "A note `mono`."
+#+end_src
+*** Plist data
+#+begin_src emacs-lisp :eval no :noweb-ref data-example-plist
+'(:title "Some Title" ;String
+  :author ("fn ln")   ;List
+  :description "some long description\nthat spans multiple\nlines" ;Multi-line 
string
+  :date 2022-03-14T01:49:00-04:00;RFC 3339 date format
+  :tags ("tag1" "tag2")
+  :draft "false" ;Boolean
+  :versions (:emacs "28.1.50" :org "release_9.5-532-gf6813d") ;Map or TOML 
Table
+  :org_logbook ((:timestamp 2022-04-08T14:53:00-04:00  ;Array of maps or TOML 
Tables
+ :note "This note addition prompt shows up on typing the `C-c 
C-z` binding.\nSee 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers).")
+(:timestamp 2018-09-06T11:45:00-04:00
+ :note "Another note **bold** _italics_.")
+(:timestamp 2018-09-06T11:37:00-04:00
+ :note "A note `mono`.")))
+#+end_src
+*** TOML Output
+You will get the below TOML output for either of the above input data.
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+  <>)
+#+end_src
+
+#+RESULTS:
+#+begin_src toml
+title = "Some Title"
+author = [ "fn ln" ]
+description = """
+some long description
+that spans multiple
+lines"""
+date = 2022-03-14T01:49:00-04:00
+tags = [ "tag1", "tag2" ]
+draft = false
+[versions]
+  emacs = "28.1.50"
+  org = "release_9.5-532-gf6813d"
+[[org_logbook]]
+  timestamp = 2022-04-08T14:53:00-04:00
+  note = """
+This note addition prompt shows up on typing the `C-c C-z` binding.
+See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
+[[org_logbook]]
+  timestamp = 2018-09-06T11:45:00-04:00
+  note = "Another note **bold** _italics_."
+[[org_logbook]]
+  timestamp = 2018-09-06T11:37:00-04:00
+  note = "A note `mono`."
+#+end_src
 * Limitation
 Right now, the scalars and tables/array of tables does not get ordered
 in the right order automatically. So the user needs to ensure that the



[elpa] externals/tomelr a1fa47379e 84/84: chore: Add CHANGELOG generated using git cliff tool

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a1fa47379ee104c4292d185ebcfdc8719d499d84
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Add CHANGELOG generated using git cliff tool
---
 CHANGELOG.org  | 166 +
 Makefile   |   6 ++-
 doc/cliff.toml | 129 
 3 files changed, 300 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
new file mode 100644
index 00..121a12c20a
--- /dev/null
+++ b/CHANGELOG.org
@@ -0,0 +1,166 @@
+# This file is auto-generated by running 'make changelog' from the repo root.
+
+* Changelog
+
+All notable changes to this project will be documented in this file.
+
+** *0.1.0* - <2022-05-03>
+
+[[https://github.com/kaushalmodi/tomelr/compare/4434ccc64b1e311b53e8ecc906113bba2e16fa98...568de5efb250c0bb4f19495c69b8b42b41fb186d][4434ccc...568de5e]]
+
+*** :sparkles: Features
+:PROPERTIES:
+:CUSTOM_ID: features-v0.1.0
+:END:
+
+- Support string keys 
([[https://github.com/kaushalmodi/tomelr/commit/ed13b73e9b68ac2c51f3545ac337bbfeba063a42][ed13b73]])
+- Auto-coerce string to boolean 
([[https://github.com/kaushalmodi/tomelr/commit/ebe5959174812ffc3cf7d88040b854599b15a88a][ebe5959]])
+- Auto-coerce string to integers 
([[https://github.com/kaushalmodi/tomelr/commit/a25d952a17d344ac3d7396ae78a34e21b9ada14e][a25d952]])
+
+*** :bug: Bug Fixes
+:PROPERTIES:
+:CUSTOM_ID: bug-fixes-v0.1.0
+:END:
+
+- Auto-stringify symbols like 1.10.1 
([[https://github.com/kaushalmodi/tomelr/commit/ae983711be15d95abd22ae4d7b8c116031de60a0][ae98371]])
+- Auto-stringify and auto-quote symbol values 
([[https://github.com/kaushalmodi/tomelr/commit/ec381fd723c9801caa2353a40d41e8cc8096ea29][ec381fd]])
+- Boolean coercing when value is a symbol true or false 
([[https://github.com/kaushalmodi/tomelr/commit/c2d1328c4404e6af920dc431ba57ee00eef4ba36][c2d1328]])
+- Integer coercing of a number strings with underscores 
([[https://github.com/kaushalmodi/tomelr/commit/a676192b435474fbff53fe361dbf983e3b8ac799][a676192]])
+
+*** :recycle: Refactor
+:PROPERTIES:
+:CUSTOM_ID: refactor-v0.1.0
+:END:
+
+- Don't attempt to triple-quote TOML keys … Triple-quote only when the `type' 
input of `tomelr--print-stringlike' … is nil. 
([[https://github.com/kaushalmodi/tomelr/commit/334b7cba54001708e6819b9df0abf0c553c0d0a2][334b7cb]])
+- Minor code reorg 
([[https://github.com/kaushalmodi/tomelr/commit/b2ba4c46b59d7baa4a6d02ba64657c08776d2d0e][b2ba4c4]])
+
+*** :hammer: Testing
+:PROPERTIES:
+:CUSTOM_ID: testing-v0.1.0
+:END:
+
+- Add a test for string scalar with blank lines 
([[https://github.com/kaushalmodi/tomelr/commit/57bed2cca8b648d2abc6da525a3420b3e968efb4][57bed2c]])
+
+** *0.0.2* - <2022-05-02>
+
+[[https://github.com/kaushalmodi/tomelr/compare/3aa4dc1dbdce5875166b9db76b6de0a0ad679b33...45542fb234fcc4fea50a5fed0c7682d0d3db0f9b][3aa4dc1...45542fb]]
+
+*** :bug: Bug Fixes
+:PROPERTIES:
+:CUSTOM_ID: bug-fixes-v0.0.2
+:END:
+
+- TT with key with array value are detected correctly … Use json-alist-p and 
json-plist-p for TOML Table detection. This … uncomplicated the TOML Table 
logic quite a bit. … Caveat: Lists of plist need t… 
([[https://github.com/kaushalmodi/tomelr/commit/044b5e1a042aa1058792af607b1d7cd4cc70d144][044b5e1]])
+- List format array of plists now detected as TOML Table Array … Also simplify 
tomelr--toml-table-array-p. 
([[https://github.com/kaushalmodi/tomelr/commit/171e5a76824f30730a9e80384a18f3888dd3cc2a][171e5a7]])
+- Compatibility for emacs 26.3 … listp also works instead of proper-list-p 
here. So use that instead. … proper-list-p was introduced in emacs 27.x. 
([[https://github.com/kaushalmodi/tomelr/commit/d86fd721ce4746550038e53dffe34885b06e9225][d86fd72]])
+
+*** :memo: Documentation
+:PROPERTIES:
+:CUSTOM_ID: documentation-v0.0.2
+:END:
+
+- Remove an invalid example 
([[https://github.com/kaushalmodi/tomelr/commit/dc9b2a63f8536d0ee14e480af5f8f273b1a117a9][dc9b2a6]])
+
+*** :recycle: Refactor
+:PROPERTIES:
+:CUSTOM_ID: refactor-v0.0.2
+:END:
+
+- Clean up unused code … Use json-alist-p and json-plist-p directly where 
applicable. 
([[https://github.com/kaushalmodi/tomelr/commit/f9d670e1656f1400b544ff27980657cbf5f8357b][f9d670e]])
+- Remove unnecessary tomelr-encode-keyword … Also, The "keyword" term was 
confusing here; "boolean" makes more … sense. 
([[https://github.com/kaushalmodi/tomelr/commit/41ccea4ebe0619bd6d38d3d8c2174e0b27587df0][41ccea4]])
+- Use `tomelr--toml-table-p` 
([[https://github.com/kaushalmodi/tomelr/commit/4386d99a8596fa244c818b8ae9f341feeeb0b677][4386d99]])
+
+*** :hammer: Testing
+:PROPERTIES:
+:CUSTOM_ID: testing-v0.0.2
+:END:
+
+- Add tests for json.el functions used in tomelr 
([[https://github.com/kaushalmodi/tomelr/commit/406f4922a8677f07d14190d48061ae60169825d5][406f492]])
+
+*** :bento: Other
+:PROPERTIES:
+:CUSTOM_ID: other-v0.0.2
+:END:
+
+- Revert "doc: Update the medley example" … This reverts commit commit # 
[[https://github.com/kaushalmodi/tomelr/com

[elpa] externals/tomelr dc9b2a63f8 60/84: doc: Remove an invalid example

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit dc9b2a63f8536d0ee14e480af5f8f273b1a117a9
Author: Kaushal Modi 
Commit: Kaushal Modi 

doc: Remove an invalid example
---
 README.org | 16 
 1 file changed, 16 deletions(-)

diff --git a/README.org b/README.org
index 21f1f0540d..d741e99b22 100644
--- a/README.org
+++ b/README.org
@@ -708,10 +708,6 @@ CLOSED: [2022-04-30 Sat 01:32]
   (integers . (123 -5 17 1234))
   (floats . (12.3 -5.0 -1.7e-05))
   (booleans . (t :false))
-  (contributors . ("Foo Bar "
-   ((name . "Baz Qux")
-(email . "baz...@example.com")
-(url . "https://example.com/bazqux";
   (dog . ((legs . 4)
   (eyes . 2)
   (friends . ("poo" "boo"
@@ -767,10 +763,6 @@ strings-symbols = ["abc", "def", "two words"]
 integers = [123, -5, 17, 1_234]
 floats = [12.3, -5.0, -1.7e-05]
 booleans = [true, false]
-contributors = [
-  "Foo Bar ",
-  { name = "Baz Qux", email = "baz...@example.com", url = 
"https://example.com/bazqux"; }
-]
 [dog]
   legs = 4
   eyes = 2
@@ -894,14 +886,6 @@ contributors = [
 true,
 false
   ],
-  "contributors": [
-"Foo Bar ",
-{
-  "name": "Baz Qux",
-  "email": "baz...@example.com",
-  "url": "https://example.com/bazqux";
-}
-  ],
   "dog": {
 "legs": 4,
 "eyes": 2,



[elpa] externals/tomelr 45542fb234 67/84: chore: Bump version

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 45542fb234fcc4fea50a5fed0c7682d0d3db0f9b
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Bump version
---
 tomelr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tomelr.el b/tomelr.el
index 54e0164b64..b97d2e77b2 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -4,7 +4,7 @@
 ;; URL: https://github.com/kaushalmodi/tomelr
 ;; Package-Requires: ((emacs "26.3"))
 ;; Keywords: TOML, config
-;; Version: v0.0.1
+;; Version: v0.0.2
 
 ;; This file is not part of GNU Emacs.
 



[elpa] externals/tomelr f9d670e165 56/84: refactor: Clean up unused code

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit f9d670e1656f1400b544ff27980657cbf5f8357b
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor: Clean up unused code

Use json-alist-p and json-plist-p directly where applicable.
---
 tomelr.el | 69 +--
 1 file changed, 5 insertions(+), 64 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 520b702cf5..b7112771f0 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -42,13 +42,6 @@
   "String used for a single indentation level during encoding.
 This value is repeated for each further nested element.")
 
-(defvar tomelr-encoding-object-sort-predicate nil
-  "Sorting predicate for TOML object keys during encoding.
-If nil, no sorting is performed.  Else, TOML object keys are
-ordered by the specified sort predicate during encoding.  For
-instance, setting this to `string<' will have TOML object keys
-ordered alphabetically.")
-
  Internal Variables
 (defvar tomelr--print-indentation-prefix "\n"
   "String used to start indentation during encoding.")
@@ -92,22 +85,6 @@ Examples:
 
 ;;; Utilities
 
-(defun tomelr-alist-p (list)
-  "Non-nil if and only if LIST is an alist with simple keys."
-  (declare (pure t) (side-effect-free error-free))
-  (while (and (consp (car-safe list))
-  (atom (caar list))
-  (setq list (cdr list
-  (null list))
-
-(defun tomelr-plist-p (list)
-  "Non-nil if and only if LIST is a plist with keyword keys."
-  (declare (pure t) (side-effect-free error-free))
-  (while (and (keywordp (car-safe list))
-  (consp (cdr list))
-  (setq list (cddr list
-  (null list))
-
 (defmacro tomelr--with-output-to-string (&rest body)
   "Eval BODY in a temporary buffer bound to `standard-output'.
 Return the resulting buffer contents as a string."
@@ -342,49 +319,14 @@ This works for any MAP satisfying `mapp'."
 (tomelr--with-indentation
   (map-do #'tomelr--print-pair map
 
-(defun tomelr--print-unordered-map (map)
-  "Insert a TOML representation of MAP at point, but optionally sort MAP first.
-
-If `tomelr-encoding-object-sort-predicate' is non-nil, this first
-transforms an unsortable MAP into a sortable alist.
-
-See `tomelr-encode-plist' that returns the same as a string."
-  (if (and tomelr-encoding-object-sort-predicate
-   (not (map-empty-p map)))
-  (tomelr--print-alist (map-pairs map) t)
-(tomelr--print-map map)))
-
  Lists (including alists and plists)
-(defun tomelr--print-alist (alist &optional destructive)
-  "Insert a TOML representation of ALIST at point.
-
-Sort ALIST first if `tomelr-encoding-object-sort-predicate' is
-non-nil.  Sorting can optionally be DESTRUCTIVE for speed.
-
-See `tomelr-encode-alist' that returns the same as a string."
-  (tomelr--print-map (if (and tomelr-encoding-object-sort-predicate alist)
- (sort (if destructive alist (copy-sequence alist))
-   (lambda (a b)
- (funcall tomelr-encoding-object-sort-predicate
-  (car a) (car b
-   alist)))
-
-;; The following two are unused but useful to keep around due to the
-;; inherent ambiguity of lists.
-(defun tomelr-encode-alist (alist)
-  "Return a TOML representation of ALIST."
-  (tomelr--with-output-to-string (tomelr--print-alist alist)))
-
-(defun tomelr-encode-plist (plist)
-  "Return a TOML representation of PLIST."
-  (tomelr--with-output-to-string (tomelr--print-unordered-map plist)))
-;;
-
 (defun tomelr--print-list (list)
   "Insert a TOML representation of LIST at point."
-  (cond ((tomelr-alist-p list) (tomelr--print-alist list))
-((tomelr-plist-p list) (tomelr--print-unordered-map list))
-((listp list)  (tomelr--print-array list))
+  (cond ((or (json-alist-p list)
+ (json-plist-p list))
+ (tomelr--print-map list))
+((listp list)
+ (tomelr--print-array list))
 ((signal 'tomelr-error (list list)
 
  Arrays
@@ -482,7 +424,6 @@ See `tomelr-encode' that returns the same as a string."
 ((tomelr--print-stringlike object))
 ((numberp object)   (prin1 object))
 ((arrayp object)(tomelr--print-array object))
-((hash-table-p object)  (tomelr--print-unordered-map object))
 ((signal 'tomelr-error (list object)
 
 



[elpa] externals/tomelr d86fd721ce 63/84: fix: Compatibility for emacs 26.3

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit d86fd721ce4746550038e53dffe34885b06e9225
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Compatibility for emacs 26.3

listp also works instead of proper-list-p here. So use that instead.

proper-list-p was introduced in emacs 27.x.
---
 tomelr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tomelr.el b/tomelr.el
index 6d9d9ffee0..e84c96b10d 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -311,7 +311,7 @@ Definition of a TOML Table Array (TTA):
 
 - OBJECT is TTA if it is of type ((TT1) (TT2) ..) where each element is a
   TOML Table (TT)."
-  (when (or (proper-list-p object)
+  (when (or (listp object)
 (vectorp object))
 (seq-every-p
  (lambda (elem) (tomelr--toml-table-p elem))



[elpa] externals/tomelr 4434ccc64b 70/84: chore: Bump version

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 4434ccc64b1e311b53e8ecc906113bba2e16fa98
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Bump version
---
 tomelr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tomelr.el b/tomelr.el
index faa2402f88..1779620483 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -4,7 +4,7 @@
 ;; URL: https://github.com/kaushalmodi/tomelr
 ;; Package-Requires: ((emacs "26.3"))
 ;; Keywords: data, tools
-;; Version: 0.0.2
+;; Version: 0.0.3
 
 ;; This file is not part of GNU Emacs.
 



[elpa] externals/tomelr df0e73334f 59/84: Revert "doc: Update the medley example"

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit df0e73334f918ee9de7e1f0a7cd0fb9037a79faa
Author: Kaushal Modi 
Commit: Kaushal Modi 

Revert "doc: Update the medley example"

This reverts commit 26f1fc2f3c0245e69c8c72b0cd01024f9d53078b.
---
 README.org | 129 +
 1 file changed, 69 insertions(+), 60 deletions(-)

diff --git a/README.org b/README.org
index e6a77a1f5a..21f1f0540d 100644
--- a/README.org
+++ b/README.org
@@ -708,53 +708,51 @@ CLOSED: [2022-04-30 Sat 01:32]
   (integers . (123 -5 17 1234))
   (floats . (12.3 -5.0 -1.7e-05))
   (booleans . (t :false))
-  (dog . (:legs 4
-  :eyes 2
-  :friends ("poo" "boo")))
+  (contributors . ("Foo Bar "
+   ((name . "Baz Qux")
+(email . "baz...@example.com")
+(url . "https://example.com/bazqux";
+  (dog . ((legs . 4)
+  (eyes . 2)
+  (friends . ("poo" "boo"
   (header . ((image . "projects/Readingabook.jpg")
  (caption . "stay hungry stay foolish")))
-  (collection . (:nothing :false
- :nonnil t
- :animals ("dog" "cat" "penguin" "mountain gorilla")
- :strings-symbols ("abc" "def" "two words")
- :integers (123 -5 17 1234)
- :floats (12.3 -5.0 -1.7e-05)
- :booleans (t :false)))
+  (collection . ((nothing . :false)
+ (nonnil . t)
+ (animals . ("dog" "cat" "penguin" "mountain gorilla"))
+ (strings-symbols . ("abc" "def" "two words"))
+ (integers . (123 -5 17 1234))
+ (floats . (12.3 -5.0 -1.7e-05))
+ (booleans . (t :false
   (menu . ((foo . ((identifier . "keyword-collection")
(weight . 10)
-  (resources . [(:src "*.png"
- :name "my-cool-image-:counter"
- :title "The Image #:counter"
- :params (:foo "bar"
-  :floats (12.3 -5.0 -1.7e-05)
-  :strings-symbols ("abc" "def" "two words")
-  :animals ("dog" "cat" "penguin" "mountain gorilla")
-  :integers (123 -5 17 1234)
-  :booleans (t :false)
-  :byline "bep"))
-(:src "image-4.png"
- :title "The Fourth Image")
-(:src "*.jpg"
- :title "JPEG Image #:counter")]))
+  (resources . (((src . "*.png")
+ (name . "my-cool-image-:counter")
+ (title . "The Image #:counter")
+ (params . ((foo . "bar")
+(floats . (12.3 -5.0 -1.7e-05))
+(strings-symbols . ("abc" "def" "two words"))
+(animals . ("dog" "cat" "penguin" "mountain 
gorilla"))
+(integers . (123 -5 17 1234))
+(booleans . (t :false))
+(byline . "bep"
+((src . "image-4.png")
+ (title . "The Fourth Image"))
+((src . "*.jpg")
+ (title . "JPEG Image #:counter")
 #+end_src
 *** TOML
-#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
-(tomelr-encode
-  <>)
-#+end_src
-
-#+RESULTS:
 #+begin_src toml
 title = "Keyword Collection"
-author = [ "firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3" ]
-aliases = [ "/posts/keyword-concatenation", "/posts/keyword-merging" ]
-images = [ "image 1", "image 2" ]
-keywords = [ "keyword1", "keyword2", "three word keywords3" ]
-outputs = [ "html", "json" ]
-series = [ "series 1", "series 2" ]
-tags = [ "mega front-matter", "keys", "collection", "concatenation", "merging" 
]
-categories = [ "cat1", "cat2" ]
-videos = [ "video 1", "video 2" ]
+author = ["firstname1 lastname1", "firstname2 lastname2", "firstname3 
lastname3"]
+aliases = ["/posts/keyword-concatenation", "/posts/keyword-merging"]
+images = ["image 1", "image 2"]
+keywords = ["keyword1", "keyword2", "three word keywords3"]
+outputs = ["html", "json"]
+series = ["series 1", "series 2"]
+tags = ["mega front-matter", "keys", "collection", "concatenation", "merging"]
+categories = ["cat1", "cat2"]
+videos = ["video 1", "video 2"]
 draft = false
 categories_weight = 999
 tags_weight = 88
@@ -764,41 +762,44 @@ mybaz = "zoo"
 alpha = 1
 beta = "two words"
 gamma = 10
-animals = [ "dog", "cat", "penguin", "mountain gorilla" ]
-strings-symbols = [ "abc", "def", "two words" ]
-integers = [ 123, -5, 17, 1234 ]
-floats = [ 12.3, -5.0, -1.7e-05 ]
-booleans = [ true, false ]
+animals = ["dog", "cat", "penguin", "mountain gorilla"]
+strings-symbols = ["abc", "def", "two words"]
+integers = [123, -5, 17, 1_234]
+floats = [12.3, -5.0, -1.7e-05]
+booleans = [true, false]
+contributors = [
+  "Foo Bar ",
+  { name = "Baz Qux", email = "baz...@example.com", url 

[elpa] externals/tomelr 57bed2cca8 73/84: test: Add a test for string scalar with blank lines

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 57bed2cca8b648d2abc6da525a3420b3e968efb4
Author: Kaushal Modi 
Commit: Kaushal Modi 

test: Add a test for string scalar with blank lines
---
 test/tscalar.el | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/test/tscalar.el b/test/tscalar.el
index 47d38167be..e6ede6d85a 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -78,15 +78,28 @@
 
  Scalar - String
 (ert-deftest test-scalar-string ()
-  (let ((inp '(((string1 . "Roses are red"))
+  (let ((inp '(
+   ((string1 . "Roses are red"))
((string2 . "Roses are red\nViolets are blue")) ;Newline in 
string
-   ((string3 . "\"Hello!\"" ;Quote in string
-(ref '("string1 = \"Roses are red\""
+   ((string3 . "\"Hello!\"")) ;Quote in string
+   ((string4 . "Line 1\n\nLine 3\n\n  Line 5 with 2 space 
indentation\n\nLine 7")) ;Blank lines in string
+   ))
+(ref '(
+   "string1 = \"Roses are red\""
"string2 = \"\"\"
 Roses are red
 Violets are blue\"\"\""
"string3 = \"\"\"
-\"Hello!\"\"\"\""))
+\"Hello!\"\"\"\""
+   "string4 = \"\"\"
+Line 1
+
+Line 3
+
+  Line 5 with 2 space indentation
+
+Line 7\"\"\""
+   ))
 out)
 (dolist (el inp)
   (push (tomelr-encode el) out))



[elpa] externals/tomelr 511240765b 71/84: chore: Ignore .elc files

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit 511240765b93e8741f72b795798d728d659d14ae
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Ignore .elc files
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00..c531d9867f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.elc



[elpa] externals/tomelr ed13b73e9b 74/84: feat: Support string keys

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit ed13b73e9b68ac2c51f3545ac337bbfeba063a42
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Support string keys
---
 README.org| 14 -
 test/all-tests.el |  1 +
 test/tinternal.el |  8 ++--
 test/tkey.el  | 59 +++
 test/ttable.el| 33 +++
 tomelr.el | 10 +-
 6 files changed, 121 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 3bf0b13e59..8afb94fad9 100644
--- a/README.org
+++ b/README.org
@@ -590,7 +590,9 @@ CLOSED: [2022-04-29 Fri 14:30]
 '((table-1 . ((table-1a . ((key1 . "some string")
(key2 . 123)))
   (table-1b . ((key1 . "foo")
-   (key2 . 98765))
+   (key2 . 98765)
+  (menu . (("auto weight" . ((weight . 4033)
+ (identifier . "foo"))
 #+end_src
  TOML
 #+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
@@ -607,6 +609,10 @@ CLOSED: [2022-04-29 Fri 14:30]
   [table-1.table-1b]
 key1 = "foo"
 key2 = 98765
+[menu]
+  [menu."auto weight"]
+weight = 4033
+identifier = "foo"
 #+end_src
  JSON Reference
 #+begin_src emacs-lisp :noweb yes :exports results
@@ -626,6 +632,12 @@ CLOSED: [2022-04-29 Fri 14:30]
   "key1": "foo",
   "key2": 98765
 }
+  },
+  "menu": {
+"auto weight": {
+  "weight": 4033,
+  "identifier": "foo"
+}
   }
 }
 #+end_example
diff --git a/test/all-tests.el b/test/all-tests.el
index adab51f609..c25fd78e48 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -24,6 +24,7 @@
 (require 'tjson-utils)
 (require 'tinternal)
 
+(require 'tkey)
 (require 'tscalar)
 (require 'tnil)
 (require 'tarray)
diff --git a/test/tinternal.el b/test/tinternal.el
index 3aa23cb06f..2a51a0b6b2 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -30,8 +30,12 @@
((a . 1) (b . 2))
;; Nested TT
((a . 1)
-(b . ((c . 3)
-  (d . 4
+(b . ((c . ((d . 3)
+(e . 4))
+   ;; Nested TT with string key
+   ((a . 1)
+(b . (("some key" . ((d . 3)
+ (e . 4))
;; Nested TTA
((a . 1)
 (b . (((c . 3))
diff --git a/test/tkey.el b/test/tkey.el
new file mode 100644
index 00..de3453d098
--- /dev/null
+++ b/test/tkey.el
@@ -0,0 +1,59 @@
+;; -*- lexical-binding: t; -*-
+
+;; Authors: Kaushal Modi 
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+
+;; Test conversion to TOML keys.
+
+;;; Code:
+(require 'tomelr)
+
+ Scalar - Boolean
+(ert-deftest test-key-with-space ()
+  (let ((inp '(
+   (("some key" . t))
+   ))
+(ref '(
+   "\"some key\" = true"
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+(ert-deftest test-table-name-with-space ()
+  (let ((inp '(
+   ((menu .
+  (("auto weight" .
+((weight . 4033)
+ (identifier . "foo"))
+   ))
+(ref '(
+   "[menu]
+  [menu.\"auto weight\"]
+weight = 4033
+identifier = \"foo\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+
+(provide 'tkey)
diff --git a/test/ttable.el b/test/ttable.el
index c84fc0bf60..d1e70b19a5 100644
--- a/test/ttable.el
+++ b/test/ttable.el
@@ -81,5 +81,38 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+(ert-deftest test-nested-table-string-keys ()
+  (let ((inp '(
+   ((table-1 . (("some key" . ((key1 . "some string")
+   (key2 . 123))
+   ((table-1 . ((table-1a . ((key1 . "some string")
+ (key2 . 123)))
+(table-1b . ((key1 . "foo")
+ (key2 . 98765)
+(menu . (("auto weight" . ((weight . 40

[elpa] externals/tomelr a25d952a17 77/84: feat: Auto-coerce string to integers

2022-05-03 Thread ELPA Syncer
branch: externals/tomelr
commit a25d952a17d344ac3d7396ae78a34e21b9ada14e
Author: Kaushal Modi 
Commit: Kaushal Modi 

feat: Auto-coerce string to integers
---
 test/tcoerce.el | 38 ++
 tomelr.el   | 22 +++---
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/test/tcoerce.el b/test/tcoerce.el
index 4e10dd7714..975f8625b8 100644
--- a/test/tcoerce.el
+++ b/test/tcoerce.el
@@ -55,5 +55,43 @@
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ Integer Coercing
+(ert-deftest test-coerce-integer-yes ()
+  (let ((tomelr-coerce-to-types '(integer))
+(inp '(
+   ((key . "-123"))
+   ((key . "0"))
+   ((key . "123"))
+   ;; Number too large~
+   ;; (fixnump (string-to-number "10040216507682529280")) ;=> nil
+   ;; So this number won't be coerced.
+   ((key . "10040216507682529280"))
+   ))
+(ref '(
+   "key = -123"
+   "key = 0"
+   "key = 123"
+   "key = \"10040216507682529280\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
+(ert-deftest test-coerce-integer-no ()
+  (let ((tomelr-coerce-to-types '())
+(inp '(
+   ((key . "123"))
+   ((key . "10040216507682529280"))
+   ))
+(ref '(
+   "key = \"123\""
+   "key = \"10040216507682529280\""
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'tcoerce)
diff --git a/tomelr.el b/tomelr.el
index 858da82d89..3a93c750c8 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -42,7 +42,7 @@
   "String used for a single indentation level during encoding.
 This value is repeated for each further nested element.")
 
-(defvar tomelr-coerce-to-types '(boolean)
+(defvar tomelr-coerce-to-types '(boolean integer)
   "List of TOML types to which the TOML strings will be attempted to be 
coerced.
 
 Valid symbols that can be present in this list: boolean, integer, float
@@ -240,8 +240,24 @@ Return nil if OBJECT cannot be encoded as a TOML string."
  ((equal type 'table-array-key)
   (princ (format "[[%s]]" (string-join tomelr--print-table-hierarchy 
"."
  ((stringp object)
-  ;; (message "[tomelr--print-stringlike DBG] %S is string" object)
-  (tomelr--print-string sym-name type))
+  (cond
+   ;; If it an integer that can be stored in the system as a
+   ;; fixnum.  For example, if `object' is "10040216507682529280"
+   ;; that needs more than 64 bits to be stored as a signed
+   ;; integer, it will be automatically stored as a float.  So
+   ;; (integerp (string-to-number object)) will return nil [or
+   ;; `fixnump' instead of `integerp' in Emacs 27 or newer]
+   ;; https://github.com/toml-lang/toml#integer
+   ;; Integer examples: 7, +7, -7, 7_000
+   ((and (member 'integer tomelr-coerce-to-types)
+ (string-match-p "\\`[+-]?[[:digit:]_]+\\'" object)
+ (if (functionp #'fixnump) ;`fixnump' and `bignump' get introduced 
in Emacs 27.x
+ (fixnump (string-to-number object))
+   (integerp (string-to-number object ;On older Emacsen, 
`integerp' behaved the same as the new `fixnump'
+(princ object))
+   (t
+;; (message "[tomelr--print-stringlike DBG] %S is string" object)
+(tomelr--print-string sym-name type
  ((keywordp object)
   ;; (message "[tomelr--print-stringlike DBG] %S is keyword" object)
   (tomelr--print-string sym-name 'keyword))



[nongnu] elpa/evil f6866b5d2b: `evil-ex': `eval-expression' auto-completion (#1398)

2022-05-03 Thread ELPA Syncer
branch: elpa/evil
commit f6866b5d2b85a38ad8029f83b113371d1b3aecd1
Author: nbfalcon 
Commit: GitHub 

`evil-ex': `eval-expression' auto-completion (#1398)

Add auto-completion for `evil-ex' LISP expressions leveraging
`elisp-completion-at-point' if available.
---
 evil-ex.el | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/evil-ex.el b/evil-ex.el
index c58ea130de..3120e791e4 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -238,6 +238,12 @@ Otherwise behaves like `delete-backward-char'."
   (insert result)
   (exit-minibuffer))
 
+(defun evil-ex-elisp-completion-at-point ()
+  "Complete an `evil-ex' Elisp expression."
+  (when (and (fboundp 'elisp-completion-at-point)
+ (string-prefix-p "(" (minibuffer-contents-no-properties)))
+(elisp-completion-at-point)))
+
 (defun evil-ex-setup ()
   "Initialize Ex minibuffer.
 This function registers several hooks that are used for the
@@ -251,7 +257,8 @@ interactive actions during ex state."
   (with-no-warnings
 (make-variable-buffer-local 'completion-at-point-functions))
   (setq completion-at-point-functions
-'(evil-ex-command-completion-at-point
+'(evil-ex-elisp-completion-at-point
+  evil-ex-command-completion-at-point
   evil-ex-argument-completion-at-point)))
 (put 'evil-ex-setup 'permanent-local-hook t)
 



  1   2   >