Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ncar!cgdra.ucar.edu!pjr
From: pjr@cgdra.ucar.edu (Phil Rasch)
Newsgroups: comp.emacs
Subject: Re: Terminal width for emacs
Message-ID: <750@ncar.ucar.edu>
Date: 21 Sep 88 19:50:18 GMT
References: <4790@cbmvax.UUCP> <307.590857128@pizza>
Sender: news@ncar.ucar.edu
Reply-To: pjr@cgdra.ucar.edu (Phil Rasch)
Organization: NCAR/CGD, Boulder, CO
Lines: 33

I missed the original posting. Hope I am not repeating somebody elses 
solution. Here is the stuff I use to toggle 132 mode on a vt100. 
I am completely ignorant of lisp, so I did it by guess and example. There
is sure to be a better way.

Stick this stuff in your .emacs file, and bind to your favorite key, currently
PF2.  Hit it once to switch to 132 col mode, 
and a second time to get back to 80 col mode.
----------------------------------------------------------------------

(define-key function-keymap "2" 'toggle-132-mode)

(setq toggle-132-mode nil)
(set-screen-width 80)

(defun toggle-132-mode (arg)
  "Toggle 132/80 column mode for vt100s. So far does not check to
make sure the user is on a vt100."
 (interactive "P")
 (setq toggle-132-mode 
	(if (null arg) (not toggle-132-mode)
	  (> (prefix-numeric-value arg) 0)))
 (if (eq toggle-132-mode t)
     (send-string-to-terminal "\e[?3h")
     (send-string-to-terminal "\e[?3l"))
 (if (eq toggle-132-mode t)
     (set-screen-width 132)
     (set-screen-width 80))
 )

---------------------------------------------------------------------

Philip Rasch (pjr.ucar.edu) National Center for Atmospheric Research