1

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.

2

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.

https://www.emacswiki.org/emacs/EshellAlias

1

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

  • It would help to point out that dired-jump is in the dired-x library, which is not loaded by default. – phils Jul 8 '16 at 15:52
  • My bad. Take a look at emacsredux.com/blog/2013/09/24/dired-jump – bertfred Jul 8 '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 8 '16 at 17:04
0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.