Emacs: auto-save (filename with #hashtag#)

By Xah Lee. Date: . Last updated: .

What is auto-save

Emacs has auto-save-mode, however, it's not automatically saving file in a modern sense.

emacs auto-save-mode periodically saves a copy of your file, with a temp file name bracketed by NUMBER SIGN # , e.g. #filename#.

When you save the file, those #temp-file# are deleted automatically.

In case of crash or electricity outage, when you open a file afterward, emacs will detect those hash-tagged files and ask if you want to recover.

Problem of #auto-save# backup

But the problem is, even if no crash, in lots of situations (such as sync to server), you'll find those #files# annoying, because they are often symbolic links to non-existent files, and will cause tools like rsync to complain or choke some dir walk scripts.

disable emacs #auto-save# backup

put this in your Emacs Init File:

;; stop creating those #auto-save# files
(setq auto-save-default nil)

stop emacs from creating .#lock file links

emacs backup problem 2018-10-12 58cc4
emacs lock file problem 2018-10-12

Emacs backup is so annoying. Even when you have it off (setq auto-save-default nil) , it still creates temp hashtagged files, which crash scripts that traverse dir.

put this in your Emacs Init File:

(setq create-lockfiles nil)

This will completely stop emacs from creating temoporary symbolic link file named “#something”.

(disable lock file may be a problem if you have situations where a file is being edited by different people or instances of emacs.)

2018-10-12 thanks to Dale Hagglund [ https://twitter.com/DaleHagglund/status/1050786629844004865 accessed: 2018-10-12] for create-lockfiles

Emacs: auto save, backup

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial

Emacs Init

Init Basics

Keys

Font

Text Editing

Completion

File

Restore Things

Backup/AutoSave

Line

Appearance

Misc

Advanced Init Tips

packages