threads / discuss / 7353

emacs and git...

Subject: emacs and git...

## tl;dr

17 messages between Mar 22, 2007 and Mar 24, 2007.

replies: 16people: 5as markdown or json

Francis Moreau· Mar 22, 2007, 14:53 UTC · lore
Hi,
I guess it's a dumb...

I know that some of you work within emacs. I tried to use git iniside a emacs shell (M-x shell) and had a weid behaviour:

$ git diff
WARNING: terminal is not fully functional
-  (press RETURN)
diff --git a/.lde/bin/cmd-version b/.lde/bin/cmd-version
index a6ce3f8..687112d 100755
--- a/.lde/bin/cmd-version
+++ b/.lde/bin/cmd-version
@@ -54,7 +54,7 @@ gdb_version () {
[snip]

I'm not using diff color option.

Can anybody shed some light ?

thanks
-- 
Francis
Matthieu Moy· Mar 22, 2007, 15:50 UTC · re: Francis Moreau · lore

Re: emacs and git...

"Francis Moreau" <francis.moro@gmail.com> writes:
Show 6 quoted lines
> Hi,
>
> I guess it's a dumb...
>
> I know that some of you work within emacs. I tried to use git iniside
> a emacs shell (M-x shell) and had a weid behaviour:

DVC has an embryo of a git mode (development not active at the moment).

  http://download.gna.org/dvc/
There's also a git.el which I didn't try yet.
-- 
Matthieu
Randal L. Schwartz· Mar 22, 2007, 15:57 UTC · re: Francis Moreau · lore

Re: emacs and git...

>>>>> "Francis" == Francis Moreau <francis.moro@gmail.com> writes:

Francis> Hi, Francis> I guess it's a dumb...

Francis> I know that some of you work within emacs. I tried to use git iniside Francis> a emacs shell (M-x shell) and had a weid behaviour:

Francis> $ git diff Francis> WARNING: terminal is not fully functional Francis> - (press RETURN) Francis> diff --git a/.lde/bin/cmd-version b/.lde/bin/cmd-version.[m Francis> index a6ce3f8..687112d 100755.[m Francis> --- a/.lde/bin/cmd-version.[m Francis> +++ b/.lde/bin/cmd-version.[m Francis> @@ -54,7 +54,7 @@ gdb_version () {.[m Francis> [snip]

Francis> I'm not using diff color option.
Francis> Can anybody shed some light ?

I use M-x shell on a regular basis, and have learned to add the following three items to my .emacs wherever I'm at:

  (setenv "PAGER" "/bin/cat")
  (setenv "EDITOR" "/opt/emacs/bin/emacsclient") ; `which emacsclient`
  (server-start)

Unless you do the first line, programs that like to push things through "less" or "more" do some pretty nasty things. And those last two are nice, because you can use "git-commit" directly in the shell window, and it'll pop up an emacs buffer. Read up on emacs-server mode or you won't know how to get out of it though. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Bernt Hansen· Mar 22, 2007, 17:19 UTC · re: Randal L. Schwartz · lore

Re: emacs and git...

I use M-x term instead of shell mode to interact with git. That works fine for me.

C-c C-j and C-c C-k switches between line and character mode so the
regular emacs control sequences are not sent directly to the term
session.
 
-Bernt
Francis Moreau· Mar 23, 2007, 07:26 UTC · re: Bernt Hansen · lore

Re: emacs and git...

On 3/22/07, Bernt Hansen <bernt@norang.ca> wrote:
> I use M-x term instead of shell mode to interact with git.  That works
> fine for me.
>
yes that works for me too but I'm wondering why it doesn't for shell mode...
thanks
-- 
Francis
Francis Moreau· Mar 23, 2007, 07:29 UTC · re: Randal L. Schwartz · lore

Re: emacs and git...

On 3/22/07, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
Show 10 quoted lines
>
> I use M-x shell on a regular basis, and have learned to add the following
> three items to my .emacs wherever I'm at:
>
>   (setenv "PAGER" "/bin/cat")
>   (setenv "EDITOR" "/opt/emacs/bin/emacsclient") ; `which emacsclient`
>   (server-start)
>
> Unless you do the first line, programs that like to push things through "less"
> or "more" do some pretty nasty things.

the funny thing is that the following command in emacs' shell actually do nothing.

$ PAGE=cat git diff HEAD^ $

Show 5 quoted lines
>  And those last two are nice, because
> you can use "git-commit" directly in the shell window, and it'll pop up an
> emacs buffer.  Read up on emacs-server mode or you won't know how to get out
> of it though. :)
>
yep I already do that.
-- 
Francis
Randal L. Schwartz· Mar 23, 2007, 07:30 UTC · re: Francis Moreau · lore

Re: emacs and git...

>>>>> "Francis" == Francis Moreau <francis.moro@gmail.com> writes:
Francis> $ PAGE=cat git diff HEAD^
PAGE?  or PAGER?
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Francis Moreau· Mar 23, 2007, 08:32 UTC · re: Randal L. Schwartz · lore

Re: emacs and git...

On 3/23/07, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
Show 6 quoted lines
> >>>>> "Francis" == Francis Moreau <francis.moro@gmail.com> writes:
>
> Francis> $ PAGE=cat git diff HEAD^
>
> PAGE?  or PAGER?
>
PAGER

But I actually know it doesn't print anything, because I put 'HEAD' instead of 'HEAD^', sorry for the wrong alert.

Can't git make 'cat' the default pager when run on a dumb terminal ?
thanks
-- 
Francis
Junio C Hamano· Mar 23, 2007, 09:07 UTC · re: Francis Moreau · lore

Re: emacs and git...

"Francis Moreau" <francis.moro@gmail.com> writes:
> Can't git make 'cat' the default pager when run on a dumb terminal ?
IIRC, `more` works on a dumb terminal.

But using PAGER=cat is a longstanding and widely used trick among Emacs old timers, predating the EDITOR=emacsclient, which is even nicer. I would highly recommend it. These two environment variables make running *everything* in compilation mode (or shell buffer) so much nicer than otherwise.

Francis Moreau· Mar 23, 2007, 09:54 UTC · re: Junio C Hamano · lore

Re: emacs and git...

On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
Show 6 quoted lines
> "Francis Moreau" <francis.moro@gmail.com> writes:
>
> > Can't git make 'cat' the default pager when run on a dumb terminal ?
>
> IIRC, `more` works on a dumb terminal.
>
yes it does although the behaviour is a bit weird. Not all screen is used.
Show 6 quoted lines
> But using PAGER=cat is a longstanding and widely used trick
> among Emacs old timers, predating the EDITOR=emacsclient, which
> is even nicer.  I would highly recommend it.  These two
> environment variables make running *everything* in compilation
> mode (or shell buffer) so much nicer than otherwise.
>

I think I'm going to give a try PAGER=more and EDITOR=emacsclient config with shell buffer and see if it can fit well my git usage.

I tried to use term mode but it's pretty annoying to switch between 'line' and 'char' mode all the time.

BTW Junio, just out of curiosity, do you use shell or term mode ?
-- 
Francis
Junio C Hamano· Mar 23, 2007, 10:10 UTC · re: Francis Moreau · lore

Re: emacs and git...

"Francis Moreau" <francis.moro@gmail.com> writes:
> BTW Junio, just out of curiosity, do you use shell or term mode ?

Neither. Almost all of my external command session inside Emacs is done in compilation mode. I even bind "C-x c" to "compile".

Francis Moreau· Mar 23, 2007, 17:29 UTC · re: Junio C Hamano · lore

Re: emacs and git...

On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
Show 7 quoted lines
> "Francis Moreau" <francis.moro@gmail.com> writes:
>
> > BTW Junio, just out of curiosity, do you use shell or term mode ?
>
> Neither.  Almost all of my external command session inside Emacs
> is done in compilation mode.  I even bind "C-x c" to "compile".
>
hm do you also run all git commands in this mode ??
-- 
Francis
Junio C Hamano· Mar 24, 2007, 09:55 UTC · re: Francis Moreau · lore

Re: emacs and git...

"Francis Moreau" <francis.moro@gmail.com> writes:
Show 10 quoted lines
> On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
>> "Francis Moreau" <francis.moro@gmail.com> writes:
>>
>> > BTW Junio, just out of curiosity, do you use shell or term mode ?
>>
>> Neither.  Almost all of my external command session inside Emacs
>> is done in compilation mode.  I even bind "C-x c" to "compile".
>>
>
> hm do you also run all git commands in this mode ??

Which ones do you specifically have in mind to have trouble with?

Francis Moreau· Mar 24, 2007, 15:10 UTC · re: Junio C Hamano · lore

Re: emacs and git...

On 3/24/07, Junio C Hamano <junkio@cox.net> wrote:
Show 6 quoted lines
> "Francis Moreau" <francis.moro@gmail.com> writes:
> > hm do you also run all git commands in this mode ??
>
> Which ones do you specifically have in mind to have trouble
> with?
>

well none in peculiar (since I now use PAGER=more), I'm just suprised you're using compilation mode for all your commands.

thanks
-- 
Francis
Francis Moreau· Mar 23, 2007, 09:56 UTC · re: Junio C Hamano · lore

Re: emacs and git...

On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
Show 6 quoted lines
> "Francis Moreau" <francis.moro@gmail.com> writes:
>
> > Can't git make 'cat' the default pager when run on a dumb terminal ?
>
> IIRC, `more` works on a dumb terminal.
>
BTW why not making 'more' the default on a dumb term instead of 'less' ?
-- 
Francis
Junio C Hamano· Mar 24, 2007, 09:56 UTC · re: Francis Moreau · lore

Re: emacs and git...

"Francis Moreau" <francis.moro@gmail.com> writes:
Show 8 quoted lines
> On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
>> "Francis Moreau" <francis.moro@gmail.com> writes:
>>
>> > Can't git make 'cat' the default pager when run on a dumb terminal ?
>>
>> IIRC, `more` works on a dumb terminal.
>
> BTW why not making 'more' the default on a dumb term instead of 'less' ?
Isn't that so 80'ish?
Francis Moreau· Mar 24, 2007, 15:12 UTC · re: Junio C Hamano · lore

Re: emacs and git...

On 3/24/07, Junio C Hamano <junkio@cox.net> wrote:
Show 14 quoted lines
> "Francis Moreau" <francis.moro@gmail.com> writes:
>
> > On 3/23/07, Junio C Hamano <junkio@cox.net> wrote:
> >> "Francis Moreau" <francis.moro@gmail.com> writes:
> >>
> >> > Can't git make 'cat' the default pager when run on a dumb terminal ?
> >>
> >> IIRC, `more` works on a dumb terminal.
> >
> > BTW why not making 'more' the default on a dumb term instead of 'less' ?
>
> Isn't that so 80'ish?
>
>

It simply avoids this kind of output when running `git-diff` from shell mode for example:

+
+Basic bisect commands: start, bad, good
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The way you use it is:
 
 ------------------------------------------------
 $ git bisect start
-$ git bisect bad                       # Current version is bad
-$ git bisect good v2.6.13-rc2          # v2.6.13-rc2 was the last version
-                                       # tested that was good
+$ git bisect bad                 # Current version is bad
+$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 was the last version
+                                 # tested that was good
 ------------------------------------------------
 
-When you give at least one bad and one good versions, it will
-bisect the revision tree and say something like:
+When you give at least one bad and one good versions, it will bisect
+the revision tree and say something like:
 
-- 
Francis

← back to recent threads