Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [find-file]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 views

How to have 'emacs' behave like 'find-file' within vterm?

I know that such a thing is possible within eshell; however, I am now using vterm, and I'd like for when I type emacs for it to be as if I typed find-file. For example, for eshell, you could do alias ...
user129393192's user avatar
1 vote
1 answer
32 views

Run functions/hooks automatically when a specific FILE is opened

I'd like to run a function/set of functions when I open a specific file. Just like file type hooks, but for a specific file. For instance, when I open foo.bar, I'd like some functions to run. Maybe ...
Peter Petigru's user avatar
0 votes
1 answer
51 views

Opening file in emacs using a shortcut

So, I was wondering if I can somehow(with a keyboard shortcut) open a file using the default system dialog, the same way that the big open button does at the top of the window. I didn't find a way to ...
Stigl's user avatar
  • 3
0 votes
1 answer
72 views

Faster way to go from directory bookmark to file heading?

I currently have a dired bookmark set to a directory. So in order to access a particular heading, the sequence is as follows: Bookmarks keybind, type initial letters of directory bookmark. (Dired ...
shintuku's user avatar
  • 121
0 votes
2 answers
78 views

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 result: ./test.txt ./project_1_1/test.json ./...
a_subscriber's user avatar
  • 4,124
0 votes
1 answer
23 views

Weird `(point-max)` in testing function in `magic-mode-alist`

Why does the below function always print 4001 when opening a large file? (require 'cl-lib) (defun custom-test-p () (with-current-buffer (current-buffer) (print (point-max))) ; 4001 nil) (cl-...
Saddle Point's user avatar
1 vote
1 answer
29 views

With icicle-locate-file, how can I find all *.txt files in the directory?

I need to find all *.txt files in the directory, like find ./ -iname "*txt" I wanted an Emacs solution, so I found the multi-command icicle-locate-file-other-window. Its documentation tells ...
Jason Hunter's user avatar
0 votes
0 answers
25 views

How can I find out that an Org Agenda file had been opened with 'inhibited startup'?

My Emacs is opening the Agenda file in the background with org-agenda-inhibit-startup locally bound to t. When I switch to such a file, all trees are therefore displayed open (no folding). I would ...
Public Image Ltd.'s user avatar
0 votes
0 answers
94 views

"touch file" in dired mode

I found this answer: (eval-after-load 'dired '(progn (define-key dired-mode-map (kbd "c") 'my-dired-create-file) (defun create-new-file (file-list) (defun exsitp-untitled-...
user129393192's user avatar
0 votes
2 answers
212 views

How preview find file without close minibuffer

Emacs 27.1 packages: consult embark I want to find test.txt file in folder temp. I do this. Now I want to preview selected file without close minibuffer. In embark I'm not operation for this. How I ...
a_subscriber's user avatar
  • 4,124
0 votes
2 answers
152 views

How can I bind vertico-insert to toggle in the list?

I am using find-file with vertico. After running find-file and typing filename and when I press <TAB> it selects the current line. TAB runs the command vertico-insert (found in vertico-map), ...
alper's user avatar
  • 1,390
1 vote
1 answer
44 views

Write a function that prompts for a file from within a list

As a starting point, this: (defvar myfoo "~/org/test-file-1.org" "myfoo") ; C-x C-e (defun mybar() (newline-and-indent) (insert-file-contents myfoo)) ; C-x C-e (mybar) ; C-x C-e ...
user avatar
0 votes
0 answers
25 views

How to fallback to $HOME if Tramp failed to connect to default-directory

If I call find-file from a buffer with default-directory pointing to a remote server via TRAMP and the remote server is not reachable, then TRAMP complains: tramp-signal-hook-function: Tramp failed ...
Thomas Koch's user avatar
1 vote
1 answer
49 views

How can I make a window always show the same file buffer?

How can I force Emacs to keep a certain file in a particular window? For example, if I am editing a LaTeX file and there is a compile error, I want to inspect the error in another window. I ...
user5728491's user avatar
1 vote
0 answers
29 views

Configure Emacs to Respect Windows File Attributes?

Is it possible to configure Emacs under Windows to respect the 'hidden' and 'system' NTFS file attributes for example by filtering out these files during selection of filename completion candidates in ...
StackExchanger's user avatar
0 votes
1 answer
60 views

Disable environment variable substitution with $ in find-file

When using find-file, list-directory and other commands, if one types a $ a minibuffer completion appears with a list of currently set environment variables. I have no idea where this is coded, the ...
Ojd2000's user avatar
1 vote
1 answer
133 views

ff-find-other-file

works well, particularly after custom defining additional file type pairs with (defvar my-cpp-other-file-alist '(("\\.cpp\\'" (".hpp" ".cuh")) ...
CD86's user avatar
  • 563
0 votes
0 answers
79 views

How to automatically convert between remote and local file names?

I have /local/laptop/dir mounted in my Docker container at /container/path. In Emacs tramp terms, it is /docker:container-id:/container/path. This also comes up when the user ssh to a remote system ...
pedz's user avatar
  • 375
2 votes
0 answers
74 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 ...
Troy Daniels's user avatar
1 vote
1 answer
1k 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 ...
Johannes Nauta's user avatar
3 votes
1 answer
509 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). ...
Massimo2013's user avatar
1 vote
1 answer
32 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 ...
MassimoLauria's user avatar
0 votes
1 answer
65 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 ...
Name's user avatar
  • 7,871
0 votes
0 answers
170 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. ...
Joseph Garvin's user avatar
1 vote
2 answers
112 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 ...
Pedro Delfino's user avatar
0 votes
2 answers
68 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 ...
Daniel's user avatar
  • 3,653
0 votes
1 answer
146 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 ...
phoxd's user avatar
  • 231
0 votes
1 answer
48 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 ...
alper's user avatar
  • 1,390
2 votes
2 answers
203 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 ...
thinksinbinary's user avatar
0 votes
0 answers
36 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: ....
andreoss's user avatar
0 votes
2 answers
532 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.
EasterEgg's user avatar
0 votes
0 answers
211 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 ...
ivan golotin's user avatar
0 votes
1 answer
235 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 ...
EasterEgg's user avatar
1 vote
1 answer
228 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 ...
buhtz's user avatar
  • 729
1 vote
1 answer
2k 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 ...
Kim Stacks's user avatar
1 vote
2 answers
348 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 ...
Spacemoose's user avatar
0 votes
0 answers
516 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 ...
rileymat's user avatar
  • 101
0 votes
0 answers
263 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 ...
Éamonn Olive's user avatar
0 votes
1 answer
102 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 ...
nate's user avatar
  • 63
2 votes
1 answer
185 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 ...
Keks Dose's user avatar
  • 508
0 votes
1 answer
444 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 ...
Edman's user avatar
  • 1,229
2 votes
1 answer
1k 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....
oleg harput's user avatar
1 vote
2 answers
118 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 ...
SparedWhisle's user avatar
1 vote
0 answers
163 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 ...
Tianxiang Xiong's user avatar
1 vote
2 answers
228 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 ...
Glory to Russia's user avatar
2 votes
1 answer
87 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 ...
Dan Lenski's user avatar
0 votes
1 answer
2k 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 ...
buhtz's user avatar
  • 729
2 votes
2 answers
144 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 ...
toomas's user avatar
  • 183
0 votes
0 answers
601 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 ...
Rusi's user avatar
  • 333
1 vote
1 answer
112 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"...
Steve's user avatar
  • 11