                                                         (filter #(< 1 (val %)))
                                                         (first))})))
     (let [[retained-entries new-deleted-entries]
-          ((juxt filter remove) (comp new-entries-by-id id-fn) all-entries)
+          (if deleted
+            ((juxt filter remove) (comp new-entries-by-id id-fn) all-entries)
+            [all-entries []])
 
           retained-entries-by-id (->> retained-entries
                                       (map (juxt id-fn identity))

                     (log/info "Writing to %s" f)
                     (with-atomic-write [w f]
                       (org/write-file w content)))
        {:keys [live archive deleted]} (merge {:live    (read-file live-file)
                                               :archive (read-file archive-file)
                                               :deleted (read-file deleted-file)}
                                              new-entries merge-opts)]
    (when live (write-file live-file live))
    (when archive (write-file archive-file archive))

                                         (filter archive?)
                                         (sort-by sort-key)
                                         (wrap-in-archive-file-prelude time-zone category))]
      (cond->
          {:live    (nil-if-equivalent new-live-file-contents live)
           :archive (nil-if-equivalent new-archive-file-contents archive)}
        deleted
        (assoc :deleted
                 (when (seq new-deleted-entries)
                   (wrap-in-archive-file-prelude time-zone category
                                                 (concat (::org/sections deleted)
                                                         new-deleted-entries))))))))

(defmacro ^:private with-atomic-write
  [[binding filename] & body]
