Merge (#12) from tomasriveral/jed. Jed: add initial support

Jed: add initial support
This commit is contained in:
2026-04-27 17:05:28 +02:00
committed by GitHub
2 changed files with 48 additions and 7 deletions
+3 -1
View File
@@ -43,6 +43,7 @@ Before building NoteWrapper, you must install the following dependencies:
You must also have a [supported editor (and their associated plugin if needed)](#editor-support) installed:
* `helix`
* `jed`
* `kakoune`
* `micro`
* `nano`
@@ -145,6 +146,7 @@ If your editor does not support these features, you can implement a plugin using
| Editor | Bufferless | Cursor | Jump to end | Aditional requirements |
| --------- | ----------- | ------- | ------------ | ---------------------------------------------------------|
| Helix | ❌ | ❌ | ✅ | — |
| Jed | ❌ | ❌ | ✅ | — |
| Kakoune | ❌ | ❌ | ✅ | — |
| Micro | ❌ | ✅ | ✅ | [micro-vivify](https://codeberg.org/gibbert/micro-vivify) and [modifications to your `init.lua`](./docs/micro.md)|
| Nano | ❌ | ❌ | ✅ | — |
@@ -219,5 +221,5 @@ It is recommended to use a browser different from your main one for rendering.
* [ ] A converter between journal types
* [x] Support multiple vault directories
* [ ] Port NoteWrapper to other editors (non-exhaustive list of planned ports: `emacs -nw`, `jed`, `ad`, flow-control, `ee`, `amp`, `dte`, `cano`, `mle`, `zee`, `ptext`, `kibi`, `ox`, `ne`, `dit`, `zile`, `moe`, `joe`, `pico`, `vis`)
* [ ] Port NoteWrapper to other editors (non-exhaustive list of planned ports: `emacs -nw`, `ad`, flow-control, `ee`, `amp`, `dte`, `cano`, `mle`, `zee`, `ptext`, `kibi`, `ox`, `ne`, `dit`, `zile`, `moe`, `joe`, `pico`, `vis`)
* [x] Default to $EDITOR
+45 -6
View File
@@ -1,7 +1,7 @@
#include "utils.h"
const char *supportedEditor[] = {"helix", "kakoune", "micro", "nano", "neovim", "vi", "vim"};
const int numEditors = 7;
const char *supportedEditor[] = {"helix", "jed", "kakoune", "micro", "nano", "neovim", "vi", "vim"};
const int numEditors = 8;
int compareString(const void *a, const void *b) {
const char *str1 = *(const char **)a;
@@ -425,7 +425,7 @@ if (editor_pid == 0) {
// If render enabled → spawn viv in parallel
if (render) {
debug("Running the editor...");
debug("Running Vivify...");
pid_t viv_pid = fork();
error(viv_pid < 0, "program", "fork() failed.");
@@ -464,7 +464,7 @@ if (editor_pid == 0) {
// If render enabled → spawn viv in parallel
if (render) {
debug("Running the editor...");
debug("Running Vivify...");
pid_t viv_pid = fork();
error(viv_pid < 0, "program", "fork() failed.");
@@ -505,7 +505,7 @@ if (editor_pid == 0) {
// If render enabled → spawn viv in parallel
if (render) {
debug("Running the editor...");
debug("Running Vivify...");
pid_t viv_pid = fork();
error(viv_pid < 0, "program", "fork() failed.");
@@ -544,7 +544,7 @@ if (editor_pid == 0) {
// If render enabled → spawn viv in parallel
if (render) {
debug("Running the editor...");
debug("Running Vivify...");
pid_t viv_pid = fork();
error(viv_pid < 0, "program", "fork() failed.");
@@ -577,6 +577,45 @@ if (editor_pid == 0) {
execlp("vi", "vi", path, NULL);
}
error(1, "program", "execlp() failed.");
// ---- Jed ----
} else if (strcmp(editor, "jed") == 0) {
// If render enabled → spawn viv in parallel
if (render) {
debug("Running Vivify...");
pid_t viv_pid = fork();
error(viv_pid < 0, "program", "fork() failed.");
if (viv_pid == 0) {
// GRANDCHILD → viv
char viv_path[PATH_MAX];
strncpy(viv_path, path, PATH_MAX - 1);
viv_path[PATH_MAX - 1] = '\0';
if (shouldJumpToEndOfFile) {
strncat(viv_path, ":99999",
PATH_MAX - strlen(viv_path) - 1);
}
debug("Running viv %s", viv_path);
execlp("viv", "viv", viv_path, NULL);
error(1, "program", "execlp() failed.");
}
// IMPORTANT: do NOT wait for viv
}
// Now run jed (this replaces the child process)
if (shouldJumpToEndOfFile) {
debug("Running jed %s -g 99999999", path);
execlp("jed", "jed", path, "-g", "99999999", NULL);
} else {
debug("Running jed %s", path);
execlp("jed", "jed", path, NULL);
}
error(1, "program", "execlp() failed.");
// ---- UNKNOWN EDITOR ----
} else {