Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-log in eshell

Tags:

git

emacs

eshell

I'm trying to run git commands in eshell. When I run:

git log -p

it will look like this:

git-log in eshell

Notice that ^[[k before the cursor. Arrow key down does not work, it will gives error says 'Not found'. You can see that at minibuffer. The only way to scroll down is to use RETURN key, and it looks quite messy:

git-log in eshell -- scrolling

My $TERM is set to eterm, and I tried ansi too. They are the same. Anyone has experienced this before?

Thanks

Edit:

I have a way to work this around. I created this function:

(defun eshell/git (&rest args)
     (apply 'eshell-exec-visual (cons "git" args)))

So every time when I run git command, it will launch the output in a *git* buffer.

If you have other ways, please let me know as well.

like image 478
sudo Avatar asked Apr 20 '11 04:04

sudo


3 Answers

You must have colors turned on in git and that specific pseudo-terminal doesn't work in color. Try using m-x ansi-term. It supports colors and is generally more terminal-like.

Or you can try this hook:

 (add-hook 'eshell-preoutput-filter-functions
           'ansi-color-filter-apply)

Referenced from here.

like image 83
Mauvis Ledford Avatar answered Oct 02 '22 17:10

Mauvis Ledford


You can scroll only with RETURN because pager is used. You can either disable it permanently by changing git's core.pager config option, or you can disable it temporary by setting GIT_PAGER environment variable to empty string. Another possible source of problem - ^[ secuences, that are used to switch colors. You can disable them with --no-color option for git log command

like image 29
Alex Ott Avatar answered Oct 02 '22 16:10

Alex Ott


Have you tried using Magit? It integrates git into your normal Emacs workflow. I can't tell you much about it because I've only just started using Emacs, and I'm still trying to learn the basics. Magit seems really nice though. Install magit, open a file in your repo, and run M-x magit-log-long, that will create a buffer with the output of git log with an ascii history graph. I'm fairly sure that you can also checkout old commits from that buffer, but you should read the manual to be sure.

like image 28
Eric Seidel Avatar answered Oct 02 '22 18:10

Eric Seidel