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.

164 questions
7
votes
3 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,558
  • 3
  • 23
  • 46
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
4
votes
2 answers

find-file for file path with space in windows

In Windows, both find-file and helm-find-file don't work if there's space in the file name. For example: I move cursor to the anywhere in the string "c:/a/b.yaml", and then call find-file (C-x C-f), press RET, then Emacs will open the file. but this…
yi.tang.uni
  • 1,017
  • 8
  • 20
2
votes
1 answer

Load a file into a buffer without changing the display

I have a use-package idle hook that loads my org files into buffers for future use. I want this to be unobtrusive. However, I cannot find any find-file function which loads a file without changing the display. There are a number of find-file…
Matthew Piziak
  • 6,038
  • 3
  • 31
  • 79
2
votes
0 answers

Ignore a directory most of the time with find file in project

I have a directory structure like this: a src target b src target c src target generated_source_files x y z When I run ffip, I usually want to ignore looking for files in the target directories. However, the c module…
Troy Daniels
  • 541
  • 3
  • 13
2
votes
1 answer

How to add a specific extension on filename for new files?

Say i create a new file using find-file (by typing a non-existing filename, since it create a newfile with said filename) How could i add the .org extensions at the end automatically? I heard of hooks on emacs but i wasn't sure if this was the…
Nordine Lotfi
  • 357
  • 2
  • 13
2
votes
2 answers

list files in directory in reverse order of date

When finding files with Ctrl-x Ctrl-f and then pressing Tab, to list the file completion names, is there a way to list these files in reverse order of their dates (when they were last edited)? Currently emacs lists them alphabetically. Is there a…
Vikram
  • 327
  • 1
  • 7
2
votes
1 answer

Open folder `/ssh:example.com` or file in it

You can open SSH resources in Emacs. Unfortunately, the pathspec used for SSH resources conflicts with possible paths in the virtual file system. If I run sudo mkdir "/ssh:example.com" sudo touch "/ssh:example.com/file" , I cannot figure out a way…
UTF-8
  • 915
  • 6
  • 22
2
votes
2 answers

How to find a file recusively in children directories?

How to find a file recursively in children? Like the opposite of locate-dominating-file (locate-dominating-file finds file recursively in its parent directory)?
1
vote
1 answer

ff-find-other-file

works well, particularly after custom defining additional file type pairs with (defvar my-cpp-other-file-alist '(("\\.cpp\\'" (".hpp" ".cuh")) ("\\.hpp\\'" (".cpp"".cu")) …
CD86
  • 563
  • 2
  • 11
1
vote
1 answer

What's an easy way to do find file then fuzzy search by filename?

I am trying to learn emacs in order to use orgmode. I came from vscode universe. There's a Cmd+P in vscode that allows search by filename easily. Looks like this. Then i can use cursor keys to go up and down and hit enter it will open as new…
Kim Stacks
  • 111
  • 3
1
vote
1 answer

How to limit the up-directory search for file info

As Emacs opens a file it does all sorts of useful things including walking up the directory tree for more information (repos etc). I'm in a situation where I need to curtail that climb. Is there a mechanism for this or other work around?
rjs
  • 11
  • 3
0
votes
2 answers

how to specify multiple file extensions and open it in separate buffer

To find files by multiple file extensions I use in Linux smt like this (in terminal): find ./ -type f \( -iname \*.txt -o -iname \*.json \) And here…
a_subscriber
  • 4,062
  • 1
  • 18
  • 56
0
votes
1 answer

Open folder in emacs and type name to match file

I have this line in my init.el: (global-set-key (kbd "C-c g") (lambda() (interactive) (find-file "~/Dropbox/myorgfiles"))) So when I type C-c g I get the directory contents of the myorgfiles folder. But I would like to be able to start typing and…
Emmanuel Goldstein
  • 1,014
  • 8
  • 18
0
votes
1 answer

find-name-dired: find exited abnormally with code 2

Windows 10, Emacs 25.1 I try to find all el files in emacs folder and all subfolders: M-x find-name-dired /path/to/emacs-25.1 *.el Result is error: find . "(" -iname "*.el" ")" -exec ls -ld {} ";" File not found - "*.el" find exited…
user8542613
  • 663
  • 6
  • 16
1
2