[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 6d52649383 076/124: Fix list encoding indentation
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 6d52649383 076/124: Fix list encoding indentation #29 |
Date: |
Fri, 29 Nov 2024 16:00:03 -0500 (EST) |
branch: externals/yaml
commit 6d52649383e8d80b8744ffb52b1dbe20e6870758
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
Fix list encoding indentation #29
---
yaml-tests.el | 6 ++++++
yaml.el | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 7a3aae569e..739dfec945 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -540,6 +540,12 @@ keep: |+
(should (equal
(yaml-encode [1 2 3])
"[1, 2, 3]"))
+ (should (equal
+ (yaml-encode `[((foo . bar) (baz . bax))])
+ "\n- foo: bar\n baz: bax"))
+ (should (equal
+ (yaml-encode `((deeper . [((foo . bar) (baz . bax))])))
+ "\ndeeper: \n- foo: bar\n baz: bax"))
(should (yaml-test-round-trip
'((build_the_package (script . "if [ -z \"${CUSTOM}\" ]; then
./mvnw package
diff --git a/yaml.el b/yaml.el
index 2ed9cf58a6..718e111c97 100644
--- a/yaml.el
+++ b/yaml.el
@@ -2787,8 +2787,10 @@ auto-detecting the indentation"
(cdr l))
(insert "]"))
(t
- (let ((first t)
- (indent-string (make-string (* 2 indent) ?\s)))
+ (when (zerop indent)
+ (setq indent 2))
+ (let* ((first t)
+ (indent-string (make-string (- indent 2) ?\s)))
(seq-do
(lambda (object)
(if (not first)
@@ -2798,7 +2800,7 @@ auto-detecting the indentation"
(insert (make-string (- indent curr-indent) ?\s) "-
"))
(insert "\n" indent-string "- "))
(setq first nil))
- (yaml--encode-object object (+ indent 2)
+ (yaml--encode-object object indent
(or
(hash-table-p object)
(yaml--alist-to-hash-table object))))
- [elpa] externals/yaml a15b045399 010/124: Condense grammar functions to one, (continued)
- [elpa] externals/yaml a15b045399 010/124: Condense grammar functions to one, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0bb76de608 009/124: Add YAML scalar conversion and type conversion, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 840be1b2b2 012/124: | blocks parse, initial wip, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 64c117d084 052/124: Fix encoding issues for nil, false, and arrays, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 67d86e158e 033/124: Add code documentation; remove unused code, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 091521769e 019/124: Add readme file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 8a3303b59e 015/124: Fix indentation bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 9ebddb5523 047/124: Merge pull request #5 from zkry/improve-parsing-error-message, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0db4ab0a1e 046/124: Improve parsing error message, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml e2fe7e2e57 042/124: Merge pull request #3 from zkry/add-yaml-spec-json, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 6d52649383 076/124: Fix list encoding indentation #29,
ELPA Syncer <=
- [elpa] externals/yaml bda9a00090 058/124: return alist key as a symbol as a default, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 45aa819a4f 068/124: Add MELPA tag to README, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 37c176fc5c 086/124: Fix the anchor parse event turning maps into lists, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml f546dac2a8 082/124: Initial implementation of position storage, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml c07cc6d0f3 089/124: Merge pull request #35 from zkry/fix-yaml-anchor-match-definition, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 14e6e4bc3d 095/124: Merge pull request #37 from zkry/fix-folded-block-parsing-error, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0ac7f365bb 104/124: Merge pull request #41 from zkry/fix-property-prop-bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 900ca55584 119/124: Fix failing test for parsing scalars, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 964ef3b105 014/124: process literal and folded, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a1d6e3211c 007/124: Initial working yaml-parser, ELPA Syncer, 2024/11/29