Questions tagged [find-file]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
13 views

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 ...
1 vote
1 answer
33 views

Opening file in emacs buffer when using vterm

My current workflow is often to do things in a terminal and open/change relevant files in a text editor. Transitioning from VSCode to Emacs I am looking for a similar workflow that I got used to when ...
  • 13
3 votes
1 answer
128 views

Open file at startup from init file

I like that at start emacs visits a file with my todo list. For long time, this has been accomplished by adding (find-file "~/my-file.org") at the end of my configuration file (.emacs). ...
0 votes
0 answers
3 views

Why is P4 VCS causing find-file sudo edit of local file hangs tramp with "Checking ‘vc-registered’ for..."

I'm trying to sudo edit a local file with my configured Emacs 27.1 on Ubuntu, by doing find-file /sudo::/etc/vsftpd.conf. It hangs stating: Checking ‘vc-registered’ for /sudo:root@ubuntu2:/etc/vsftpd....
  • 641
1 vote
1 answer
22 views

How to toggle `helm-ff-skip-boring-files` during file navigation with `helm-find-file`?

I'd like to be able, with a keystroke, to hide/show boring files during the file navigation in helm-find-files. I defined a function (defun mxl/toggle-helm-ff-skip-boring () (interactive) (setq ...
0 votes
0 answers
9 views

Sort completions for find-file by mtime with fido/icomplete

With emacs 28, I'm trying to replace various uses ido/smex with the new fido-vertical-mode. However, one feature of ido that I like is this package ido-sort-mtime-mode that lets you sort files by ...
  • 1,482
0 votes
1 answer
25 views

How to force `find-file` to visit the existing frame of an opened file

The below function creates a new instance of the file myfile.txt (regardless of if myfile.txt is already opened or not). How to force emacs to use the existing frame of that file (if any)? (defun ...
  • 7,394
0 votes
0 answers
18 views

Rewriting paths for bazel

The Bazel build tool has some features that interact poorly with emacs. When you build a C/C++ project for sandboxing purposes it makes a crazy hierarchy of symlinks, and uses them when invoking GCC. ...
0 votes
2 answers
48 views

Is there some Emacs command that behaves as readlink -f to print the full path of a especific file?

In the terminal, I can do: $ readlink -f docker-compose.yml Which outputs: /home/pedro/projects/docker-stuff/docker-compose.yml I would like to have something like that in Emacs so that I can find ...
0 votes
2 answers
32 views

Find-file, but instead of showing file-names to select, show file content (html tag)

I'm attending a conference, and I have downloaded all abstracts so I can read them offline. They are all html files with the same structure. The files are numbered according to abstract submission ...
  • 3,413
0 votes
0 answers
13 views

Quick pattern expansion when using Tramp with Helm?

I find the "quick pattern" expansion in helm-find-files really helpful, e.g., the ability to just put a ~/ at the end of the pattern to jump to home or ending with / with to jump to the root....
0 votes
1 answer
31 views

Open shell from find-file interactively

Currently, I can use C-x C-f to find-file (or ido-find-file) then open a dired directory and launch M-x shell. Is it possible to interactively navigate a path be it a local ~/Documents or tramp shell ...
  • 229
0 votes
1 answer
19 views

If `counsel-git` returns `Not in a Git repository`, can we run `find-file`?

I am using counsel-git to find files in my git repo. I have overwrite into default find-file's keybinding. (global-set-key (kbd "C-x C-f") 'counsel-git) If I am not in a git-repo, such as ...
  • 1,074
2 votes
2 answers
83 views

Why does emacs recognize my wildcard with finding file but not with searching buffer?

In the linux terminal, i often use wildcards (*) as a shorter alternative to type in the whole file name: if the file is named foo-and-cats I just type in something like fo* in order to pull up the ...
0 votes
0 answers
24 views

Doom emacs deletes fortran module files

When I open a FORTRAN source file 'mod_module.f90' that defines a module 'mod_module' and another file named 'mod_module.mod' is present in the same directory, the later one gets deleted. This only ...
  • 123
0 votes
0 answers
23 views

Follow a file with row and column

How to make g f and/or find-file-at-point resolve file correctly in this format (gcc output) main.c:123:31: ....
  • 139
0 votes
2 answers
185 views

How to map keybindings to find-file?

How I can map keybindings to find-file since there is no find-file-mode-map or something like that? I am using the vertico minimalistic vertical completion UI.
0 votes
0 answers
63 views

open file specified via environment variable

Environment variables that points to specific location are of common occurrence. $HOME, $XDG_CACHE_HOME, %LOCALAPPDATA% and many more. It is pretty convenient to open files (and directories) just by ...
0 votes
1 answer
35 views

How to delete inserted directory names for `find-file` input?

I've been trying to figure out how to erase directories faster when I use find-file in vanilla Emacs. An example is Doom Emacs, you press backspace once, and erase the entire directory, but when I try ...
0 votes
0 answers
92 views

Dired: open file in another frame, but reuse an already existing one

I use a two-screen setup, and I like to have a frame with dired on one screen and another frame on the second screen. When I want to work on a specific file, I usually copy the file path from dired ...
1 vote
1 answer
82 views

How to multi-word search

When I use swiper to search inside a buffer I can use multiple search words separated by a blank space. This works. But I also want that behaviour when search for a file (C-x f), a variable or ...
  • 599
0 votes
1 answer
366 views

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 ...
1 vote
2 answers
106 views

grep contents of a set of files from find

I want to grep contents of all CMakeLists.txt files in a project (nested within a directory) so I can jump from each instance, like I would when running emacs grep function. In the examples below I'm ...
0 votes
0 answers
172 views

How to open a file in the current window

This question feels almost too basic, but I can't seem to find it. If you have two or more windows open in a frame, how do you open the file in the window that has your cursor? ctrl-x ctrl-f opens it ...
  • 101
0 votes
0 answers
69 views

How do I prevent find-file from filling in a file name?

Using spacemacs I usually open new files for editing with C-s C-f (for find-file), since that is recommended by this answer. However I have an issue when the file I wish to open is both new (doesn't ...
0 votes
1 answer
67 views

Restore privileged folder access for previously working Emacs.app on Catalina (NOT system upgrade)

This is similar to How to Restore File System Access in macOS Catalina but the problem is different. I did not upgrade my operating system, only the app, and none of the solutions there are valid ...
  • 63
2 votes
1 answer
93 views

C-x C-f TAB TAB: Find file completion list: how to highlight subdirectories?

Often I'd like to open a file in a subdirectory. But poor me, I can't remember the name. So when typing C-x C-f and then TAB TAB for the completion list, the list of all files in this directory is ...
  • 484
0 votes
0 answers
194 views

Disable `icomplete` with Emacs `find-file`

I have been experimenting with various completion frameworks in Emacs. I am currently using consult together with icomplete. I like the way things are working for me but I would like to disable ...
  • 1,069
2 votes
1 answer
498 views

C-x C-f Problem:

When i want to create a new file with C-x C-f (ido-find-file), and type main.lua, Emacs does not create a new file in the current directory (default-directory). Instead, it visits an existing main....
1 vote
2 answers
94 views

How to open a file in other window in the middle of function run?

I use notmuch to read emails. I've configured notmuch to call offlineimap via pre-new hook. When I press G to refresh my notmuch buffer, I want emacs to open my offlineimap log file in another window ...
1 vote
0 answers
52 views

find-file-hook when visiting file literally

I'm trying to hook into find-file-literally to turn off some global minor modes when visiting a file literally (which I usually do for large files). However, it does not appear that find-file-hook is ...
1 vote
2 answers
57 views

How can I make sure that Emacs opens files with extension `*.rec` as normal text files?

How can I make sure that Emacs opens files with extension *.rec as normal text files? When I try to open a file with the extnsion *.rec, I get the error message Running someFile.rec...done without the ...
2 votes
1 answer
50 views

Multi-directory tab completion for find-file?

I am frequently diving through many layers of directory hierarchies (thanks, Java) to find files named like this… java/test/com/company/thing/test/testy/testier/testier/Tester.java The main issue ...
0 votes
1 answer
732 views

dired by name - change directory and create new file

I want to open a new file in a different directory than the current one. Pressing C-x C-f -> I could enter a file name. But I don't. Pressing RET The directory listing (mode (dired by name)) comes ...
  • 599
2 votes
2 answers
112 views

completion-ignored-filenames?

Is there a way to do ignore whole file names the same way as 'completion-ignored-extensions' ignores filename extensions? For example, I would like to blacklist __pycache__/, so that if the default ...
  • 161
0 votes
0 answers
245 views

Windows File open SLOW

Windows 10 Emacs 27.1 From C-x C-f File Till seeing the file actually open can take almost a minute! Tried emacs instead of runemacs. Also Menu-file-visit All the same I think there's some Mcafee ...
  • 309
1 vote
1 answer
88 views

Global `C-x C-f` binding is overridden

I don't like ido-find-file, which seems to be the default response to C-x C-f in my Emacs 23.1.1 installation on Centos. I tried to change it in my .emacs file: (global-set-key (kbd "C-x C-f"...
  • 11
1 vote
1 answer
256 views

C-x C-f, Cannot complete file name for desktop folders

I am new to Emacs. I am trying to access a file in the "Emacs" folder on my desktop. I run the C-x C-f command, then type ~/Desktop/Em. I then hit TAB, but there's no completion. Emacs says [...
2 votes
1 answer
344 views

Don't show "." and ".." in counsel-find-file

I have a thing where I just don't like editing directories in emacs, and I never want to enter dired mode. Any time anything might want to put me into dired mode, I would prefer it not do that and ...
0 votes
2 answers
148 views

Unable to find files with ssh and environment variables

I have installed exec-path-from-shell as well as included the following in my init.el (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize)) within my ~/.bash_profile I have ...
  • 288
0 votes
1 answer
37 views

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 ...
5 votes
1 answer
319 views

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 ...
  • 345
2 votes
1 answer
127 views

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 ...
0 votes
1 answer
97 views

How to pass the result of yank to find-file?

So I wanted to basically copy the current selection, then yanking it into find-file, as when using: C-SPC: set-mark-command M-w: kill-ring-save C-x C-f: find-file C-y: yank While that works great, I ...
2 votes
1 answer
155 views

How to delete backward word in find-file using ido?

I was using regular find-file, and have a current setup to delete a word, which was working inside find-file. (defun backward-delete-word (arg) "Delete characters backward until encountering the ...
  • 1,074
0 votes
1 answer
164 views

Opening files in new frame

I'm using a fairly frame-oriented workflow (or trying to). I've run into something strange. If I write this: (defun find-file-existing (filename) "Edit the existing file FILENAME. Like \\[find-...
2 votes
1 answer
246 views

ivy counsel find-file with similar name

In the directory I have mongodb.js, now I want to create a db.js file but if I type the name and press enter counsel-find-file use regex to open mongodb.js. How can i create a db.js with counsel-find-...
1 vote
2 answers
68 views

Strange behaivor counting lines in hooks `find-file-hook` or `text-mode-hook`

For me, the clearest measure for the size of a file is its number of lines. So, I want this information in my mode line. I am using Doom emacs and, even I could define my own mode line, for such a ...
  • 81
3 votes
1 answer
196 views

how to show local file listings with C-x C-f through IVY when starting in a remote file buffer

System: Mac OSX catalina Emacs: 26.3 I use Ivy as my completion framework. Problem is when I am editing a remote buffer over ssh using Tramp, and then I want to look at a file on my local machine. ...
  • 345
1 vote
1 answer
137 views

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)? ...
  • 193