Questions tagged [files]

Use this tag for questions about moving, deleting, or opening files. Or for questions about the difference between a buffer and its file. For topics such as "Saving Files", use "buffers" instead.

Filter by
Sorted by
Tagged with
31
votes
2answers
6k views

What's the difference between a buffer, a file, a window, and a frame?

When posing questions on this site, people sometimes talk about "windows" when they mean "frames," and "buffers" or "files" when they mean "windows." So: Q: What is the difference between a buffer, ...
60
votes
5answers
15k views

Edit file with super-user rights

When you have to edit system files, it's an usual situation that you launched Emacs with a normal user before, so the file will be write-protected. What can I do to gain root privileges? I mean ...
3
votes
2answers
2k views

Setting default-directory does not change find-file directory

I try to set a default path for opening a file via C-x C-f by adding the following to my .emacs: (setq default-directory "~/some_dir/") However, after I launch Emacs in some directory, the find-file ...
120
votes
9answers
76k views

How do I reload a file in a buffer?

I usually work on files which are updated in the file system via version control. What's a quick way to reload a file without having to C-x C-f the file again and getting asked if I want to reload it?
10
votes
2answers
546 views

Programmatically insert files into Dired buffer

I have a list of file names (with full path) and I want to create a Dired buffer listing this set of files. How would I go about doing that? How do I create a Dired buffer from a list of file names? ...
18
votes
2answers
5k views

Save current file with a slightly different name

My files have long filenames and a part of the filename is a date and a version number. Often I'd like to save the file in the buffer using nearly the same name, just change version number or date. ...
14
votes
4answers
1k views

How to tell Ido to get out of the way when I can already just paste the file name?

I'm trying to make myself use Ido mode. Some times it's nice, but other times it is extremely stupid. Here's my greatest disappointment. I read some log with full file names, then I copy one name, ...
5
votes
1answer
1k views

Character encoding when copying some text from somewhere to Emacs and saving to a file

Suppose I copy some text from a source (e.g. a webpage, a text file opened in an editor such as gedit or emacs) to a buffer in emacs, and then save the buffer to a text file. When I copy the text ...
3
votes
1answer
512 views

Open recent files buffer (recentf-mode) filled with autoload.el files

I've a problem with recentf-mode buffer in emacs. Apart from the files I opened before, its also showing all the autoload files for various packages I've installed which is cluttering the Open recent ...
11
votes
2answers
928 views

What's wrong with `find-file-noselect`?

In a recent answer by lunaryorn, he stated: However, I'd recommend against most other parts of Org, for reasons already stated in comments: It's old, and full of legacy and harmful practices (...
15
votes
6answers
4k views

Recursively list all files and sub-directories

Is there a way, possibly using a package, to recursively list all the files (with paths) and sub-directories (or at least the empty sub-directories, since the paths to the non-empty ones can be ...
12
votes
1answer
3k views

Open file in new window after searching it with helm

As written in A Package in a league of its own: Helm there's a way to search for a file using Helm decide after searching whether open it in same or other window My question is: How?
14
votes
2answers
8k views

Run command when opening a file of a specific filetype

I'm trying to get a lisp script to run some commands for me when I open a file of a specific filetype. I know that I'm working in the correct init file because if I remove the theme from it, emacs has ...
13
votes
5answers
6k views

Comparing two text files on a Windows system

Since ediff-files and ediff-buffers result in apply: Searching for program: no such file or directory, diff error on windows machines. How to compare two files using Emacs on a windows system?
8
votes
4answers
12k views

Spacemacs: kill buffer and kill window in one command?

Is there a spacemacs command that both closes the window and kills the buffer? In other words, the equivalent of Vim's :q?
9
votes
4answers
2k views

How do I search and replace over a set of files?

I'd like to define a set of files within which I can search and replace text. To clarify: I would like to be able to search, e.g., in all files xk*.tex in a given directory (and excluding backup ...
7
votes
2answers
1k views

.tramp_history files

I have noticed that opening a tramp connection on remote hosts sometimes created a .tramp_history file in the user's directory. Is there any way to disable such a behavior? I have to log in to many ...
5
votes
2answers
1k views

What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

helm-find is Preconfigured ‘helm’ for the find shell command I need the same functionality with ivy/counsel.
4
votes
3answers
358 views

Switch buffer to the file path in current cursor position

My .emacs file contains multiple file names as, (load "~/.emacs.d/others/keymaps.el") (load "~/.emacs.d/others/py.el") (load "~/.emacs.d/others/web.el") Is there a way any library, gives way for me ...
7
votes
2answers
924 views

How can I jump to a file and line number from a list in a buffer?

I have a buffer with content like: src/file4.rs:9 src/file4.rs:33 src/file4.rs:64 I'd like to be able to put my cursor on a line and jump to the appropriate file / line in the other window, just ...
6
votes
1answer
664 views

Specify major-mode for files with multiple extensions

In my .emacs file, I have: (setq-default major-mode (lambda () (let ((buffer-file-name (replace-regexp-in-string "\\.tmp$" "" ...
5
votes
1answer
111 views

How do I include non-code resources as part of an Emacs package?

I have a project that wants to play a sound file. I'd like to distribute this project in MELPA. There are two issues I'm having with that. They're both part of the question "how do I use resources in ...
5
votes
0answers
104 views

Why is cloning of file buffers prohibited?

Why does clone-buffer not work on file buffers. I can make it work by the following advice: (advice-add 'clone-buffer :around (lambda (oldfun &rest args) "Allow cloning file buffers." ...
5
votes
3answers
769 views

Load all org files into buffers?

I've got a couple dozen org files that I'd like to have loaded at once. They're in a directory structure something like this: org/dev org/dev/python.org org/dev/emacs.org ... org/dev/ios org/dev/ios/...
0
votes
6answers
515 views

How to append contents of multiple files into one file?

Emacs 26.1, Windows 10, Dired+ How to append contents of multiple files in one folder into one file?
4
votes
2answers
464 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\...
2
votes
0answers
158 views

How to find/grep in Python virtualenv with projectile/helm easier?

How I can customize helm/projectile behaviour to find files and grep in $VIRTUALENV dir easier? Or maybe I can write some function(s) to find/grep in virtualenv of current project?
1
vote
1answer
124 views

Loading addition org files along with default scratch buffer

I do a lot of my programming in Haskell and Python. I've started maintaining a personal cheat-sheet for each of these languages for common constructs and tasks I often come across. Hence whenever I ...
1
vote
1answer
718 views

prelude-ivy: How to select and open multiple files

I have installed Ivy (along with Swiper and Counsel) as part of Prelude by doing a (require 'prelude-ivy) in my prelude-modules.el file. It seems to work, but I am not able to figure out how to do ...