Changing things live

Emacs’s great strength is that you can change anything while it runs. Tuna keeps that, and adds one thing Emacs lacks: every change belongs to where you wrote it, so it can be taken back exactly. There are three places to write: a plugin’s file, a line of init.ss, and your session (M-:).

The three tools

And reloading a plugin from its file (what happens) applies a whole edited plugin.

Tuna · M-:
(keys:bind! "C-c t" (lambda () (files:find-file "~/todo.txt")))
(set-local! settings:fill-column 60)
(redefine (dabbrev::helper s) (string-upcase s))
Emacs · M-:
(keymap-global-set "C-c t" (lambda () (interactive) (find-file "~/todo.txt")))
(setq-local fill-column 60)
(defun dabbrev--helper (s) (upcase s))

Where Tuna differs. Each of the three Tuna lines can be taken back by ending the session. In Emacs the binding and the redefinition stay until restart.

What lasts how long

The changeWritten inIts ownerLasts until
set! an option, a verb (keys:bind!), add-hook!, redefine, advice-addinit.ssthat lineyou remove or change the line and reload-config. Made again at every start.
the sameM-:your sessionyou end the session, or Tuna exits. Not made again at the next start: only saved data and ties are restored.
set-local!init.ss or M-:that line, or the sessionas above, or until the buffer it was scoped to is killed.
a define of your ownM-:your sessionas above.
a procedure definitionC-M-x in a plugin’s fileyour session’s edits of that pluginthe plugin is reloaded from its file, or you end the session, or Tuna exits.
a define-workerC-M-xthe pluginthe plugin’s next reload; jobs started from now on run the new code.
a define-optionC-M-xthe plugin’s defaultthe plugin’s next reload.
a define-savedC-M-x(a change to data)The value is reset and saved; the old one is set aside, and restore-saved! brings it back.
any other formC-M-xthe plugin’s current runthat run ends (turn-off or reload).
everything a plugin’s file sets upplugin.ssthe plugin’s runthe plugin turns off or reloads; made again by the next run.
saved dataanywhere, through its pluginits plugin or contractchanged again. It survives reloads, swaps, turning off, crashes and restarts.
a view or other thing a plugin made for youwherever the call isthat caller, by a tiethe caller turns off, is swapped away, or Tuna exits; kept across reloads, and across a crash, because ties are saved.
a command paused at a prompt—the plugin it is insideanswered, or quit; quit if that plugin changes; lost in a crash (what it did before the prompt is kept).

A key binding or hook entry that holds a contract procedure follows its redefinition, because contract names are wrappers that look up the current definition at each call. A key bound to a command’s name follows a new commands:define of it. A plain private procedure stored by value does not follow.