Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create temporary files `.#filename` in `/tmp`, not working directory

Tags:

emacs

elisp

When files are being modified in Emacs, a temporary file is created in the working directory that looks like this: .#filename. The file is deleted when the buffer is saved.

I found a few of these types of temporary files in my Git remote repositories, and I thought it might be better to nip the bud at the source instead of configuring Git to ignore them for every project.

How can we configure Emacs to create those files in the /tmp directory instead of the working directory?

like image 730
lawlist Avatar asked Apr 26 '14 22:04

lawlist


People also ask

How to create a temporary file in Java?

In Java, we can create a temporary file using an existing method known as File.createTempFile () method which creates a new empty file on the specified directory.

How to create a temporary file in a directory using PowerShell?

The createTempFile () function creates a temporary file in a given directory (if the directory is not mentioned then a default directory is selected), the function generates the filename by using the prefix and suffix passed as the parameters. If the suffix is null then the function uses “.tmp” as suffix. The function then returns the created file

How do I get the file name of a temporary file?

Thank you. Applications can obtain unique file and path names for temporary files by using the GetTempFileName and GetTempPath functions. The GetTempFileName function generates a unique file name, and the GetTempPath function retrieves the path to a directory where temporary files should be created.

What is the purpose of the temporaryfolder rule?

The TemporaryFolder Rule allows creating files and folders that are guaranteed to be deleted when the test method finishes (whether it passes or fails). As a conclusion here see some notes regarding the Java File class temporary files:


1 Answers

The file at issue is called a lock file -- commencing with Emacs version 24.3, it can be controlled with the following setting:

(setq create-lockfiles nil)

https://stackoverflow.com/a/12974060/2112489

like image 173
lawlist Avatar answered Sep 29 '22 07:09

lawlist