• Stars
    star
    273
  • Rank 145,634 (Top 3 %)
  • Language
    Emacs Lisp
  • Created over 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Save Emacs buffers when they lose focus

License GPL 3 MELPA MELPA Stable

super-save

super-save auto-saves your buffers, when certain events happen - e.g. you switch between buffers, an Emacs frame loses focus, etc. You can think of it as both something that augments and replaces the standard auto-save-mode.

Installation

Available on all major package.el community maintained repos - MELPA Stable and MELPA repos.

MELPA Stable is recommended as it has the latest stable version. MELPA has a development snapshot for users who don't mind breakage but don't want to run from a git checkout.

You can install super-save using the following command:

M-x package-install [RET] super-save [RET]

or if you'd rather keep it in your dotfiles:

(unless (package-installed-p 'super-save)
  (package-refresh-contents)
  (package-install 'super-save))

If the installation doesn't work try refreshing the package list:

M-x package-refresh-contents

use-package

If you're into use-package you can use the following snippet:

(use-package super-save
  :ensure t
  :config
  (super-save-mode +1))

Emacs Prelude

super-save started its life as the extraction of a similar functionality I had originally developed for Emacs Prelude and the package is bundled with Prelude.

Usage

Add the following to your Emacs config to enable super-save:

(super-save-mode +1)

If you want to enable the additional feature of auto-saving buffers when Emacs is idle, add the following as well:

(setq super-save-auto-save-when-idle t)

At this point you can probably switch off the built-in auto-save-mode (unless you really care about its backups):

(setq auto-save-default nil)

Configuration

super-save will save files on command (e.g. switch-to-buffer) and hook triggers (e.g. focus-out-hook).

Both of those are configurable via super-save-triggers and super-save-hook-triggers. Here's a couple of examples:

;; add integration with ace-window
(add-to-list 'super-save-triggers 'ace-window)

;; save on find-file
(add-to-list 'super-save-hook-triggers 'find-file-hook)

You can turn off super-save for remote files like this:

(setq super-save-remote-files nil)

Sometimes you might want to exclude specific files from super-save. You can achieve this via super-save-exclude, for example:

(setq super-save-exclude '(".gpg"))

You can add predicate to super-save-predicates, this predicates must not take arguments and return nil, when current buffer shouldn't save. If predicate don't know needle of save file, then predicate must return t. Folowing example stop super-save, when current file in Markdown mode:

(add-to-list 'super-save-predicates (lambda ()
                                        (not (eq major-mode 'markdown-mode))))

License

Copyright Β© 2015-2022 Bozhidar Batsov and contributors.

Distributed under the GNU General Public License; type C-h C-c to view it.

More Repositories

1

prelude

Prelude is an enhanced Emacs 25.1+ distribution that should make your experience with Emacs both more pleasant and more powerful.
Emacs Lisp
5,014
star
2

clojure-style-guide

A community coding style guide for the Clojure programming language
3,978
star
3

projectile

Project Interaction Library for Emacs
Emacs Lisp
3,851
star
4

emacs-lisp-style-guide

A community-driven Emacs Lisp style guide
1,053
star
5

zenburn-emacs

The Zenburn colour theme ported to Emacs
Emacs Lisp
951
star
6

crux

A Collection of Ridiculously Useful eXtensions for Emacs
Emacs Lisp
807
star
7

solarized-emacs

The Solarized colour theme, ported to Emacs.
Emacs Lisp
739
star
8

helm-projectile

Helm UI for Projectile
Emacs Lisp
322
star
9

powerpack

Some useful extensions to the core Ruby classes
Ruby
270
star
10

emacs.d

My personal Emacs configuration
Emacs Lisp
204
star
11

persp-projectile

Projectile integration for perspective.el
Emacs Lisp
110
star
12

guru-mode

Learn to use Emacs the way it was meant to be used (the Emacs guru way)
Emacs Lisp
100
star
13

emacs-dev-kit

An advanced self-contained Emacs configuration suitable for many software developers (deprecated)
Emacs Lisp
95
star
14

beamer-torino-theme

Torino, a pretty theme for LaTex Beamer
Emacs Lisp
38
star
15

lein-annotations

Display comment annotations in your project
Clojure
12
star
16

emacsredux

Emacs Redux is a blog dedicated to the One True Editor
HTML
11
star
17

cv

My professional CV in LaTeX
TeX
10
star
18

cl-99-problems

Solutions to the 99 Lisp problems in Common Lisp
Common Lisp
10
star
19

activerecord-extra-validators

Some nice additional validators for ActiveRecord
Ruby
9
star
20

java-in-action-lectures

The lectures from the "Java in Action" programming course
9
star
21

advent-of-code2021

Advent of Code 2021, Clojure Edition
Clojure
8
star
22

legacy-octopress-blog

My personal blog
HTML
8
star
23

batsov.com

My personal blog
Ruby
7
star
24

metaredux

HTML
7
star
25

master-thesis

My Master university degree thesis
Emacs Lisp
5
star
26

zshrc

My personal zsh setup
5
star
27

docs.projectile.mx

Projectile's documentation site
Handlebars
4
star
28

hard-cider

A demo projecto to showcase CIDER
Clojure
3
star
29

presentations

Presentations I created for various occasions
2
star
30

blog

My personal blog
Ruby
2
star
31

emacsredux-legacy

Emacs Redux
HTML
1
star
32

praxis

Praxis makes perfect!
OCaml
1
star