visit1985 / mdp

A command-line based markdown presentation tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support auto reloading

wenlibin02 opened this issue · comments

Could you add the support for auto reloading by specifying an option?

I can see the advantage of that, compared to the current method of hitting r all the time to reload it while creating the presentation.

But, I don't have time to work on enhancements of mdp at the moment. If you want to implement it (or find somebody who does it for you), feel free to do so and submit a pull request. I'd be happy to review it. Otherwise I'd simply leave this issue open until someone finds the time to work on it.

P.S.: We also need to consider the case that you can pipe your markdown into mdp. In this case you can't reload, since there is no file to work on.

I would like to take a try at this. I actually checked Linux inotify kernel API and thought that would be good for this. Implementing this will take some time from me but I really would like to try. Any other ideas?

@kazooiebombchu, sounds great. I've thought about inotify too, but we need to ensure that this is an optional feature for Linux then. It's important, that it doesn't break builds for other platforms. Maybe this requires introduction of autoconf scripts to the project, but I'm not familiar with that.

I also looked into this fswatch but I wasn't sure does this support all needed platforms though. At least what I understood it seemed to be (Linux kernel, OS-X and FreeBSD, not sure about Cygwin)? I'm not familiar with autoconf either but what I read people seem to favor something like CMake over autoconf. Any ideas about using the fswatch library? If it doesn't work then only solution might be using autoconf or something similar to provide different builds.

Originally I thought the program can repeatedly send a simulated key ‘r’ to do this job.

I don't think that would be really good way to do this. It sounds little bit of a 'hack' and I'm not sure do you run into some kind of write collisions with this method because when mdp and your editor are trying to access the same file at the same time. In that sense for me inotify or something similar sounds better approach.