[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr 3c068fb9d9 34/84: refactor: Move TOML Table dete
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr 3c068fb9d9 34/84: refactor: Move TOML Table detection logic to a separate fn |
Date: |
Tue, 3 May 2022 09:58:10 -0400 (EDT) |
branch: externals/tomelr
commit 3c068fb9d9319d2876de359d2bc9068b857e091b
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
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 69217d47a6 22/84: feat: Skip converting keys whose values are nil, (continued)
- [elpa] externals/tomelr 69217d47a6 22/84: feat: Skip converting keys whose values are nil, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr af40c0b40f 11/84: fix: Require subr-x for older Emacs versions, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 060c38b934 16/84: chore(readme): Limit up to 3 levels of headings for Org exports, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 20bf9e6c54 12/84: chore(doc): Add GHA and license badges, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr f37841cc78 25/84: test: Add test for TOML Array of Arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr cedb75df72 29/84: feat: Support basic TOML tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 91800b26b8 21/84: feat: Recognize RFC 3339 formatted date-time + offset, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 83e924559e 13/84: chore(doc): Fix typo, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 98c9b8c1fc 26/84: fix: Use `=` and `length` separately instead of `length=`, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr c0962ba15f 33/84: fix: Don't run plist to TOML conversion test on emacs 26.3 and older, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 3c068fb9d9 34/84: refactor: Move TOML Table detection logic to a separate fn,
ELPA Syncer <=
- [elpa] externals/tomelr ad8366d904 36/84: feat: Support basic TOML Table Arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 55fefb0fa8 40/84: doc: Add few links, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 38160ef271 41/84: fix: Stricter condition before starting TOML table array check, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a7b3a57037 48/84: feat: Make a very basic nested array of TTA work, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 3aa4dc1dbd 54/84: chore: Add Package-Requires and other info in the header comment, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr f3b6951cfe 53/84: doc: Add note that the scalars need to be earlier in the order, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 192cb06a23 57/84: chore(style): Whitespace change only, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 6d2be83669 69/84: chore: package-lint fixes, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 41ccea4ebe 64/84: refactor: Remove unnecessary tomelr-encode-keyword, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 406f4922a8 58/84: test: Add tests for json.el functions used in tomelr, ELPA Syncer, 2022/05/03