Warn when saving some but not all buffers

This prevents me from forgetting to save files:

declare-option str-list buffers_modified_false
declare-option str-list buffers_modified_true

hook -group kakrc global BufWritePost .* %{
    set-option global buffers_modified_false
    set-option global buffers_modified_true
    eval -buffer * %{
        set-option -add global "buffers_modified_%val{modified}" %val{bufname}
    try %{
        evaluate-commands -draft %{
            buffer-next %opt{buffers_modified_true} # buffer-next fails if given any arguments, i.e. if buffers_modified_true is nonempty
    } catch %{
        echo -markup "{Information}WARNING: unsaved buffers: %opt{buffers_modified_true}"

Every time I save a file, this hook makes a list of saved buffers and a list of unsaved buffers. If there are any unsaved buffers, it prints a warning.

To check whether a list is empty, I pass it as the argument list to buffer-next which requires 0 arguments to not fail.