Emacs Org-Mode & Literate Haskell

前端 未结 4 698
不知归路
不知归路 2021-02-15 12:50

In org-mode, a line starting with a colon is formatted as source code. ( http://orgmode.org/manual/Literal-examples.html )

In literate Haskell, source code lines start w

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-15 13:30

    So, obviousely this is not the intended ways to use org.

    The main issue when doing this is that both, org-mode and haskell-mode are major modes. So I cannot use them in parallel.

    Nevertheless this is how it works, it is a hack, and I am not sure about side effects ..:

    When viewing a file in emacs, the (a?) code trigger seems to be in org-activate-code (org.el), but this is not used for export. For HTML export I had to touch org-html.el too.

    I changed:

    In org.el line 5378, function org-activate-code from

    "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)"
    

    to

    "^[ \t]*\\([:>]\\(?: .*\\|$\\)\n?\\)"
    

    And in org-html.el line 1508 and 1516, function org-export-as-html from

    (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line)
    

    to

    (string-match "^[ \t]*[:>]\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line)
    

    and (line 1516)

    (string-match "^[ \t]*[:>]\\(\\([ \t]\\|$\\)\\(.*\\)\\)"
    

    Looking at it I assume that this has to be adapted for every export channel one intends to use.

提交回复
热议问题