Questions tagged [saving]
The saving tag has no usage guidance.
55
questions
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 ...
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 ...
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-...
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 (...
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)...
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 ...
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 ...
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 (...
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 ...
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 ...
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
...
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?
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 ...
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 ...
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 ...
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?
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?
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 ...
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 #...
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 ...
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 <...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
-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.
...
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 ...
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 ...
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 ...
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.
...
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'...
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 ...
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 ...
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?
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 ...
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:
...
-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 ...
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...)
)
...
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 ...
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 ...
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\...
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, ...
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 ...
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. ...
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 ...
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 ...