syohex / emacs-libyaml

libyaml binding of Emacs Lisp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libyaml.el

libyaml binding for Emacs Lisp.

Requirements

  • Emacs 25 or higher(configured with --with-modules)
  • libyaml

Interfaces

(yaml-read-from-string string)

Parse string and return Emacs Lisp objects.

(yaml-read-file file)

Read YAML file and return Emacs Lisp objects.

(yaml-dump obj)

Dump Emacs Lisp object to YAML string.

Conversion Rule

YAML Emacs Lisp
123 integer
123.4 float
"123" string
t, On, Yes, TRUE t : symbol
n, No, Off, False nil : symbol
- aaa
- bbb
vector
name: Foo
year: 19
hash-table

Examples

Example

(let ((hash (make-hash-table)))
  (puthash 'a 12 hash)
  (puthash 'b 12 hash)
  (yaml-dump hash))
---
a: 12
b: 12
...

Example

(let (hash
      (hash-1 (make-hash-table))
      (hash-2 (make-hash-table)))
  (puthash 'a 12 hash-1)
  (puthash 'b 12 hash-1)
  (puthash 'a 12 hash-2)
  (puthash 'b 12 hash-2)
  (setq hash `[,hash-1 ,hash-2])
  (yaml-dump hash))
---
- a: 12
  b: 12
- a: 12
  b: 12
...

About

libyaml binding of Emacs Lisp

License:GNU General Public License v3.0


Languages

Language:C 75.1%Language:Emacs Lisp 21.7%Language:Makefile 3.1%