Coder Social home page Coder Social logo

multiple inner modes about polymode HOT 12 CLOSED

polymode avatar polymode commented on July 19, 2024
multiple inner modes

from polymode.

Comments (12)

vspinu avatar vspinu commented on July 19, 2024

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" [email protected] 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
.

from polymode.

daroczig avatar daroczig commented on July 19, 2024

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.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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?

from polymode.

daroczig avatar daroczig commented on July 19, 2024

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

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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?

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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.

from polymode.

daroczig avatar daroczig commented on July 19, 2024

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.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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?

from polymode.

daroczig avatar daroczig commented on July 19, 2024

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 :(

from polymode.

vspinu avatar vspinu commented on July 19, 2024

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.

from polymode.

daroczig avatar daroczig commented on July 19, 2024

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

from polymode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.