Questions tagged [saving]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
13 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-...
user avatar
1 vote
2 answers
45 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 (...
user avatar
  • 2,919
0 votes
0 answers
83 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)...
user avatar
  • 101
0 votes
1 answer
68 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 ...
user avatar
  • 151
2 votes
1 answer
32 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 ...
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 (...
user avatar
1 vote
1 answer
59 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 ...
user avatar
  • 158
2 votes
1 answer
441 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 ...
user avatar
  • 8,629
0 votes
1 answer
116 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 ...
user avatar
1 vote
1 answer
932 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?
user avatar
  • 7,277
1 vote
1 answer
489 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 ...
user avatar
0 votes
0 answers
544 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 ...
user avatar
1 vote
2 answers
105 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 ...
user avatar
  • 1,081
2 votes
2 answers
215 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?
user avatar
  • 999
1 vote
1 answer
574 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?
user avatar
  • 35
0 votes
0 answers
101 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 ...
user avatar
  • 101
0 votes
0 answers
121 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 #...
user avatar
2 votes
1 answer
501 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 ...
user avatar
  • 608
1 vote
0 answers
157 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 <...
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 ...
user avatar
  • 1,414
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 ...
user avatar
2 votes
1 answer
86 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 ...
user avatar
3 votes
0 answers
1k 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 ...
user avatar
  • 31
1 vote
2 answers
614 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 ...
user avatar
0 votes
1 answer
102 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 ...
user avatar
3 votes
4 answers
979 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 ...
user avatar
  • 1,350
1 vote
1 answer
143 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 ...
user avatar
  • 1,333
-1 votes
1 answer
85 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. ...
user avatar
1 vote
1 answer
357 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 ...
user avatar
  • 2,737
2 votes
1 answer
66 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 ...
user avatar
  • 135
3 votes
2 answers
170 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 ...
user avatar
  • 7,364
0 votes
2 answers
185 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. ...
user avatar
  • 567
0 votes
0 answers
40 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'...
user avatar
3 votes
1 answer
387 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 ...
user avatar
  • 2,480
6 votes
1 answer
328 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 ...
user avatar
1 vote
1 answer
145 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?
user avatar
  • 238
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 ...
user avatar
  • 205
4 votes
1 answer
162 views

Save a buffer to multiple files

I have 2 files /home/user/myproject/myfile.el /ssh:user@myserver.org:/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: ...
user avatar
-1 votes
1 answer
16 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 ...
user avatar
  • 3,261
7 votes
2 answers
7k 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...) ) ...
user avatar
  • 7,364
14 votes
2 answers
413 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 ...
user avatar
  • 173
6 votes
1 answer
539 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 ...
user avatar
  • 7,364
4 votes
2 answers
568 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\...
user avatar
  • 7,364
11 votes
2 answers
3k 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, ...
user avatar
  • 4,113
1 vote
1 answer
690 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 ...
user avatar
6 votes
2 answers
264 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. ...
user avatar
  • 795
9 votes
2 answers
677 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 ...
user avatar
  • 10.1k
13 votes
1 answer
4k 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 ...
user avatar
  • 233
56 votes
1 answer
4k views

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 ...
user avatar
  • 1,071
2 votes
1 answer
103 views

Warning about modification of files which should be static

Some files in Emacs should not be modified, for example: an .el.gz library file which is expected to behave "properly" an external extension, which will be overwritten on update Anyway, there are ...
user avatar