Questions tagged [saving]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

How to change SIGTERM behavior?

I run emacs in konsole terminals in KDE. If I accidentally alt-F4 such a window, it dies with emacs and I lose unsaved data. I believe it is emacs responding to A SIGTERM sent by the Alt-F4, as ...
user272901's user avatar
0 votes
0 answers
13 views

How to save/revert changes to only parts of a buffer?

I'd love a partial save-buffer and/or revert-buffer (if I have one, I think I could easily enough implement the other). Perhaps where I select a region and have only changes within that region get ...
mtraceur's user avatar
  • 256
0 votes
2 answers
25 views

Save before running tests? (Prepend function?)

How can I prepend a function call in Elisp? E.g. I have a key binding (C-c C-c C-t) that runs some tests (command rustic-cargo-test) and it always asks me if I want to save - I'd like to run (save-...
John Graham's user avatar
2 votes
2 answers
97 views

How to warn before editing or saving a buffer whose underlying file no longer exists?

(NB: In this post, I will use expressions like "a buffer's underlying file" to mean, in the Emacs' documentation's terminology, "the file a buffer is visiting", i.e. the value of (...
kjo's user avatar
  • 3,207
0 votes
2 answers
649 views

Emacs on Windows won't save

I'm a total beginner to Emacs. I followed the tutorial that came with it, but when I tried to use C-x C-s, the echo area shows the message Opening output file: Permission denied, c:/Program Files (x86)...
awe lotta's user avatar
  • 101
0 votes
1 answer
97 views

How to prompt to save the modified buffer before switching?

Vim prompts to save the buffer before switching if no other window is holding it. In other words, it prompts to save the buffer before putting it in background. How can I get the same behavior in ...
tejasvi88's user avatar
  • 151
2 votes
1 answer
70 views

"Auto-Confirmation: Automatically Saying Yes" but how?

i have (defun insert-buffername () (interactive) (compile (concat "lua " (buffer-file-name)))) (global-set-key (kbd "C-c C-e") #'insert-buffername) but when i use this key ...
oleg harput's user avatar
1 vote
0 answers
22 views

Is there an easy way to check (in elisp) if only one character has changed in a buffer before saving it?

I have a typing problem in Emacs under WSL. Sometimes it misses my typing ^x as in ^xp and ^xo (prev and next window in my bindings) and I get a stray p or o character in the buffer I want to leave (...
intel_chris's user avatar
1 vote
1 answer
90 views

Simple password based file decryption/encryption compatible with command line program?

What works currently: With emacs25 (as comes with ubuntu 18) I use ccrypt on the command line to selectively en/decrypt a few specific text files. There is a package elpa-ps-ccrypt which, on ...
Harald's user avatar
  • 220
3 votes
1 answer
705 views

How do I save raw bytes into a file?

I'm trying to make a .wav file generator in Emacs Lisp. I have some binary data, as a sequence of bytes: (setq binary-data (list 62 236 60)) I would like to insert that data into a file. I expect ...
zck's user avatar
  • 9,034
0 votes
1 answer
213 views

How can I save files in Emacs on OSX and preserve the file creation date?

Let's say I create a file called foo.txt in emacs. The time is 12:00. It's currently empty. At 12:10, I use emacs to add text to the file. I save it. The new timestamp given with getfileinfo is ...
James Gatz's user avatar
4 votes
1 answer
2k views

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's user avatar
  • 8,546
2 votes
1 answer
638 views

Syncronize on save

Is there any extension or easy way to configure a feature like the Visual Code Studio's extension SSFTP? The ideal behaviour should be like the following one, by using ftp or sftp: Allow a manual ...
ABu's user avatar
  • 280
0 votes
0 answers
625 views

IO Error writing filename: Input/Output error

Using emacs 24.3-22 on CentOS 7.6.1810. Writing to home directory on cifs mounted share. When writing a file auto-saves will work, but actually clicking the save button or doing Save As gives IO ...
zkenpachi's user avatar
1 vote
2 answers
127 views

How to increase a magic number in a file buffer on each save

I want to change a magic number (or a time stamp) in a file buffer on each save. The position of the magic number in the buffer can be given through a regex with a keyword or similar. Is there any ...
halloleo's user avatar
  • 1,311
2 votes
2 answers
340 views

Resolving the conflict when the file on disk has been changed

When a file changes on disk while you're editing in Emacs, how to merge both sets of changes into the file?
Nova's user avatar
  • 1,059
2 votes
1 answer
822 views

Saving file everytime leaving insert mode in evil-mode

Is there a way that I can automatically save the file when leaving insert state to go to normal state with ESC?
Phaino's user avatar
  • 45
1 vote
1 answer
196 views

Save current location in Emacs tutorial

I am learning Emacs by doing built-in tutorial (C-h t). However, when I decide to take a break and exit the editor (C-x C-c) and then later rerun the tutorial the position when I finished before is ...
lukeg's user avatar
  • 111
0 votes
0 answers
150 views

ein: [info] Failed to save notebook

I'm using Windows 10, Emacs 26.1, IPython 7.2.0, and ein 20190228.2008. C-x C-s gives the error: ein: [info] Failed to save notebook! . I'm able to save the files through the web interface. As per #...
troisquatre's user avatar
2 votes
1 answer
880 views

Emacs freezes when saving org file in org-mode

For some reason I cannot save files while in org-mode. This happened after I updated to a most recent version of org-mode. If I change to text mode I can save without a problem. I have tried C-x C-w ...
Ajned's user avatar
  • 672
1 vote
0 answers
187 views

Problem saving (C-x C-s) files on a NFS drive with emacs 24/25

Starting with Emacs 24 (using various different versions of Ubuntu and Linux Mint), if I open a file on an NFS drive, modify it and attempt to save it C-x C-s, I get the message of: Saving <...
Don Allingham's user avatar
2 votes
1 answer
1k views

Delete auto-save file when killing Emacs without saving buffer

When I have unsaved buffers and I kill Emacs with save-buffers-kill-terminal (C-x C-c) I'm asked whether to save each buffer. Is it possible to delete a buffer's auto-save data when I answer n? I had ...
Arch Stanton's user avatar
  • 1,575
0 votes
1 answer
33 views

Rewriting all file when save some changes

I work on Rails project in my Emacs25. When I change one specific file and save changes I got all file changed (from git diff). But when I try to old and new versions of this file in Meld - I get ...
Alexey Moshkin's user avatar
2 votes
1 answer
91 views

How to avoid accidentally writing temporary source-block-edit-buffers to file

When doing literate programming in org-mode, I frequently use C-c '[aka M-x org-edit-special] to enter the source-block-edit-buffer, so that I have appropriate yasnippets etc. I then accidentally ...
Alex Stragies's user avatar
4 votes
0 answers
2k views

Emacs sometimes fails to save files

I'm experiencing a weird problem with Emacs on Windows where sometimes, after a while, the current buffer I'm in throws an error when attempting to save the file. I can't seem to reliably reproduce ...
sonictk's user avatar
  • 41
1 vote
2 answers
692 views

Tramp: Cannot Save File

I am new to tramp and I am trying to edit a file stored in a remote server. I connect to the file through C-x C-f /ssh:username@host:path_to_file/myfile.m. And on my init.el I have the options: (setq ...
Guilherme Salomé's user avatar
0 votes
1 answer
134 views

Prevent emacs from saving previous versions of text files

I am editing a lot of text files in emacs and the automatic saving of previous versions is creating a massive amount of extraneous files. For example, if I edit a file called numbers.txt and ...
user17557's user avatar
4 votes
4 answers
1k views

Ask for saving contents if scratch buffer is modified before exit

I had made some random notes in my scratch buffer. By mistake, I pressed C-x C-c and killed the Emacs session. All my content in the scratch buffer was gone. Question: When I try to close Emacs ...
Prasanna's user avatar
  • 1,520
2 votes
1 answer
160 views

What are the '.#' links for? [duplicate]

When an Emacs buffer is modified, a broken link is created. The link's name is a concatenation of '.#' followed by the file's name. For example: $ ls .#spacemacs_ref.org -l lrwxrwxrwx. 1 wolfv wolfv ...
wolfv's user avatar
  • 1,393
-1 votes
1 answer
89 views

why is save-buffer asking for a chmod?

All of sudden, XEmacs 21.4.22 starts asking whether it should chmod a+x $f everytime I try to save a buffer that is in Shell-script mode. Switching it to fundamental-mode stops that behaviour. ...
PypeBros's user avatar
1 vote
1 answer
431 views

Save REPL buffer as file?

I've seen a discussion on someone trying to save the actual state of a Lisp Slime REPL. I just want to save a text version of a Geiser Racket REPL session, e.g., *ch1*, while using org-mode. (Then I ...
147pm's user avatar
  • 2,937
2 votes
1 answer
71 views

Saving very big files

I just noticed that Emacs will trim a very big file before saving it. I opened a 4.6 GB file (not the best thing to do, but anyway) and after saving, the file was trimmed to around 375 MB. It didn't ...
erickrf's user avatar
  • 135
3 votes
2 answers
228 views

Increment file name and create a new version of the file

Assume that I am working with a file whose name contains a unique version number for example myfile_03.tex or 03jhcjh.tex and so on. Currently I create a new version of the file by C-x C-w and ...
Name's user avatar
  • 7,749
0 votes
2 answers
228 views

Automatically save moved file to new location

If I open a file in emacs, and the file subsequently gets moved or renamed by a different program, emacs will still save the file to the old location and name. Example process: Open ex.txt in emacs. ...
Ben's user avatar
  • 597
0 votes
0 answers
53 views

ssh to a remove host and use emacs in the ssh session, cursor always move to the beginning of the screen when save file

I have a VPS server and I always ssh to it and us emacs in the ssh session. I found that when I save a buffer the cursor always move to the beginning of the screen. How to disable this behavior? I don'...
Just a learner's user avatar
3 votes
1 answer
432 views

Automatically show diff before saving file

I have a file that contains important information and I often have to make small changes in this file. Every once in a while I accidentally change something in this file and then save it without ...
tmalsburg's user avatar
  • 2,540
6 votes
1 answer
368 views

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 ...
Emil Vikström's user avatar
1 vote
1 answer
292 views

How can I get Emacs to save the changes automatically each X seconds?

How can I setup Emacs >= 24.4 so that it saves at least the current file I'm working on automatically, say, each 5 seconds, so that I don't have to press C-x C-s each time to save my changes?
Oskar K.'s user avatar
  • 278
5 votes
1 answer
2k views

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 ...
EoghanM's user avatar
  • 205
4 votes
1 answer
189 views

Save a buffer to multiple files

I have 2 files /home/user/myproject/myfile.el /ssh:[email protected]:/home/user/myproject/myfile.el Content of both of them are same. I want to make same change in both of them. I can do it like: ...
Vinayak Kaniyarakkal's user avatar
-1 votes
1 answer
17 views

Hide some entries in the customize interface? Or prevent the user from setting them?

I'm writing a package where I need to store some data and restore it in the next session. I don't want to create a file for it so my idea is to save it with customize-save-variable. This works great ...
clemera's user avatar
  • 3,441
7 votes
2 answers
9k views

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...) ) ...
Name's user avatar
  • 7,749
14 votes
2 answers
479 views

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 ...
estownya's user avatar
  • 303
6 votes
1 answer
618 views

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 ...
Name's user avatar
  • 7,749
4 votes
2 answers
629 views

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\...
Name's user avatar
  • 7,749
14 votes
2 answers
4k views

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, ...
T. Verron's user avatar
  • 4,263
1 vote
1 answer
718 views

Weird Prompt: file has changed since visited or saved. Save anyway? (yes or no)

I make some edits and press C-x C-s to save. Sometimes, out of blue emacs prompts this: file has changed since visited or saved. Save anyway? (yes or no). Even though I don't have the file open ...
user3995789's user avatar
6 votes
2 answers
303 views

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. ...
kain88's user avatar
  • 835
11 votes
2 answers
900 views

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 ...
PythonNut's user avatar
  • 10.3k
16 votes
1 answer
5k views

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 ...
qacwnfq q's user avatar
  • 263