Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

MarkEdit TrueSave

Type in a new MarkEdit note and your text is on disk a few seconds later, in a file named Untitled-2026-08-22-092412.md. No save dialog, no naming it, no thinking about it.

Why it's needed

MarkEdit already has editor.autoSaveWhenIdle, but it deliberately skips untitled documents:

// EditorDocument.swift
var shouldSaveWhenIdle: Bool {
  // Saving documents without a fileURL would bring up the dialog
  AppRuntimeConfig.autoSaveWhenIdle && fileURL != nil
}

So a brand-new note is the one thing MarkEdit never autosaves — and with editor.closeAlwaysConfirmsChanges off, closing that window discards it without asking. TrueSave covers exactly that gap.

What it does, and what it doesn't

While a document is untitled, TrueSave mirrors its text to a file a few seconds after you stop typing. The same file is reused for the life of that window.

It is a safety net, not a rename. The window still says Untitled — Edited, because MarkEdit still considers the document unsaved. Your words are on disk; the document just doesn't know about it.

Making the document itself become that file is not possible from an extension. A document only gets a fileURL via openFile (which routes through LaunchServices to whatever app owns .md) or saveDocument (which opens a modal save panel on an untitled document). Neither is silent, so TrueSave doesn't try.

Install

  1. Copy true-save.js into: ~/Library/Containers/app.cyan.markedit/Data/Documents/scripts/
  2. Optionally pick a folder in settings.json (Shift-Command-Comma):
{
  "trueSave.folder": "~/Notes"
}
  1. Restart MarkEdit.

No other settings are required. editor.autoSaveWhenIdle is unrelated to TrueSave — it covers documents that already have a file, TrueSave covers the ones that don't.

Settings

Key Default Meaning
trueSave.folder ~/Documents Where notes are written. ~ is your real home, not the sandbox container.
trueSave.delay 3000 Milliseconds of no typing before a write.

Behavior details

  • The filename is picked once per window, on the first write, and reused after that — you get one file per note, not one per idle.
  • A path that already exists is never touched; TrueSave falls back to Untitled-<date>-<time>-2.md.
  • If you empty the note, the file is emptied too. The file tracks the document.
  • If you later Cmd+S the note under a real name, TrueSave stops and MarkEdit's own autosave takes over — but the mirrored copy stays behind as a leftover.
  • If the folder isn't writable you get one alert explaining how to grant access, and TrueSave stops. It never fails silently.

Known limitations

  • The last few seconds aren't on disk. Writes happen trueSave.delay ms after you stop typing. Lower it if that window bothers you.
  • Leftovers. A mirrored file is not cleaned up if you later save the note elsewhere.
  • Sandbox. MarkEdit ships a home-relative read-write exception, so most folders under your home work without a grant. If yours doesn't, the alert tells you.
  • No version history on the mirror. MarkEdit's "Browse All Versions" is NSFileVersion, which macOS records when an NSDocument saves. TrueSave writes through FileManager, so no snapshots are taken. The mirror protects you from losing the window, not from overwriting your own text — Cmd+Z in the editor is still the only undo.

Test

node test.js

Runs true-save.js in a vm with a stubbed MarkEdit global: path and timestamp format, ~ expansion, path reuse across writes, collision suffixes, and the blank / already-titled / denied-folder cases.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages