GitXplorerGitXplorer
F

persistent-scratch

public
134 stars
14 forks
6 issues

Commits

List of commits on branch master.
Unverified
5ff41262f158d3eb966826314516f23e0cb86c04

Change the modification flag of saved scratch buffers

FFanael committed 2 years ago
Unverified
f9c1361ad69073af8133174f9e37b594df9be361

Update copyright years

FFanael committed 2 years ago
Unverified
e0d536c0899fa6e6869361ad0b8cc490f05bb739

Unset buffer as modified when scratch is saved

nnotetiene committed 2 years ago
Unverified
92f540e7d310ec2e0b636eff1033cf78f0d9eb40

Add before-save-commit-functions hook

FFanael committed 3 years ago
Unverified
4e159967801b75d07303221c4e5a2b89039c6a11

Allow using idle timers for autosave

FFanael committed 3 years ago
Unverified
57221e5fdff22985c0ea2f3e7c282ce823ea5932

Don't change the major mode when it's not saved

FFanael committed 4 years ago

README

The README file for this repository.

Melpa Status Melpa Stable Status

Persistent scratch

persistent-scratch is an Emacs package that preserves the state of scratch buffers accross Emacs sessions by saving the state to and restoring it from a file.

Installation

The package is available in MELPA and MELPA Stable.

If you have MELPA or MELPA Stable in package-archives, use

M-x package-install RET persistent-scratch RET

If you don't, open persistent-scratch.el in Emacs and call package-install-from-buffer.

Other installation methods are unsupported.

Usage

To save the current state of scratch buffers to file indicated by persistent-scratch-save-file:

M-x persistent-scratch-save

To restore scratch buffers from persistent-scratch-save-file:

M-x persistent-scratch-restore

To save the state to an arbitrary file:

M-x persistent-scratch-save-to-file

To restore the state from an arbitrary file:

M-x persistent-scratch-restore-from-file

To toggle periodic autosave:

M-x persistent-scratch-autosave-mode

To create a new backup file (only when backup is enabled, see persistent-scratch-backup-directory), so that the next persistent-scratch-save won't overwrite the existing backup:

M-x persistent-scratch-new-backup

To customize the save file path, what state to save, the autosave period, what buffers are considered scratch buffers and whether to backup old saved states:

M-x customize-group RET persistent-scratch RET

Init file considerations

Variables can be customized either via customize or by setting them via setq directly.

To both enable autosave and restore the last saved state, if any, on Emacs start, add

(persistent-scratch-setup-default)

to the init file. This will not error when the save file doesn't exist.

To just enable autosave, enable persistent-scratch-autosave-mode like any other minor mode:

(persistent-scratch-autosave-mode 1)

To just restore the last saved file, use persistent-scratch-restore. Bear in mind it may signal an error if there's no save file, so it's a good idea to call it inside ignore-errors or with-demoted-errors.