felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
119 stars 21 forks source link

Fallback on generated HTML when rib is not running #4

Closed felko closed 4 years ago

felko commented 4 years ago

Currently neuron-rib-open-page opens a new tab in the browser on localhost, regardless of whether a rib instance is running.

It could be useful to replace it with a neuron-open-zettel function that would open the generated HTML page instead when no instance is running.

felko commented 4 years ago

The neuron open command from https://github.com/srid/neuron/pull/79 allows this to be implemented straightforwardly.

srid commented 4 years ago

Currently I'm using it with this change: image

felko commented 4 years ago

Yeah as you mentioned earlier, there is no reason to use rib serve when editing zettels, since the site is purely static. I should just implement a neuron-rib-watch command instead of having to serve the web application every time.

srid commented 4 years ago

Another option is to automatically run neuron-rib-generate every time a zettel is created or modified (obviates the need for neuron rib -w, which has to be a long-running process).

felko commented 4 years ago

I could do this yeah, generating every time a zettel is created or modified seems a bit too much though. Maybe we could generate when neuron-open-current-zettel is called instead.

What's the issue with long running processes?

srid commented 4 years ago

I could do this yeah, generating every time a zettel is created or modified seems a bit too much though.

FWIW, neuron rib will run quick, and generate only modified files. rib -w on the other hand will begin with a full generation, and then monitor. Anyway, this can be done in user config, especially as a function like neuron-rib-generate now exists.

What's the issue with long running processes?

More moving parts. If I work with multiple zettelkastens, will there be multiple long running processes? Or would I have to stop one and start another? One-off generation is simple enough for me. So it is mostly a personal preference. I use rib -w only in CLI, and that too for brief periods.

EDIT: Oh, and the other benefit is that with one-off generation if there is any error I'd see it right away. This is not the case with long-running process (unless you use something like flycheck I guess, or keep the *rib* buffer visible).

felko commented 4 years ago

I guess this can be closed, I wanted to fallback rather than just open the local HTML but after using neuron-mode a little bit I noticed that I didn't used rib features at all (except watch sometimes). I'll keep the rib related functions but I'll probably remove default bindings to them in the suggested doom config.

Your doom config makes more sense.