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

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

0
votes
0answers
26 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
39 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-...
0
votes
1answer
36 views

Normalize string to make it file/path safe

Often I find my self doing this C-x C-f to create a file, while in the mini buffer prompt, paste a url like "https://github.com/seamusabshere/cache_method/issues/15" from the clipboard. Since "https:...
3
votes
1answer
72 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
65 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
12 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
33 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
54 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
50 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
49 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
51 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
105 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
108 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
49 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
190 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
86 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
22 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
160 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
124 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
92 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
143 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
769 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....
0
votes
1answer
65 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
65 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
188 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
20 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
101 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
612 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
1k 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
407 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
48 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
636 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
105 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
108 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
45 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
155 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
89 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
34 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
98 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
62 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-...
0
votes
0answers
294 views

How to fix Slow emacs access of host mounted drive on Windows 7 under VirtualBox?

I'm setting up a virtual Windows 7 machine on my Mac OSX El Capitan using VirtualBox. The windows 7 install seems to work well, however, when launching Emacs 24.1 it is extremely slow on all file ...
3
votes
2answers
225 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 ...
2
votes
1answer
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
486 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
102 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
600 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
359 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,...