[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr 7f331a8c0d: refactor: Use append instead of push
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr 7f331a8c0d: refactor: Use append instead of push+reverse |
Date: |
Wed, 11 May 2022 16:57:55 -0400 (EDT) |
branch: externals/tomelr
commit 7f331a8c0d4ab1f25b6f8b8749f8cb7a6ad274a6
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
refactor: Use append instead of push+reverse
---
tomelr.el | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/tomelr.el b/tomelr.el
index 7007b25254..916191aa33 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -283,24 +283,23 @@ Return nil if OBJECT cannot be encoded as a TOML string."
;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S,
depth = %d"
;; object key-type tomelr--print-indentation-depth)
(if (null (nth tomelr--print-indentation-depth
tomelr--print-table-hierarchy))
- (progn
- (push str tomelr--print-table-hierarchy))
+ (setq tomelr--print-table-hierarchy
+ (append tomelr--print-table-hierarchy (list str)))
;; Throw away table keys collected at higher depths, if
;; any, from earlier runs of this function.
(setq tomelr--print-table-hierarchy
- (reverse (seq-take (reverse tomelr--print-table-hierarchy)
- (1+ tomelr--print-indentation-depth))))
- (setf (nth 0 tomelr--print-table-hierarchy) str))
+ (seq-take tomelr--print-table-hierarchy (1+
tomelr--print-indentation-depth)))
+ (setf (nth tomelr--print-indentation-depth
tomelr--print-table-hierarchy) str))
;; (message "[tomelr--print-stringlike DBG] table hier: %S"
tomelr--print-table-hierarchy)
)
(cond
;; TT keys
((equal key-type 'table-key)
- (princ (format "[%s]" (string-join (reverse
tomelr--print-table-hierarchy) "."))))
+ (princ (format "[%s]" (string-join tomelr--print-table-hierarchy "."))))
;; TTA keys
((equal key-type 'table-array-key)
- (princ (format "[[%s]]" (string-join (reverse
tomelr--print-table-hierarchy) "."))))
+ (princ (format "[[%s]]" (string-join tomelr--print-table-hierarchy
"."))))
;; Normal keys (Alist and Plist keys)
((equal key-type 'normal-key)
(princ str))
@@ -426,11 +425,11 @@ Definition of a TOML Table Array (TTA):
;; Throw away table keys collected at higher depths, if
;; any, from earlier runs of this function.
(setq tomelr--print-table-hierarchy
- (reverse (seq-take (reverse tomelr--print-table-hierarchy)
- (1+ tomelr--print-indentation-depth))))
+ (seq-take tomelr--print-table-hierarchy (1+
tomelr--print-indentation-depth)))
+
(tomelr--print-indentation)
(insert
- (format "[[%s]]" (string-join (reverse tomelr--print-table-hierarchy)
"."))))
+ (format "[[%s]]" (string-join tomelr--print-table-hierarchy "."))))
(defun tomelr--print-array (array)
"Insert a TOML representation of ARRAY at point."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/tomelr 7f331a8c0d: refactor: Use append instead of push+reverse,
ELPA Syncer <=