Add scripts for dumping the org-mode ast to investigate how emacs parses various inputs.
This commit is contained in:
parent
bf3464c65c
commit
4e7d7d3bcf
1
org_mode_samples/.gitignore
vendored
Normal file
1
org_mode_samples/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.tree.txt
|
8
org_mode_samples/common.el
Normal file
8
org_mode_samples/common.el
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
(defun org-dump-ast (outpath)
|
||||||
|
(let
|
||||||
|
((parsed-tree (format "%s" (org-element-parse-buffer))))
|
||||||
|
(with-temp-file outpath
|
||||||
|
(insert parsed-tree)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
17
org_mode_samples/dump_org_ast.bash
Executable file
17
org_mode_samples/dump_org_ast.bash
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
INPUT_FILE="$1"
|
||||||
|
OUTPUT_FILE="$2"
|
||||||
|
|
||||||
|
INIT_SCRIPT=$(cat <<EOF
|
||||||
|
(progn
|
||||||
|
(org-mode)
|
||||||
|
(org-dump-ast "$OUTPUT_FILE")
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
exec emacs -q --no-site-file --no-splash --batch --load "$DIR/common.el" --insert "$INPUT_FILE" --eval "$INIT_SCRIPT"
|
22
org_mode_samples/plain_lists/Makefile
Normal file
22
org_mode_samples/plain_lists/Makefile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
SHELL := bash
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
|
.DELETE_ON_ERROR:
|
||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
MAKEFLAGS += --no-builtin-rules
|
||||||
|
OUT=out
|
||||||
|
|
||||||
|
ifeq ($(origin .RECIPEPREFIX), undefined)
|
||||||
|
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
|
||||||
|
endif
|
||||||
|
.RECIPEPREFIX = >
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: paragraphs.tree.txt
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
> rm -rf *.tree.txt
|
||||||
|
|
||||||
|
%.tree.txt: %.org
|
||||||
|
> ../dump_org_ast.bash $< $@
|
3
org_mode_samples/plain_lists/paragraphs.org
Normal file
3
org_mode_samples/plain_lists/paragraphs.org
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
1. foo
|
||||||
|
2. bar
|
||||||
|
(message "%s" (org-element-parse-buffer))
|
Loading…
Reference in New Issue
Block a user