I'm wondering if anyone knows of a clever way in Emacs when in a shell, can I directly open a file without having to open it in another Emacs instance.
-
2how about using **C-x C-f** and type the path to file? – Hariharan Jul 07 '16 at 11:30
-
When you say "buffer," do you mean "window"? See [What's the difference between a buffer, a file, a window, and a frame?](http://emacs.stackexchange.com/questions/13583/whats-the-difference-between-a-buffer-a-file-a-window-and-a-frame) – Dan Jul 07 '16 at 14:03
4 Answers
I'm assuming you mean in the same window, not buffer.
From eshell its simple. You can run emacs lisp functions by simply typing them into eshell. This means you can type
find-file file.txt
to open file.txt. You could also make a nicer alias to this so you could do something like type "emacs file.txt" to do the same thing. The emacs wiki page on eshell aliases has several examples of this.

- 136
- 1
check out dired-jump
. It uses the current shell directory.

- 1,699
- 1
- 11
- 23
-
It would help to point out that `dired-jump` is in the `dired-x` library, which is not loaded by default. – phils Jul 08 '16 at 15:52
-
My bad. Take a look at http://emacsredux.com/blog/2013/09/24/dired-jump/ – bertfred Jul 08 '16 at 16:13
-
Please edit your answer to provide info about `dired-jump`: what it does, how to obtain it, etc. Otherwise this risks being deleted as lacking content and being essentially a link-only answer. – Drew Jul 08 '16 at 17:04
You can use with-editor in order to do that but you have to be running emacs as a daemon.
I don't know a solution to do that without using emacs as a daemon, if you ever find out I really am interested as I haven't yet investigated further.

- 203
- 1
- 7
I'm not sure if this is exactly what you're asking, but I have an eshell alias to open up files the same way I would in a terminal
alias emacs find-file $1
Then from eshell, if I want to open up a file I just need to type emacs $FILENAME
and it will open the file in a new buffer.

- 209
- 4
- 6