New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create `backup' layer to enable auto backup behavior in spacemacs #11903

Open
wants to merge 1 commit into
base: develop
from

Conversation

Projects
None yet
1 participant
@igor-kupczynski
Copy link

igor-kupczynski commented Jan 27, 2019

Create backup layer to enable auto backup behavior in spacemacs

Related to #8947

Note: my first PR against spacemacs, happy to learn why this change sucks and how I can it

This layer adds support for automatic backups.

Emacs default behavior is to backup a file first time it is saved. This behavior results in a lot of #file_name.ext# files being automatically created. Many people find this annoying and spacemacs turns the auto backup off.

This layer re-enables and extends the automatic backups.

Features:

per-session backups

Similar to emacs default behavior, make a backup first time it is saved from emacs session.

per-save backups

Make a backup every time file is saved.

better defaults

Do not clutter working directories with the backups:

  • Store per-session backup in ~/.emacs.d/.cache/backups/per-session (customize variable backup-per-session-directory to override).
  • Store per-save backup in ~/.emacs.d/.cache/backups/per-save (customize variable backup-per-save-directory to override).

Sane defaults for the backup files:

  • Backup files under version control.
  • Keep the last 10 per-save backups and last 3 per-session backups.
  • Backup by copying.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add backup to the existing dotspacemacs-configuration-layers list in this file.

Acknowledgments

Inner workings of this layer is based on description by @GregorySchwartz in #8947. Which is in turn inspired by a StackOverflow discussion on the subject.

@igor-kupczynski igor-kupczynski referenced this pull request Jan 27, 2019

Open

Backups #8947

@igor-kupczynski igor-kupczynski force-pushed the igor-kupczynski:backup-layer branch from eccaff0 to e981551 Jan 27, 2019

@igor-kupczynski

This comment has been minimized.

Copy link
Author

igor-kupczynski commented Feb 6, 2019

Hey, anything I can do to get this accepted? I think it makes sense to have the backup as its own layer. It doesn't add any packages, but layers are described more as a set of features than package groups. I think this offers a new feature (backup per each write, not only per the first write of a file during a session). Judging by the linked issue (and stack overflow discussion), I think this is useful for more than just me.

@igor-kupczynski igor-kupczynski force-pushed the igor-kupczynski:backup-layer branch from e981551 to 6a089a0 Feb 9, 2019

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