-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
So it happened a couple of times that my Firefox tab with some text input was accidentally closed and I was surprised that the associated atomic-chrome buffer closed as well. There was no backup as it's not a file-visiting buffer.
Is there a way so set up temporary backups or at least save a history? Today I added a history-saving function myself to atomic-chrome-edit-done-hook and with a defcustom this could be made opt in:
(defvar atomic-chrome-history-dir
(file-name-concat no-littering-var-directory "atomic-chrome" "history")
"Directory where to save atomic chrome buffer contents.")
(defun my-atomic-chrome-save-to-file ()
"Save atomic chrome buffer contents to file."
(let* ((timestamp (format-time-string "%F_%T"))
(escaped-buffer-name (file-name-base (make-auto-save-file-name)))
(atomic-chrome-save-file-name
(file-name-concat atomic-chrome-history-dir
(format "%s_%s" escaped-buffer-name timestamp))))
(make-directory atomic-chrome-history-dir 'parents)
(write-region nil nil atomic-chrome-save-file-name nil nil nil 'mustbenew)
(message "Wrote backup to %s" atomic-chrome-save-file-name)))
(add-hook 'atomic-chrome-edit-done-hook #'my-atomic-chrome-save-to-file)It's not a backup as nothing is saved during editing. For that it would be nice somehow utilize Emacs' built-in backup/auto-save functions, but for most of my use-cases that's good enough.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels