Basically I try to enable showing git branch I'm in in eshell buffer. The elisp I got works fine. But I will constantly run into "Text is read only " and have to kill the eshell buffer to start over.
;; eshell promopt (defun my-current-git-branch () (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n") when (string-match "^\*" match) collect match)))) (if (not (eq branch nil)) (concat ":" (substring branch 2)) ""))) (defun my-eshell-prompt () (concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt) (propertize (my-current-git-branch) 'face 'font-lock-function-name-face) (propertize " λ " 'face 'font-lock-constant-face))) ;; em-prompt (setq eshell-prompt-function 'my-eshell-prompt)
I am using Arch Linux and Emacs25. Does anyone have any idea to solve or a better approach?