branch: externals/yaml commit cb1cc42bd13285cf2029b5a5dcd65e46e4e1f5af Merge: c07cc6d0f3 e32ef2f5e5 Author: Zachary Romero <zacrom...@posteo.net> Commit: GitHub <nore...@github.com>
Merge pull request #36 from zkry/fix-string-values-state-bug Fix string values state bug --- yaml-tests.el | 6 +++++- yaml.el | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/yaml-tests.el b/yaml-tests.el index 8b31e851b0..cd5155d537 100644 --- a/yaml-tests.el +++ b/yaml-tests.el @@ -386,7 +386,11 @@ ship-to: " :object-type 'alist :object-key-type 'string - :string-values t)))) + :string-values t))) + (should (equal (progn + (yaml-parse-string-with-pos "- # Empty\n- abc") + (yaml-parse-string "- # Empty\n- abc")) + [:null "abc"]))) (ert-deftest yaml-parsing-completes () diff --git a/yaml.el b/yaml.el index 317b85050b..cfae27374d 100644 --- a/yaml.el +++ b/yaml.el @@ -1064,8 +1064,9 @@ then check EXPR at the current position." ((equal 'list sequence-type) (setq yaml--parsing-sequence-type 'list)) (t (error "Invalid sequence-type. sequence-type must be list or array"))) - (when string-values - (setq yaml--string-values t)))) + (if string-values + (setq yaml--string-values t) + (setq yaml--string-values nil)))) (defun yaml-parse-string (string &rest args) "Parse the YAML value in STRING. Keyword ARGS are as follows: @@ -1114,7 +1115,10 @@ value. It defaults to the symbol :false." res)) (defun yaml-parse-string-with-pos (string) - "Parse the YAML value in STRING, storing positions as text properties." + "Parse the YAML value in STRING, storing positions as text properties. + +NOTE: This is an experimental feature and may experience API +changes in the future." (let ((yaml--parsing-store-position t)) (yaml-parse-string string :object-type 'alist