I'm investigating the relationship between bash and emacs shorcuts. Someone told me that the reason why they're similar is that bash uses emacs as its command line interpreter. However, I haven't found any evidence that supports this thesis.

I know there are "edits modes" in bash and one of them is emacs. But, is it true that the command line interpreter is implemented on emacs?

Please note I'm referring to the actual implementation and not to the similarities between them.

  • Apparently command line editing in bash is based on a "Readline library" as stated here – Rodrigo Mar 22 '16 at 17:54

The short answer is "no". bash's command-line processing is implemented mostly in bashline.c and its copy of readline, which supports vi-like and Emacs-like behaviours. Emacs itself is written mostly in Emacs Lisp; using it to implement bash would be quite involved since Emacs Lisp isn't designed to be used without Emacs.

  • so, I can say that the Readline library just mimics Emacs? – Rodrigo Mar 22 '16 at 18:02
  • @Rodrigo yes, that's correct. – Stephen Kitt Mar 22 '16 at 18:29
  • 1
    There's nothing wrong with using Lisp for implementing bash; however, using Emacs Lisp is a different story. Since it doesn't really live outside of the Emacs, you'd need Emacs to do it; that's why it isn't the good idea. – MatthewRock Mar 22 '16 at 18:32
  • @MatthewRock I'm not getting very well your point. what you mean by "it doesn't really live outside of the Emacs" – Rodrigo Mar 22 '16 at 18:51
  • @Rodrigo Emacs Lisp is designed as a language to build Emacs(and its extensions) with. Therefore, it's designed to work with Emacs. Actually, Emacs is kind of a VM which runs bytecode(.elc), so you can see why you'd need Emacs to run scripts. The second thing I was getting at was distinction between Lisp(as people often refer to Common Lisp, or a family of Lisp languages), and Emacs Lisp(which is a very specific language because of its strong bindings with the text editor). – MatthewRock Mar 23 '16 at 14:14

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.