A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [find-file]

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

Filter by
Sorted by
Tagged with
4
votes
3answers
462 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
313 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
36 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
215 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
253 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?...
1
vote
1answer
2k 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
70 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
165 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
121 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
349 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
27 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
171 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
2k 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
3k 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
801 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
55 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
1k 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
202 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-...
2
votes
1answer
198 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
48 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 ...
1
vote
3answers
309 views

Fuzzy search for directory when you don't know the full directory name

Say I want to find a directory like: foo/bar/bazz/bar/directory_name_looking_for/stuff.xml And I don't know the intermediate directory paths, or the full directory name, but remember that the ...
2
votes
0answers
127 views

find-alternate-file and move point

When using find-alternate-file, to refresh the file in the current buffer, point is always moved back to the start of the file. How can I get point to be moved to where I was in the file before ...
1
vote
1answer
37 views

CSharp files modified on open

When I open files that default to csharp-mode, they always start modified. This is only occurring for csharp-mode. save-buffers-kill-emacs with the d option (view changes in this buffer) shows ...
2
votes
2answers
122 views

Looking for an existing function for find-file-not-found-functions to do form style creation

I have the habit when creating larger projects to make files called skeleton.typ with all the standard boilerplate for a file of that type (e.g. copyright notices, licenses, the standard html/head/...
1
vote
1answer
112 views

How to create a file from a template if it does not exist or open existing copy?

Trying to make a function that I can call to create a file from a template or open an existing file. Current attempt is as follows: (defun journal-entry () (interactive) (let ((daily-name (format-...
4
votes
2answers
630 views

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 ...
3
votes
2answers
2k views

Setting default-directory does not change find-file directory

I try to set a default path for opening a file via C-x C-f by adding the following to my .emacs: (setq default-directory "~/some_dir/") However, after I launch Emacs in some directory, the find-file ...
4
votes
3answers
695 views

Quickly open file by full path in clipboard

There is something that blocks my workflow quite often and I'm quite sure it's easy to solve. I sometimes copy file paths (e.g. /tmp/bar/foo.gz) from the command line into my host systems clipboard. ...
1
vote
2answers
140 views

How to write a custom find-file function

I want to write a set of functions that call specific files, not by a specific name, but the newest file (with a certain suffix) in the directory. So far I've got (defun org_lisp_dir () (...
2
votes
3answers
1k views

Is there a way to make emacs fully complete a filename and cycle through the completions by hitting tab?

In Windows (the command prompt) when you hit TAB to complete a file name, you get a full file name, and can cycle through the completions by hitting TAB. Is there any ready way to get emacs to do ...
2
votes
0answers
414 views

Quickly navigate path with evil-mode's ex commands?

I am new to Emacs. I like how I can easily navigate to a file via helm-mode-find-file in helm. Is there any way to combine any variant of this (helm or otherwise) with evil's ex commands (eg, :e, :sp,...
2
votes
2answers
177 views

find-file-hook but only if file is selected

This is pretty simple, I'm trying to find (or build) a hook that fires when files are visited and selected (i.e. immediately displayed). Background I'm writing a UI centric entry for find-file-hook, ...
0
votes
0answers
67 views

Why do I get a different file content when I'm opening it with different Emacs versions on Windows7

I'm opening the very same file with Emacs-24.5 and with Emacs-23.1. But the latter shows me what seems to be an older version of this file! Might this be a bug of in Emacs-23.1? I updated the ...
4
votes
3answers
334 views

Switch buffer to the file path in current cursor position

My .emacs file contains multiple file names as, (load "~/.emacs.d/others/keymaps.el") (load "~/.emacs.d/others/py.el") (load "~/.emacs.d/others/web.el") Is there a way any library, gives way for me ...
0
votes
0answers
65 views

ECB Never ask to make buffer read-only

In my current Emacs configuration, when ECB is active and I find-file in a non-existing directory, I keep getting interrupted to answer the following question in the echo-area: File /tmp/new-foo/bar....
1
vote
0answers
28 views

find-file opens file but buries its buffer when ECB is activated

I have a hook in my .emacs file that activates ECB when prog-mode entered: (add-hook 'prog-mode-hook 'ecb-activate) When I open the first file that starts a prog-mode, it seems to cause find-file* ...
3
votes
3answers
438 views

How to create a keybinding to a file in Emacs?

I have a frequently opened file in Emacs, which is deep inside my device. I want to bind the F5 key(or any other key) to open that file, how can I do that? (Using android to run emacs. [GNURoot, ...
2
votes
1answer
588 views

Can I stop Emacs from resetting default-directory every time I open a file?

If I: Start Emacs in my home directory (~) Find a file in the ~/Projects/ruby-play directory with C-x C-f Try to find another file with C-x C-f The default directory in the file finder will be ~/...
3
votes
2answers
563 views

Exclude dot-files from the find-file Completion List

When I run the find-file command and hit the tab key twice without giving anything, I get the Completion List of my, for instance, home directory. By default it lists everything inside, including the ...
4
votes
1answer
560 views

How to set the coding system for new files with specific extensions

When I visit a new file, ^xf, that has an extension of .sql or .dsql I would like the coding system to be set to utf-8-with-signature-dos. The default is currently iso-latin-1-dos. I'm running (...
1
vote
1answer
438 views

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

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

Running out of L:/ etters: shortcut for path needed

I'm working with files which are stored on a server. The structure on the server is: //SBS/share/path/to/somewhere/2007/ //SBS/share/path/to/somewhere/2008/ //SBS/share/path/to/somewhere/2009/ ... //...
4
votes
1answer
2k views

transparently find file over ssh in *shell* directory

I ssh'd into a remote server from shell and tried to open a file on a directory path that also exists on my local system. The list of files I was able to open using helm-find-files was the list on my ...
5
votes
3answers
717 views

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 this: org/dev org/dev/python.org org/dev/emacs.org ... org/dev/ios org/dev/ios/...
2
votes
1answer
128 views

Reloading files from disk in frame with emacsclient

This may be user error, but if I open a file with emacsclient -c file.tex then if I try to reload the file using C-x C-v, then I get the usual Find alternate file: but if I press enter on that, I ...
3
votes
1answer
229 views

Tell Dired to ignore file-at-point when invoking `ido-find-file` (`C-x C-f` in Ido mode)

I have discovered that a recent update to some of my emacs packages have caused C-x C-f while on a dired file to perform some operation on the entire file before prompting me for other files/...
1
vote
1answer
271 views

docview: suppress “File X is too large, really open?” confirmation

Is it possible to avoid the "File X is too large, really open?" confirmation? If not, would it be possible for Emacs to remember my answer the first time I visited a large file? If I visited it once,...
3
votes
1answer
816 views

auto-insert a skeleton and run a function when creating a new file

auto-insert-alist by default matches files created in .../bin/ directories and enables sh-mode. There are examples on the wiki showing how to use a skeleton to insert some text, but I want to both ...
3
votes
1answer
235 views

`find-file-hook` problem for large buffer that is just one long line

I got a file(for instance, ~/.mozilla/firefox/xxx.default/sessionstore-backups/recovery.bak) that its content is one whole line and size of over 1MB, if I open it in Emacs, Emacs will become very ...