

GitHub - bbatsov/super-save: Save Emacs buffers when they lose focus
source link: https://github.com/bbatsov/super-save
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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-2020 Bozhidar Batsov and contributors.
Distributed under the GNU General Public License; type C-h C-c to view it.
</article
Recommend
-
131
Emacs Prelude Prelude is an Emacs distribution that aims to enhance the default Emacs experience. Prelude alters a lot of the default settings, bundles a plethora of additional packages and adds its own core library to the mix. The final...
-
247
Projectile Synopsis Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies (when feasible). For...
-
140
A Collection of Ridiculously Useful eXtensions for Emacs. crux bundles many useful interactive commands to enhance your overall Emacs experience. Most of the crux commands...
-
141
zenburn-theme for Emacs About Zenburn for Emacs is a direct port of the popular Zenburn theme for vim, developed by
-
157
Solarized for Emacs Solarized for Emacs is an Emacs 24bit theme making use of of the Solarized palette, developed by Ethan Schoonover. You can find several screensh...
-
137
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
-
140
README.md
-
57
README.md Bozhidar's Emacs config This repo contains my personal Emacs configuration. I don't advise people to use it directly and I won't be accepting pull requests (after all that's my config...
-
10
Magically resurect Emacs shell buffersJuly 6, 2020This article is part of a multi-post series about how to better deal with interactive shell buffers in Emacs:Quitting a shellOn some terminal emulators, whe...
-
7
saveplace-pdf-view saveplace-pdf-view extends the built-in mode save-place by adding support for pdf-view (see pdf-tools) and DocView buffers. This pac...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK