The Kalem Book GitHub

This Book describes Kalem's main branch, which may be ahead of the latest release.

Files

Saving is atomic: a crash never leaves half a file. Line endings, a byte order mark, file permissions, the group and symbolic links are kept; a write-protected file is not saved over (Save As writes another). The status bar names line endings that are not LF (CRLF) and a byte order mark (BOM); Line Endings: LF, Line Endings: CRLF and Byte Order Mark: Add or Remove (in the palette) change them from the next save. When another program changes an open file, Kalem reloads it if you have no unsaved changes. With unsaved changes, the other program's are merged in when they changed other lines (Logseq writing another block of the page you are typing in): yours stay, unsaved, and the status bar says so; when both changed the same lines, it says so too (the terminal asks), and Revert to Saved takes the other version. Undo goes back past a reload or a merge. When another program deletes it, the document stays open and counts as unsaved, its text being the only copy: Save writes the file again.

Files are read as UTF-8, or as UTF-16 when they start with its byte order mark. A file in another encoding (Windows-1254, ISO-8859-9, Shift_JIS…) is read in the one its bytes suggest, which the status bar names, and saved in it again. Reopen with Encoding (File menu) reads the file again in the encoding you choose, and Save with Encoding saves it in another; a character the encoding cannot hold stops the save and says which. A file whose bytes do not read back as they are (shown as �) is not saved over until you choose: Reopen with Encoding, or Save with Encoding or Save As to write it as it shows.

A document follows its file when Kalem renames or moves it (its file manager included), and closes when Kalem moves the file to the trash, unless it has unsaved changes. A rename by another program looks to Kalem like a deletion.