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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

1
vote
1answer
31 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
48 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
36 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
39 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
0answers
34 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
81 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
89 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
46 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
132 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
82 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
20 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
125 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
91 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
29 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
71 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
125 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
600 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
50 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
63 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
153 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
19 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
92 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
461 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 ...
2
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
348 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
47 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
567 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
102 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
101 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
139 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
82 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
33 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
57 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
271 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
195 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
1k 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
463 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
98 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
524 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
353 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
132 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
64 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
261 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
57 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
27 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* ...
1
vote
1answer
471 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
1answer
284 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 ...