Subject: Emacs initializes the alternate screen twice

From: [email-masked]
Date: Wed, 8 Sep 2010 18:41:57 -0500

When a console-mode Emacs initializes its terminal, it sends the escape
sequence to switch to the alternate screen twice. This causes problems
when running under screen (and maybe other terminal programs as well):
exiting or suspending Emacs completely clears the screen. I have
attached a patch that fixes this.
diff --git a/src/term.c b/src/term.c
index fda06d6..fc013be 100644
--- a/src/term.c
+++ b/src/term.c
@@ -250,7 +250,6 @@ tty_set_terminal_modes (struct terminal *terminal)
             cmputc ('\n');
         }

-      OUTPUT_IF (tty, tty->TS_termcap_modes);
       OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
       OUTPUT_IF (tty, tty->TS_keypad_mode);
       losecursor (tty);