an-sh / flow-minor-mode

Emacs minor mode for editing flowtype files.
BSD 3-Clause "New" or "Revised" License
47 stars 16 forks source link

blocks org-babel html export of json #12

Closed unhammer closed 6 years ago

unhammer commented 7 years ago

flow-minor-tag-present-p gives an error when exporting org-mode code like

#+BEGIN_SRC json
{"foo":[]}
#+END_SRC

to html because it tries to do backward-char from the beginning of the buffer. Changing it to

        (if (equal (point) (point-min))
            (setq stop t)
          (backward-char))

at least stops it from making org html-exports error out.

an-sh commented 6 years ago

This mode is not supposed to be used on files that can't be parsed by flow, also i don't really understand the proposed change and the cause of the problem (error) in the first place.

unhammer commented 6 years ago

The bug is in the code that tries to determine whether the buffer can be parsed by flow.

org-mode narrows the contents of #+BEGIN_SRC blocks and sets their major mode in order to syntax highlight that block when exporting to html, so that buffer is in fact in a mode that can be parsed by flow.

Try checking out https://gist.github.com/unhammer/f3a36a3f2bdc29d3cab84c25e51f2637 and doing emacs -Q -l init.el foo.org and C-c C-e h H (M-x org-html-export-as-html). It'll just say Beginning of buffer instead of giving the html export.