git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Manual hunk edit mode + emacs + ^G == garbage
@ 2010-10-13 21:37 Kevin Ballard
  2010-10-13 21:48 ` Drew Northup
  2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 10+ messages in thread
From: Kevin Ballard @ 2010-10-13 21:37 UTC (permalink / raw)
  To: Git Mailing List

I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e) and emacs together. It seems every time I hit ^G inside of emacs in this one circumstance, the entire process instantly shuts down, both emacs and `git add`, and it doesn't even give emacs a chance to clean up the terminal, so I'm left with garbage across my display (the remains of the emacs window) and the terminal settings are screwed up enough that I have to close and reopen it (even `reset` doesn't fix everything). Has anybody else seen this, and if so, do you know what's going on? I cannot reproduce this with emacs outside of `git add -p`, and I cannot reproduce this with vim even inside of `git add -p`.

-Kevin Ballard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-13 21:37 Manual hunk edit mode + emacs + ^G == garbage Kevin Ballard
@ 2010-10-13 21:48 ` Drew Northup
  2010-10-13 21:53   ` Kevin Ballard
  2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
  1 sibling, 1 reply; 10+ messages in thread
From: Drew Northup @ 2010-10-13 21:48 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: Git Mailing List


On Wed, 2010-10-13 at 14:37 -0700, Kevin Ballard wrote:
> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e) and emacs together. It seems every time I hit ^G inside of emacs in this one circumstance, the entire process instantly shuts down, both emacs and `git add`, and it doesn't even give emacs a chance to clean up the terminal, so I'm left with garbage across my display (the remains of the emacs window) and the terminal settings are screwed up enough that I have to close and reopen it (even `reset` doesn't fix everything). Has anybody else seen this, and if so, do you know what's going on? I cannot reproduce this with emacs outside of `git add -p`, and I cannot reproduce this with vim even inside of `git add -p`.

Is there some way to get a dump of the environment that emacs is seeing?
If we have that it will be easier to tell if this is an emacs problem or
a git problem.
-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-13 21:48 ` Drew Northup
@ 2010-10-13 21:53   ` Kevin Ballard
  2010-10-13 22:40     ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Ballard @ 2010-10-13 21:53 UTC (permalink / raw)
  To: Drew Northup; +Cc: Git Mailing List

On Oct 13, 2010, at 2:48 PM, Drew Northup wrote:

> 
> On Wed, 2010-10-13 at 14:37 -0700, Kevin Ballard wrote:
>> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e) and emacs together. It seems every time I hit ^G inside of emacs in this one circumstance, the entire process instantly shuts down, both emacs and `git add`, and it doesn't even give emacs a chance to clean up the terminal, so I'm left with garbage across my display (the remains of the emacs window) and the terminal settings are screwed up enough that I have to close and reopen it (even `reset` doesn't fix everything). Has anybody else seen this, and if so, do you know what's going on? I cannot reproduce this with emacs outside of `git add -p`, and I cannot reproduce this with vim even inside of `git add -p`.
> 
> Is there some way to get a dump of the environment that emacs is seeing?
> If we have that it will be easier to tell if this is an emacs problem or
> a git problem.

I've been investigating this on the emacs side as well. At the moment, my suspicion is that ^G causes emacs to trigger (keyboard-quit), but at the same time the surrounding environment (e.g. git) is sending a SIGINT to emacs, which normally acts like ^G but in this case may be triggering the emergency exit mode of emacs. Is there some reason that the interactive add would be sending SIGINT to emacs when I type ^G?

-Kevin Ballard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-13 21:53   ` Kevin Ballard
@ 2010-10-13 22:40     ` Andreas Schwab
  2010-10-13 22:49       ` Kevin Ballard
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2010-10-13 22:40 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: Drew Northup, Git Mailing List

Kevin Ballard <kevin@sb.org> writes:

> I've been investigating this on the emacs side as well. At the moment, my suspicion is that ^G causes emacs to trigger (keyboard-quit), but at the same time the surrounding environment (e.g. git) is sending a SIGINT to emacs, which normally acts like ^G but in this case may be triggering the emergency exit mode of emacs. Is there some reason that the interactive add would be sending SIGINT to emacs when I type ^G?

If you are using text mode (-nw) then Emacs redefines the INTR character
of the terminal to ^G.  On the other hand it should also put itself into
its own process group, so the parent should not receive the terminal
signals.  And this is what happens here when I try it.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-13 22:40     ` Andreas Schwab
@ 2010-10-13 22:49       ` Kevin Ballard
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Ballard @ 2010-10-13 22:49 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Drew Northup, Git Mailing List

On Oct 13, 2010, at 3:40 PM, Andreas Schwab wrote:

> Kevin Ballard <kevin@sb.org> writes:
> 
>> I've been investigating this on the emacs side as well. At the moment, my suspicion is that ^G causes emacs to trigger (keyboard-quit), but at the same time the surrounding environment (e.g. git) is sending a SIGINT to emacs, which normally acts like ^G but in this case may be triggering the emergency exit mode of emacs. Is there some reason that the interactive add would be sending SIGINT to emacs when I type ^G?
> 
> If you are using text mode (-nw) then Emacs redefines the INTR character
> of the terminal to ^G.  On the other hand it should also put itself into
> its own process group, so the parent should not receive the terminal
> signals.  And this is what happens here when I try it.

I am indeed using text mode. And when I test, invoking `emacs` directly gives it its on process group, but invoking emacs from `git add -p`+e doesn't.

kevin@Brandybuck:~> ps -jp 34581 34540
USER    PID  PPID  PGID   SESS JOBC STAT   TT       TIME COMMAND
kevin 34540 34539 34538 7d29d68    1 S+   s001    0:00.08 /usr/bin/perl /usr/local/libexec/git-core/git-add--interactive --
kevin 34581 34540 34538 7d29d68    1 S+   s001    0:00.61 /usr/bin/emacs /Users/kevin/Dev/Work/Standard9/inkling-ipad/.git/

Any idea why this would be?

-Kevin Ballard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-13 21:37 Manual hunk edit mode + emacs + ^G == garbage Kevin Ballard
  2010-10-13 21:48 ` Drew Northup
@ 2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
  2010-10-14  9:47   ` Kevin Ballard
  2010-10-14  9:51   ` Miles Bader
  1 sibling, 2 replies; 10+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-10-14  9:37 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: Git Mailing List

On Wed, Oct 13, 2010 at 21:37, Kevin Ballard <kevin@sb.org> wrote:

> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e)

Aside from this bug you might want to check out magit.el, it's a much
nicer hunk edit more for Emacs than running git add -p in an Emacs
terminal is.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
@ 2010-10-14  9:47   ` Kevin Ballard
  2010-10-14  9:51   ` Miles Bader
  1 sibling, 0 replies; 10+ messages in thread
From: Kevin Ballard @ 2010-10-14  9:47 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

On Oct 14, 2010, at 2:37 AM, Ævar Arnfjörð Bjarmason wrote:

> On Wed, Oct 13, 2010 at 21:37, Kevin Ballard <kevin@sb.org> wrote:
> 
>> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e)
> 
> Aside from this bug you might want to check out magit.el, it's a much
> nicer hunk edit more for Emacs than running git add -p in an Emacs
> terminal is.

Except I don't run it in an emacs terminal. I run it in my regular terminal, and only launch emacs when I need to in order to edit a hunk or whatnot.

BTW, it also appears that this happens in the normal `git commit` editor as well, I just hadn't noticed before since I rarely need to type ^G when writing a commit message.

-Kevin Ballard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
  2010-10-14  9:47   ` Kevin Ballard
@ 2010-10-14  9:51   ` Miles Bader
  2010-10-15  9:13     ` Kevin Ballard
  1 sibling, 1 reply; 10+ messages in thread
From: Miles Bader @ 2010-10-14  9:51 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Kevin Ballard, Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e)
>
> Aside from this bug you might want to check out magit.el, it's a much
> nicer hunk edit more for Emacs than running git add -p in an Emacs
> terminal is.

Yup, for that particular problem, magit is, well, like magic :)

-miles

-- 
Pray, v. To ask that the laws of the universe be annulled in behalf of a
single petitioner confessedly unworthy.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-14  9:51   ` Miles Bader
@ 2010-10-15  9:13     ` Kevin Ballard
  2012-02-22 21:43       ` Matt McClure
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Ballard @ 2010-10-15  9:13 UTC (permalink / raw)
  To: Miles Bader; +Cc: Ævar Arnfjörð Bjarmason, Git Mailing List

On Oct 14, 2010, at 2:51 AM, Miles Bader wrote:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>> I've been having a rather strange problem using manual hunk edit mode (`git add -p`, e)
>> 
>> Aside from this bug you might want to check out magit.el, it's a much
>> nicer hunk edit more for Emacs than running git add -p in an Emacs
>> terminal is.
> 
> Yup, for that particular problem, magit is, well, like magic :)

I tested out magit, and didn't particularly like it. First off, it seems to be throwing an error when I invoke magit-status, at least if there's no changes. I don't know if this is related to the fact that my emacs is only 22.1, but magit itself doesn't document any required version of emacs. Secondly, when there is a change, the coloration is really hard to read, and the navigation is quite poor as well (and I didn't find anything to make it better in the cheatsheet). And it's far slower than just using `git add -p` and only dropping into emacs occasionally for manual hunk edits.

I'm still very much interested in finding a solution to why ^G kills emacs when it's invoked by git. As I said earlier, it appears that emacs shares the same process group with the perl process that called it, even though Andreas Schwab says it puts itself into its own process group and invoking emacs from the shell does just that. Does anyone know why this might be happening?

-Kevin Ballard

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Manual hunk edit mode + emacs + ^G == garbage
  2010-10-15  9:13     ` Kevin Ballard
@ 2012-02-22 21:43       ` Matt McClure
  0 siblings, 0 replies; 10+ messages in thread
From: Matt McClure @ 2012-02-22 21:43 UTC (permalink / raw)
  To: git

Kevin Ballard <kevin <at> sb.org> writes:

> I'm still very much interested in finding a solution to why ^G kills
> emacs when it's invoked by git. As I said earlier, it appears that emacs
> shares the same process group with the perl process that called it, even
> though Andreas Schwab says it puts itself into its own process group and
> invoking emacs from the shell does just that. Does anyone know why this
> might be happening?

Kevin,

I was having the same problem you described on Mac OS X Lion and found this
old thread. A workaround that works for me is:

~/bin/emacs.sh:

#!/bin/bash -i

emacs "$@"

-- cut --

git config --global core.editor ~/bin/emacs.sh

Matt

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-02-22 23:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 21:37 Manual hunk edit mode + emacs + ^G == garbage Kevin Ballard
2010-10-13 21:48 ` Drew Northup
2010-10-13 21:53   ` Kevin Ballard
2010-10-13 22:40     ` Andreas Schwab
2010-10-13 22:49       ` Kevin Ballard
2010-10-14  9:37 ` Ævar Arnfjörð Bjarmason
2010-10-14  9:47   ` Kevin Ballard
2010-10-14  9:51   ` Miles Bader
2010-10-15  9:13     ` Kevin Ballard
2012-02-22 21:43       ` Matt McClure

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).