I'm writing my own shell which can handle most of the GNU/Linux system calls now. So I was wondering if I could make this shell call Elisp functions too. Is it possible to do so? Is so, how do I get started?

Basically, I want the shell to do what both Bash and Eshell can do.


1 Answer 1


I do this from M-x shell by defining functions that pass command line arguments to emacsclient. For example:

function ff() {
    emacsclient -e "(find-file \"$@\")"

function man() {
    emacsclient -e "(man \"$@\")"

This allows me to open a file from the Emacs shell command line with ff filename, or open a man page in Emacs' man mode with man command.

I haven't tried using this from a stand-alone terminal, but you could extend this by defining a command that would evaluate any elisp:

function el(){
    emacsclient -e "$@"

Depending on your use-case, you will probably want to define some helper functions in your Emacs configuration, to make it easier to accomplish whatever it is you normally do with elisp.

This assumes you run emacs in server/daemon mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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