Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [find-file]

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

1
vote
1answer
13 views

Don't offer non-file-name as a file name in find-file

When opening a file with find-file, the default entry in the minibuffer is the current directory. If I press Down, I see the name of the current file (if the current buffer is visiting a file). ...
2
votes
1answer
58 views

Function to open all Org files in a folder recursively

I am looking for a way to open all Org (or Fountain) files in a folder using one function. Essentially, I am seeking to open all available files of a certain type (.org or .fountain) within a folder ...
0
votes
1answer
28 views

Wrong default-directory when inside a tmux session

I'm trying to use tmux inside emacs for a long time. I want to use it to attach to remote (long living) session. Attaching to sessions works fine but I have some problems in my daily workflow because ...
1
vote
1answer
23 views

How to avoid a dialog box for input (e.g. “Open File” behavior)?

I generally like to use the emacs-gtk3 package for my editing since I find it has better compatibility with my clipboard and a couple packages I use..but I don't like opening files in the GUI version ...
2
votes
1answer
54 views

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 ...
1
vote
0answers
77 views

Emacs 26-1 Problems : find-file and neotree

The Problems: I just did a full re-install to Fedora 29, which included the dnf install emacs command. This installed emacs 26-1; formerly I was using emacs 25.2. Formerly, my emacs initialization ...
1
vote
1answer
48 views

Wrong type argument: stringp, (“~/capture.org”)

I am setting up a few hydras, one of which should open a frequently accessed file. The following command works, if I bind a keyboard sequence to it: (lambda () (interactive) (find-file "~/capture.org"...
1
vote
2answers
71 views

Disable ivy for find-file

Is it possible to disable ivy-mode for file prompts? In a past I used find-file to copy current file name or path to file. dired-do-rename also is broken by Ivy: no default completion for current ...
0
votes
1answer
19 views

Including standard boiler-plate on opening a new latex file [duplicate]

Most of my \LaTeX files have the same boiler plate code, so I would like Emacs to automatically insert this boiler-plate whenever I open a fresh, blank \LaTeX file. In particular, I would like to ...
0
votes
1answer
35 views

Command to invoke menu-bar's open-file?

The traditional way of opening a file is via C-x C-f (find-file). I don't know since when this has been the case, but in Emacs 27.0.50 (Linux), using the menu bar's File -> Open File invokes the GTK ...
1
vote
2answers
67 views

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 ...
2
votes
4answers
77 views

How to find a directory with given depth from current directory?

Is it possible from within Emacs to find directories with a given depth from the current directory from within Emacs and receive their respective location in form of a list? I want it to work cross ...
0
votes
0answers
50 views

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

How to edit and return value of string in Emacs Lisp?

Here is what I wish to achieve: (defun rcd-edit-value (value) (let ((file (make-temp-file "rcd-db-" nil ".txt" value))) (find-file file) (string-from-file))) (defun string-from-...
3
votes
2answers
149 views

Set a global default directory

I want a "default directory" which is constant across all contexts (buffers, packages, etc). That is, when working on multiple files, opening a new terminal, doing anything which requires a starting ...
3
votes
4answers
102 views

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

Icicle: After load icicles the ido mode is gone?

windows 10, emacs 26.1, icicles Before Icicles when I type C-x C-f is show list of folders/files in ido mode. And it's very comfortable for me. But after I install Icicles and turn on icy-mode the ...
1
vote
0answers
23 views

Find dirrectories paths from a list of names via tramp session

I have a remote host accessing via tramp there is a list of directori names I'd like to find on that host. What I do now - connect to remote server and while read -r name; do find / -type d -name "$...
2
votes
1answer
35 views

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 "/...
3
votes
2answers
61 views

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), ...
1
vote
1answer
51 views

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 ...
0
votes
0answers
50 views

Lock working directory

Normally, when working with Emacs on a project, I cd to ~/my/project (or a similar path) and expect to do all my find-file actions relative to this directory. It's my "root" of sorts. However, if I ...
0
votes
1answer
61 views

Omit current and parent directories in Ivy find-file completion

I'm using Ivy in a fairly standard Spacemacs setup. When I'm opening a file I'd like . and .. to be omitted from the list of completion candidates. In particular, I'd like to be able to tab through ...
0
votes
1answer
64 views

auto-insert mode switch to new file

I managed to insert a template to certain sripts with autocomplete. Example: (auto-insert-mode) (setq auto-insert-query nil) (setq auto-insert-alist '(((ess-mode . "R script") nil "# R ...
0
votes
1answer
148 views

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

Combine find file at point and find file in project

I'm very new to customizing Emacs, and haven't written Elisp commands before. I'm struggling to find a command and key binding that combines find-file-at-point and find-file-in-project (or similar), ...
1
vote
2answers
53 views

How to get a string under quotes surrounding the cursor in elisp?

I am trying to write a function that opens a file under the cursor. I need to get the string between quotes that is surrounding the cursor in my elisp function so that I can use that string to call ...
1
vote
5answers
259 views

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 ...
0
votes
0answers
88 views

can I have swiper and counsel as “add-ons” and not the default binding

I like the powers that counsel/ivy/swiper gives me, specially for C-s and C-x C-f, but since installing it, I've started missing the vanilla emacs C-s and C-x C-f. It would be awesome if I can "call" ...
0
votes
1answer
24 views

Can I “find-file //hostname/dirname/filename”

GNU Emacs 24.5.1 (i686-pc-mingw32); local host is MS Windows 7; remote machines are all running variants of MS Windows. I would swear I've used this syntax (most recently less than a month ago) but ...
3
votes
3answers
192 views

Display path and filename in a minibuffer

Eval this code: (defun xx-display-filename (filename) "" (interactive "Ffilename: ") (message (concat "Filename is: " filename))) Let's assume that I am editing a ~/.emacs.d/personal/custom.el ...
0
votes
1answer
171 views

default directory is not working in Windows [duplicate]

I am trying to set the default directory to D:/ by (setq default-directory "D:/") but when I type c-x c-f, it is showing D:\software\emacs\bin, which is the installation directory.
0
votes
1answer
30 views

How to stop Emacs from interpreting a file name with `@` as an email address

If I try to open a file whose filename is ~/A/b/C@d.yaml, Emacs will interpret that I want to send an email to the address C@d.yaml, and in the minibuffer I have mailto:C@d.yaml. What could I do so ...
1
vote
1answer
116 views

Troubleshooting: changing default folder in .emacs not working

I am trying to make emacs start on the folder where all my orgfiles are saved. I achieved this in my windows machine by changing the "Start In" field of the shortcut properties, as suggested in this ...
0
votes
2answers
161 views

How to show completions in minibuffer instead

Is there a simple way to make it so that the *Completions* buffer that pops up when, say, tab completing on a find-file doesn't create a new buffer but shows the possible completions in the minibuffer?...
0
votes
1answer
914 views

C-x C-f results in the error message: “Wrong type argument: commandp, counsel-find-file”

I opened Emacs, and executed C-x C-f. A beep sounded and the following message appeared in the status line: Wrong type argument: commandp, counsel-find-file All I wanted was to open an existing file....
2
votes
2answers
38 views

Aliases on minibuffer for quick switching of directories

I would like to know if there is an easy way for me to jump to specific folders when specifying paths in the minibuffer. For example, when I do find-file and my current directory is in ~ and I want ...
0
votes
1answer
76 views

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 {} ";...
0
votes
1answer
69 views

Close found file but not emacs?

I'm using emacs in terminal mode. I open it up and then use c-x c-f to edit a file. I'm using evil mode so I then use :x to save and exit. I end up leaving emacs all together. Is there something else ...
2
votes
2answers
217 views

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)?
2
votes
0answers
22 views

How can helm-find-files be adapted to include previously open files, projects etc?

After doing some more search concerning Does the recent files in emacs display files opened in previous sessions? I realize that C-x C-f is bound in my config to helm-find-files. How can helm-find-...
3
votes
2answers
114 views

Problem with save-current-buffer and find-file

I have a list of files that I want to successively visit with find-file and then return to the first buffer. I thought that save-current-buffer would help me to achieve this. However, with the ...
2
votes
3answers
816 views

How to find file name a few levels down in directory?

I am new to emacs (using Spacemacs with Evil and Ivy). This is how I open a file: SPC f f (counsel-find-file) Find file: I entered path of file. Ivy matches words one directory at a time. But ...
3
votes
3answers
2k views

Regex for any file not ends with

How to write a function for finding all files in a directory which not ending with pyc and pyo? I've tried something like (find-lisp-find-files root "^(?!.*pyc$).*$") but it does not return any ...
1
vote
1answer
477 views

emacsclient --eval command to bring a background emacs window to front

Suppose I already opened a emacs but its in the background. So, is there an emacsclient eval option that I can type in the shell like: emacsclient --eval "(bring-existing-emacs-window-to-front)" To ...
0
votes
1answer
50 views

Interactive Function to Create a Buffer in a Default Folder with Autocompletion of the File Name with the Predefined Prefix

Could you please tell me how I can write a function which creates and visits a buffer in a particular directory (a default directory name is hard coded, but it would be nice to have an opportunity to ...
1
vote
1answer
712 views

Why does opening a file take so long in python mode?

Opening a small python file, with <10 buffers open, takes a long time. Here's a gist of the profile of trying to open this file (giving up with C-g after 2 minutes). Deactivating ido-mode tells ...
4
votes
1answer
113 views

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-...
3
votes
0answers
120 views

Remapping find-file to helm-find-files

I have Helm installed and added this line to the end of the init file: (define-key global-map [remap find-file] 'helm-find-files) So, when I restart Emacs and try C-x C-f it executes helm-find-files....
3
votes
1answer
46 views

Force ffap to ignore '<' and '>' in file names

I am using find-file-at-point and it stubbornly selects incorrect file name string in NXML mode: String where I have cursor on the file name: <include>my-file.ext</include> and when ...