Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to suppress the current working directory from the prompt for the eshell like i do on the commandline because it takes up a lot of screen space. Using C-h v i check that the default value is:

Value:
(lambda nil
  (concat
   (eshell/pwd)
   (if
       (=
        (user-uid)
        0)
       " # " " $ ")))

and I tried changing it to this in my .emacs:

(setq eshell-prompt-function
      (lambda () "> "))

but when I do the above, certain keys break. For example, I can no longer use M-p to browse the previous commands, and C-c C-a will not set point to the beginning of the command im typing like it does with the default prompt. I am wondering why this is happening and if there is a way around it?

Thanks

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

eshell-bol uses the eshell-skip-prompt function to bypass the prompt. Since you've changed the prompt to end with a > instead of $, you need to change the value of eshell-prompt-regexp. Changing it to ^> should allow it to work.

eshell-prompt-regexp is a variable defined in `em-prompt.el'.
Its value is "^[^#$
]* [#$] "

Documentation:
A regexp which fully matches your eshell prompt.
This setting is important, since it affects how eshell will interpret
the lines that are passed to it.
If this variable is changed, all Eshell buffers must be exited and
re-entered for it to take effect.

You can customize this variable.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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