Code Monkey home page Code Monkey logo

persistent-scratch's Introduction

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.

persistent-scratch's People

Contributors

fanael avatar

Watchers

Jason Milkins avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.