Skip to content

Protection against backing up after accidentally closing the *scratch* buffer #39

Description

@MarcvdSluys

As exposed in Issue #23, I also sometimes accidentally kill my *scratch* buffer, resulting in the content of persistent-scratch-save-file and the latest backup being overwritten by "nil". The solution by the OP of that Issue helps to make a backup when killing the buffer and updating the file name for future updates. However, one still needs to manually persistent-scratch-restore-from-file the contents from the old file.

I was wondering whether a(n additional) solution would be to check whether the *scractch* buffer actually exists before writing anything to file (main file or backup). If I understand correctly, (get-buffer "*scratch*") will return nil if the buffer does not exist, and perhaps this could be used to decide whether to write anything at all.

I apologise for my poor knowledge of elisp; I didn't succeed in making a version/patch to actually test this and create a pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions