Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different parser for each on org source block? #47

Open
mgraham opened this issue Jun 18, 2023 · 2 comments
Open

Different parser for each on org source block? #47

mgraham opened this issue Jun 18, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@mgraham
Copy link

mgraham commented Jun 18, 2023

I have an org file that has json documents and ruby snippets:

#begin_src js
{
  "some": "json"
}
#end_src
#begin_src ruby
def somefunction
   print "hello"
end
#end_src

I would like origami to be able to use the json parser within the js source block and the ruby parser within the ruby block.

Is that possible?

@jcs090218
Copy link
Member

Is that possible?

No, this is not possible at the moment. 😓

FYI, origami is semi-deprecated; I preferred TreeSitter base solution like ts-fold. It has everything from origami but is more accurate and faster.

@jcs090218 jcs090218 added the enhancement New feature or request label Jun 18, 2023
@mgraham
Copy link
Author

mgraham commented Jun 19, 2023

Thanks, @jcs090218 !

Using treesitter does seem to be the correct approach for folding!

I'm not using Emacs 29 yet, so I installed tree-sitter and ts-fold and gave it a try. However it looks like tree sitter doesn't like org mode with source blocks either. So I'm back to origami for now!

Eventually I would like to use folding for everything, but right now my main use case is folding large JSON responses in ob-restclient So even though origami doesn't technically work with org source blocks, I just tell it to use the c-style parser for all org files.

(use-package origami)
(require 'origami)
(add-to-list 'origami-parser-alist
             '(org-mode . origami-c-style-parser))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants