Skip to content

Fanael/persistent-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

Preserve the scratch buffer across Emacs sessions

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •