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

multiple inner modes #11

Closed
daroczig opened this issue Nov 3, 2013 · 12 comments
Closed

multiple inner modes #11

daroczig opened this issue Nov 3, 2013 · 12 comments

Comments

@daroczig
Copy link
Contributor

daroczig commented Nov 3, 2013

Sorry for such lame question, but I would be interested in defining a base mode with two inner modes (e.g. markdown is the main mode but we also find YAML and R code chunks with separate tags). Is it possible? If so, could you please point my attention to a working demo? Thanks, Gergely

@vspinu
Copy link
Collaborator

vspinu commented Nov 3, 2013

Markdown works with arbitrary number of difernt inner modes. It should work
out of the box. Can u give me an example script?

/Sent from tablet/
On Nov 3, 2013 6:08 AM, "Gergely Daróczi" notifications@github.com wrote:

Sorry for such lame question, but I would be interested in defining a base
mode with two inner modes (e.g. markdown is the main mode but we also
find YAML and R code chunks with separate tags). Is it possible? If so,
could you please point my attention to a working demo? Thanks, Gergely


Reply to this email directly or view it on GitHubhttps://github.com//issues/11
.

@daroczig
Copy link
Contributor Author

daroczig commented Nov 4, 2013

Sounds great, thanks!

Please see my firsts baby steps (sorry, I do not speak (e)lisp) here: daroczig@c3a36c3

An example document for testing purposes: https://github.com/Rapporter/rapport/blob/master/inst/templates/Minimal.tpl

This document is basically a markdown document with a special header in YAML syntax (between the head tags) and R expressions can be defined in the traditional brew tags.

My problem with my really naive try was to let that document have 2 inner modes, but it seems that only the first one is triggered. I have no idea what kind of syntax is needed to be able to use two inner modes in a document. Any help/hint would be really welcomed.

@vspinu
Copy link
Collaborator

vspinu commented Nov 4, 2013

Ok I started getting it. I have one question. Are markdown code blocks
supported? I mean is there only two inner modes (head and brewer) or
polymode should also support arbitrary mode ... markdown blocks?

@daroczig
Copy link
Contributor Author

daroczig commented Nov 4, 2013

Nope, markdown code blocks are not really important here. So "just" the two inner modes (head and brew) are the top priority.

@vspinu
Copy link
Collaborator

vspinu commented Nov 4, 2013

But do you have plans to provide markdown code blocks in the future? If so, then it would be wise to inherit from existing markdown mode and to add two additional modes, brew and YAML.

@vspinu
Copy link
Collaborator

vspinu commented Nov 4, 2013

One more thing. Isn't .tpl associated with something else? It sounds generic to me. Shall we associate it to a more specific extension, like .rapport?

@vspinu
Copy link
Collaborator

vspinu commented Nov 4, 2013

I have merged your code and modified to use proper classes. It works now but very sadly it often blocks emacs. The reason is markdown mode that decided to reinvent font-lock and bluntly re-fontifies the whole buffer on every change you make.

Please pull and check the basics. Note that I activated rapport on ".rapport" extension.

@daroczig
Copy link
Contributor Author

daroczig commented Nov 4, 2013

Seems to work fine, thank you very much! This rocks :)

Thanks,
Gergely

PS: you are right about the tpl extension (bringing up some fun memories with Pascal). We might want to change that in the future... rapport extension sounds reasonable indeed.

@daroczig daroczig closed this as completed Nov 4, 2013
@vspinu
Copy link
Collaborator

vspinu commented Nov 4, 2013

What emacs do you use? What version of markdown-mode? I have serious problems with it and I even reported it to the author. Do you notice a freeze if you edit Minimal.rapport just before the <!--head?

@daroczig
Copy link
Contributor Author

daroczig commented Nov 4, 2013

I'm on Arch Linux with GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.2) of 2013-08-07 on -mnt-storage-buildroots-staging-x86_64-eric with a slightly outdated version of markdown-mode (c3f86536a33ae30263cb7dccd049758939e45082 from Wed Feb 22 20:36:14 2012 -0500).

You are right about the freeze issue, but I have not noticed it before trying to edit the file before the <!--head part, as that line should be the first one in the file anyway. But this seems a bit worrisome indeed :(

@vspinu
Copy link
Collaborator

vspinu commented Nov 5, 2013

Please try a new version. The freeze was polymode bug. It took me a while to figure that out, debugging post-command hooks and font lock is a huge pain :( Now everything is fixed.on polymode side. I also remove markdown ugly fontification hooks for time being, otherwise everything is painfully slow. Wait and see what the maintaner has to say.

Rapport is now the most complex polymode. It includes pretty much every feature of polymode: auto-chunks (like markdown chunks) and two known in advance modes (multi chunk mode). I will add org-mode these days and plan to release polymode to MELPA by the end of the week.

Thanks for all the input and please report any issues.

@vspinu vspinu mentioned this issue Nov 6, 2013
@daroczig
Copy link
Contributor Author

daroczig commented Nov 9, 2013

Awesome, thank you very much! Works really fine here.

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

No branches or pull requests

2 participants