Eshell Prompts

Just a quickie today. Bytedude wanted to customize his Eshell prompt to add the date/time. With most shells, that’s simply a matter of changing an environment variable but with Eshell it’s a little more complicated.

It turns out the Eshell forms the prompt by calling a function and if you want to change the prompt you have to provide a new function. That’s easy because the function is pointed to by a variable so you need only change the variable to point at your own function. The function itself need merely form the desired string for the prompt.

A slight complication is that Eshell needs to be able to recognize prompts. It does that with a regex so if you change the prompt, you may need to change the regex. Take a look at Bytedude’s post for the details. The Emacs Wiki also has documentation on setting Eshell prompts that is worth taking a look at if you’re interested in customizing your Eshell prompt.

This entry was posted in General and tagged . Bookmark the permalink.