Questions tagged [find-file]

is the most frequently used command for opening files in Emacs.

C-x C-f invokes the find-file command, which then accepts a file name typed in the mini buffer area. On RET key, Emacs visits the file, which entails creating a buffer, copying the contents of the file into the buffer, formatting the contents according to the relevant settings and mode of the file, and then displaying the buffer for editing.

Emacs has dozens of other commands related to the find-file command that can be used for more specialized needs. For example, find-file-read-only opens the file for viewing only. Use the tag for questions pertaining to all such file commands.

161 questions
51
votes
7 answers

How to use an external program as the default way to open PDFs from Emacs?

When I M-x find-file a PDF, it is opened in Emacs. While this is nice, Emacs' PDF viewer lacks many features that I need and I would prefer to open PDFs in an external program instead. How can I configure Emacs to use an external program as the…
tmalsburg
  • 2,540
  • 1
  • 14
  • 29
13
votes
6 answers

Recently opened files in ido-mode

I use ido-mode, but one thing I hate about it is that after C-x C-f I cannot use up/down keys to cycle through recently opened files, as it used to be for example with iswitchb. How can I set ido to work this way?
10
votes
3 answers

Is there a way to show/open a file from a URI/URL

Is there some way to download and show a file from a URI/URL? I now I can use wget and then open the downloaded file and I guess I could even try to write myself a small function to do this. But most likely someone did before me so is there a…
Random Dev
  • 203
  • 3
  • 7
8
votes
1 answer

open files at last-edited position

What I want to achieve is this. I open a bunch of files, edit them and quit Emacs. then tomorrow I open one the files and I want Emacs to jump to the last edited position on that file. How can I achieve this ?
milad zahedi
  • 205
  • 1
  • 5
7
votes
2 answers

Template for new file

When opening a new file of certain types, I would like some boilerplate to be inserted. That is, when opening a buffer for a file that does not yet exist, insert some predefined text, optionally with some variable interpolation. Things I can think…
mkaito
  • 741
  • 6
  • 16
7
votes
4 answers

How show recent files?

windows 10, emacs 26.1 Suppose I open 10 files. And then restart Emacs. After restart I need to see what files (recent) I was open before. Is it possible to show some buffer that contain name of this 10 files?
a_subscriber
  • 3,854
  • 1
  • 17
  • 47
7
votes
3 answers

When using C-x C-f turn off the suggestions

When i do C-x C-f to create a new file in the directory A, if emacs finds another file in another directory (say B) with exact same name, in the mini-buffer it changes the path to the other existing file (forcing me to open the old file instead of…
user12021
7
votes
1 answer

How to check, if a file is already visited?

I have the following code, which opens a file, inserts some text, saves the file and closes it. (defun batch (file) (find-file file) (end-of-buffer) (insert "nix") (save-buffer) (kill-buffer)) If the file is already visited the buffer…
ceving
  • 1,308
  • 1
  • 14
  • 28
6
votes
2 answers

How to use find-file with wild-cards non-interactivley?

In this post it talks about opening org files via find-file. I'm trying to do this non-interactivley. I try calling: (find-file "~/git/LeoUfimtsev.github.io/org/" "*.org") But instead of opening all org files, it pops up with a list of possible…
Leo Ufimtsev
  • 4,488
  • 3
  • 22
  • 45
6
votes
2 answers

How do I open a file in spacemacs?

Say I have spacemacs open and now I want to launch some sort of file browser to open a file. How do I do it? I have found SPC f f which sort of works but the navigation is quite cumbersome. There is also SPC f F but I can't even see a…
Elias
  • 161
  • 1
  • 3
6
votes
6 answers

Quick jump to a specific line of a file

After opening a .txt file with Emacs, when the point is at the line /folder/subfolder/file.xml:435 How can I fast jump to line 435 of the above mentioned file? What I tried: dired-at-point and find-file-at-point
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
5
votes
3 answers

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…
h4labs
  • 269
  • 1
  • 9
5
votes
1 answer

how to open a file without using Ivy

Under most operations, when I open a file with C-x C-f Ivy pops up my narrowing list at the bottom and its great. However, I have a current situation when I'd like to open a file on a remote host in a directory that has 60,000 files in it. So when…
Vince W.
  • 395
  • 2
  • 11
5
votes
2 answers

How to pipe large files through fold before opening?

On a regular basis I need to open files that have really long lines, which unfortunately causes emacs to grind to a halt. My understanding is that this is a long-term issue with the renderer. I've tried disabling every possible mode, using every…
Joseph Garvin
  • 2,061
  • 8
  • 21
5
votes
4 answers

Find file in directory

I switched to Org Mode and Emacs few weeks ago. I find it incredibly better than my previous (simple but effective) setup based on markdown files and VS Code editor. I'm learning new features everyday but there's one thing from VS Code that I really…
Marco Sgnaolin
  • 151
  • 1
  • 4
1
2 3
10 11