Skip to content

Commit

Permalink
make tmp file handling more chatty
Browse files Browse the repository at this point in the history
  • Loading branch information
inimino committed Jun 18, 2024
1 parent 0a0b6c9 commit 4f3faa3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
11 changes: 6 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ WHAT WE ARE CURRENTLY DOING:
Another more specific answer is as follows: we structure the problem in such a way that there is either a solution or there is no side effect.
This is the principle of least privilege and it means you can delegate authority, for example, to a postscript program and trust that it will not access the network.

update ? short help
merge 2 PRs
✓ update ? short help
✓ merge 2 PRs
✓ bugfix :inrefs, :toprefs crashes
✓ chmod issue on Windows (exec bit)
✓ bump version and push v8

dedup transitive block references
Arena overflow for spans
chmod issue on Windows (exec bit)
bump version and push v8

I think flush should probably never apply to cmp, only out
rename bootstrap to global context block
"Error: Block does not belong to any file." happened
Expand Down
6 changes: 5 additions & 1 deletion cmpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4522,7 +4522,7 @@ void finalize_search() {
}
}

/* #search_forward, #search_backward
/* #search_forward #search_backward
In these two functions (used by n/N) we first get the sequence of blocks which match state.previous_search.
If this is empty, we do nothing.
Expand Down Expand Up @@ -4995,8 +4995,11 @@ void edit_current_block() {
span block = state->blocks.a[state->current_index];
char* filename = s(tmp_filename());
write_to_file_span(block, S(filename), 0);
prt("Temp file written %s for editing.\n", filename);
flush();
int editor_status = launch_editor(filename);
if (editor_status == 0) {
prt("Editor exited successfully, creating rev.\n"); flush();
handle_edited_file(filename);
} else {
prt("Editor exited with error, changes not saved.\n");
Expand Down Expand Up @@ -5229,6 +5232,7 @@ void new_rev(span tmp_filename, int file_index) {
strftime(timestamp, sizeof(timestamp), "%Y%m%d-%H%M%S", timeinfo);

span rev_path = concat(concat(dir, S("/revs/")), S(timestamp));
prt("writing new rev %.*s\n", len(rev_path), rev_path.buf);
write_to_file_span(state->files.a[file_index].contents, rev_path, 1);

update_projfile(file_index, tmp_filename, rev_path);
Expand Down
7 changes: 7 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ You can use "@blockid:code" to include the PL section of the block instead of th

Block ids with the "hashtag syntax", like "#block\_id" are now a supported feature.
In addition to the block references feature using them, they are also used by the "#" keybinding, which lets you see and jump quickly to any block that has an id.

### Markdown support

Markdown is now supported; each heading creates a block.
(If you have two headings, like "# big heading\n## sub-heading" then you'll get two blocks.)
The markdown blocks don't have any "code part", they are all NL and no PL, so most of the LLM features like "r" won't make sense to use with them.
It's just a quick way to move through markdown files and keep your code organized.

0 comments on commit 4f3faa3

Please sign in to comment.