Questions tagged [saving]
54 questions
58
votes
1 answer
How to view diff when emacs suggests to recover this file?
Sometimes it happens: emacs prompts you about recovering unsaved changes to a file, but you cannot remember if you want those changes or not.
Starting at the recover-this-file buffer, is there a way to view a diff or otherwise directly see the…

Sparx
- 1,111
- 9
- 20
33
votes
5 answers
How do I automatically save org-mode buffers?
I regularly use org-mode and the agenda to keep track of my to-do list. Since I use Dropbox to sync my list, I need the same tasks to be available on all computers. Sometimes during the course of my cleanup I will forget to save my changes, leaving…

Ryan
- 3,989
- 1
- 26
- 49
29
votes
4 answers
How to auto-save buffers when Emacs loses focus?
I recently had a Sublime Text user try out Emacs for a while, and he was interested in getting the same auto-save behavior in Emacs.
Basically, he wanted all buffers to be saved whenever the frame lost focus (really saved, not just backed-up). This…

b4hand
- 1,995
- 1
- 19
- 31
15
votes
1 answer
Execute external script upon save when in a certain mode?
When I'm in org-mode, I want Emacs to execute a bash script I wrote whenever I hit C-x s to save. The script automatically syncs the file I am saving to my Raspberry Pi. It expects the file name as argument.
How do I tell Emacs to run the external…

qacwnfq q
- 253
- 3
- 6
14
votes
2 answers
How to save a copy of a buffer to a file?
I would like to be able to save a copy (or a snapshot) of a buffer into a file. The behavior would be similar to write-file, except that it would not set the buffer to visit this file.
For a usecase, imagine that you have a shell session, and you…

T. Verron
- 4,233
- 1
- 22
- 55
14
votes
2 answers
Saving Calc trail for later use
Is there a possibility to save the Emacs Calculator Trail (as a file) and to restore it later? If not, should it be feature?
For example, when I have an incomplete calculation but have to shutdown my Emacs, it would be great if i can continue…

estownya
- 303
- 1
- 7
10
votes
2 answers
Strip text properties in savehist
I save the kill-ring using the savehist package. savehist saves the kill ring with text-properties intact.
Unfortunately, this is a problem.
I have a rather large emacs config, and I use a lot of highlighting. Here is the first element of my…

PythonNut
- 10,243
- 2
- 29
- 75
7
votes
2 answers
How to run an `after-save-hook` only when the buffer has been saved manually
This question is inspired by https://emacs.stackexchange.com/a/5947/.
Assume that I have a function like
(defun do-some-actions () ()
(..put a copy of the current file in a specific folder...)
)
And I would like that the above function to be run…

Name
- 7,689
- 4
- 38
- 84
6
votes
2 answers
How to save multiple buffers
After modifying multiple files, how can I save all their buffers?

elarson
- 601
- 4
- 8
6
votes
1 answer
Automatically saving the current file after typing a certain number of characters
Is there a way to force Emacs to automatically save the current file (if it is not already saved) after typing n characters (n is a number determined by the user).
Edit: After the comment of @Dan and the suggestion of @lawlist it seems that the…

Name
- 7,689
- 4
- 38
- 84
6
votes
2 answers
Save all open files in current folder and subfolders
Some of my projects are organised in way that the there isn't one make file at the top route of the project (git/svn/...) folder but I have several small Makefiles in subfolders of the project. Normally I use Projectile to save only files related to…

kain88
- 825
- 7
- 19
6
votes
1 answer
Make Emacs diff files before asking to save
When I run save-buffers-kill-emacs or projectile-kill-buffers I get asked to save changed buffers. But for me a lot of these buffers do not differ from the file on disk. Can I make Emacs diff the buffer and file and only ask if there are…

Emil Vikström
- 223
- 1
- 6
5
votes
1 answer
Fix 'changed on disk'/'Reread from disk' when file has not changed
Is there any way to get emacs to actually check the contents of files on disk when determining this?
E.g. if I have some unsaved changes to a file, and temporarily switch source control branches (to make changes to other files), then switch back…

EoghanM
- 205
- 1
- 4
4
votes
2 answers
Backup saved buffers to Dropbox (or other specific directory)
Is it possible to customize Emacs so that whenever I save a file, Emacs also copies it to a specific folder?
This directory could be, for instance, D:\my_backups or C:\Users\username\Dropbox\my_backups.
The copy should have the same name as the…

Name
- 7,689
- 4
- 38
- 84
4
votes
1 answer
How to auto-format an Elisp file on save?
Having used clang-format to format the buffer when saving, I find this functionality useful.
Are there tools to reformat an Elisp buffer when saving?

ideasman42
- 8,375
- 1
- 28
- 105