[comp.emacs] Terminal width for emacs

dillon@uhccux.uhcc.hawaii.edu (Ian Dillon) (09/21/88)

Does emacs have a startup file which it will look for to setup 
predefined functions?  Also, is it possible to switch from
80 to 132 columns while in emacs.  I use a vt100 clone, and it
would be nice to have emacs automatically switch the number of
columns available as soon as you edit a file.  

Thanks in advance!


 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 |  Ian Dillon                                                               |
 |  Department of Chemistry               UUCP: dillon@uhccux.UUCP           | 
 |  2545 The Mall                 INTERNET: dillon@uhccux.UHCC.HAWAII.EDU    | 
 |  University of  Hawaii               BITNET: dillon@uhccux.bitnet         | 
 |  Honolulu, Hawaii, 96822                                                  | 
 |  Phone: (808) 948-7680                                                    | 
 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

ditto@cbmvax.UUCP (Michael "Ford" Ditto) (09/21/88)

In article <2402@uhccux.uhcc.hawaii.edu> dillon@uhccux.uhcc.hawaii.edu (Ian Dillon) writes:
>				is it possible to switch from
>80 to 132 columns while in emacs.  I use a vt100 clone, and it
>would be nice to have emacs automatically switch the number of
>columns available as soon as you edit a file.  

You don't say which Emacs, so my example will be for Gnu Emacs.

If you want to automatically switch to 132 columns whenever you run Emacs,
I suggest making a script that outputs the escape sequence, sets $TERM,
runs emacs, and restores the screen size.

If you want to manually change the screen width while in Emacs, just do
M-x eval-expression (probably ESC-ESC) and type (set-screen-width 132).

If you are trying to have Emacs switch to 132 columns only when you visit
certain files, you could try appending to those files something like this:

Local Variables:
eval: (progn (send-string-to-terminal "\033w") (set-screen-width 132))
End:


(I just made up the "\033w"; replace it with the appropriate escape
sequence.)  It might be necessary to enclose the above lines in a comment
of some sort if the file is meant to be read by a program.

I like the first suggestion better (making a script for starting a
132-column Emacs) because it keeps the terminal dependency out of your
files.  It also would probably work for any program or version of Emacs.

-- 
					-=] Ford [=-

	.		.		(In Real Life: Mike Ditto)
.	    :	       ,		ford@kenobi.cts.com
This space under construction,		...!ucsd!elgar!ford
pardon our dust.			ditto@cbmvax.commodore.com

jr@PIZZA.BBN.COM (John Robinson) (09/21/88)

> If you want to automatically switch to 132 columns whenever you run Emacs,
> I suggest making a script that outputs the escape sequence, sets $TERM,
> runs emacs, and restores the screen size.

It is sufficient to set $TERM to, say, vt100-w, run emacs, then fix
$TERM and run tset (or whatever) to reset the terminal.  But the
original poster did say "while in emacs".

/jr
jr@bbn.com or bbn!jr

pjr@cgdra.ucar.edu (Phil Rasch) (09/22/88)

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