Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Limiting lines to 80 columns?

8 views
Skip to first unread message

David Sundstrom

unread,
Jan 22, 1999, 3:00:00 AM1/22/99
to
My company has this draconian rule that no line of source code shall
exceed 80 columns. Apparently they must still think they're on DOS
or mainframe terminals.

Is there a package available in either GNU or Xemacs which will
help me know when I've "crossed the line". I do display the column
number in my mode bar, but dont' always watch it. I need something
like a vertical bar drawn at col 80 or other visual notification when
I've entered text beyond col 80. I don't want to _not_ be able to
type past 80 cols, just to know when I've done it.

My e-mail is first 5 chars of my last name @texas.net
David Sundstrom


Barry Margolin

unread,
Jan 22, 1999, 3:00:00 AM1/22/99
to
In article <9W4q2.18449$bf6....@news1.giganews.com>,

David Sundstrom <first_5_chars...@texas.net> wrote:
>My company has this draconian rule that no line of source code shall
>exceed 80 columns. Apparently they must still think they're on DOS
>or mainframe terminals.
>
>Is there a package available in either GNU or Xemacs which will
>help me know when I've "crossed the line". I do display the column
>number in my mode bar, but dont' always watch it. I need something
>like a vertical bar drawn at col 80 or other visual notification when
>I've entered text beyond col 80. I don't want to _not_ be able to
>type past 80 cols, just to know when I've done it.

If you make your window 80 columns wide, you'll see a '\' in the rightmost
column when it has wrapped around.

--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.

David M. Cook

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
On Fri, 22 Jan 1999 14:15:06 -0600, David Sundstrom
<first_5_chars...@texas.net> wrote:

>My company has this draconian rule that no line of source code shall
>exceed 80 columns. Apparently they must still think they're on DOS
>or mainframe terminals.

I do not think that is at all a draconian rule. 80 columns is a standard.
Sure it's an arbitrary one based on punch cards, but it's still a standard.
A lot of computer standards are based on decisions lost in the mists of
time.

I find it very annoying to load a program into emacs and have unwrapped
lines all over the place because the author was working on DevStudio or some
other IDE that doesn't set itself to a standard column width.

>Is there a package available in either GNU or Xemacs which will
>help me know when I've "crossed the line".

Try M-x auto-fill-mode.

Dave Cook

Alan Wehmann

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
Fortran-mode has a feature where C-c C-w will temporarily show a
vertical line so as not to have non-comment characters past column 72.
Perhaps you can adapt this to what you want.

"David Sundstrom" <first_5_chars...@texas.net> writes:

> My company has this draconian rule that no line of source code shall
> exceed 80 columns. Apparently they must still think they're on DOS
> or mainframe terminals.
>

> Is there a package available in either GNU or Xemacs which will

> help me know when I've "crossed the line". I do display the column
> number in my mode bar, but dont' always watch it. I need something
> like a vertical bar drawn at col 80 or other visual notification when
> I've entered text beyond col 80. I don't want to _not_ be able to
> type past 80 cols, just to know when I've done it.
>

[snip]
--
Alan Wehmann
weh...@fnal.gov

Dave Love

unread,
Jan 24, 1999, 3:00:00 AM1/24/99
to
Fortran mode -- for Fortran fixed format, not `F90' mode -- is the
obvious place to look (for values of `80' equal to `72').

[The Emacs 20.3 version has a potential off-by-one-or-so bug related
to scroll-bar-mode and/or the scroll bar width, but that doesn't apply
to the fontification support.]

Edward Avis

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
>I need something
>like a vertical bar drawn at col 80 or other visual notification when
>I've entered text beyond col 80. I don't want to _not_ be able to
>type past 80 cols, just to know when I've done it.

Perhaps you could resize your Emacs window (or terminal window) to
exactly 81 columns. Crude, but effective.

--
Ed Avis

Roger Cass

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
Edward Avis wrote:

Actually, you want it to be 80 columns because having the <return> in the
80th column will cause line wrap on terminals with fixed 80 column
displays (e.g. telnet into my SGI from home). That effectually means
that code is only 79 columns so that the <return> can be in the 80th
column.

I personally advocate 79 column coding in a UNIX environment because of
the numerous >cough< VI users among our 650 developers.

Roger
--
Roger Cass, PhD, Senior Software Engineer
SDRC, 2000 Eastman Dr., Milford, OH 45150
513-576-5847 roger...@sdrc.com

Pranav Tiwari

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
Put the following in your .emacs:

(add-hook
'c-mode-hook
'(lambda ()
(auto-fill-mode)
(set-fill-column 80)))

hth,
-p

--
Pranav Tiwari
(919)851-9568 (h), (919)472-3385 (o), (919)472-3385 (fax)


Gongquan Chen

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
David Sundstrom wrote:
>
> My company has this draconian rule that no line of source code shall
> exceed 80 columns. Apparently they must still think they're on DOS
> or mainframe terminals.
>
> Is there a package available in either GNU or Xemacs which will
> help me know when I've "crossed the line". I do display the column
> number in my mode bar, but dont' always watch it. I need something

> like a vertical bar drawn at col 80 or other visual notification when
> I've entered text beyond col 80. I don't want to _not_ be able to
> type past 80 cols, just to know when I've done it.
>

auto-file-mode may not be the satisfying solution. I don't know if I
am reinventing a wheel here, but I attach an elisp file, vvb-mode.el
anyway, which I believe will exactly solve your problem. This is
a minor mode (for XEmacs only. It may work for FSF Emacs with slight
changes), so it can work with any major modes, programming or not.
Please see the Commentary part in the file for instruction.

Cheers,

Chen
Houston, Texas

vvb-mode.el

Valvassori Moise

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
"David Sundstrom" <first_5_chars...@texas.net> writes:

> My company has this draconian rule that no line of source code shall
> exceed 80 columns. Apparently they must still think they're on DOS
> or mainframe terminals.
>
> Is there a package available in either GNU or Xemacs which will
> help me know when I've "crossed the line". I do display the column
> number in my mode bar, but dont' always watch it. I need something
> like a vertical bar drawn at col 80 or other visual notification when
> I've entered text beyond col 80. I don't want to _not_ be able to
> type past 80 cols, just to know when I've done it.

You can use the "auto-fill-mode" and check the "fill-column" variable with
the "set-fill-column" command.
"auto-fill-mode" automaticaly wrap lines who are longer than "fill-column".


You can put in your .emacs:
(setq c-mode-hook
'(lambda ()
(auto-fill-mode)
(setq comment-column 80)
))


Toby Speight

unread,
Jan 26, 1999, 3:00:00 AM1/26/99
to
David> David Sundstrom
David> <URL:mailto:first_5_chars...@texas.net>

0> In <URL:news:9W4q2.18449$bf6....@news1.giganews.com>, David wrote:

David> Is there a package available in either GNU or Xemacs which will
David> help me know when I've "crossed the line". I do display the
David> column number in my mode bar, but dont' always watch it. I
David> need something like a vertical bar drawn at col 80 or other
David> visual notification when I've entered text beyond col 80. I
David> don't want to _not_ be able to type past 80 cols, just to know
David> when I've done it.

When I wanted to do this in Message mode, I used font-lock to help
me. I added this match to the end of font-lock-keywords for the mode:

(list (concat "^" (make-string 76 ?.) "\\(.+$\\)") '(1 warning-face t))

You'll want to change the 76 to 80, of course. And you might perhaps
need to define/change the face, too.


Keith Vetter

unread,
Feb 3, 1999, 3:00:00 AM2/3/99
to
In article <9W4q2.18449$bf6....@news1.giganews.com>,
David Sundstrom <first_5_chars...@texas.net> wrote:
>My company has this draconian rule that no line of source code shall
>exceed 80 columns.
>

The following function, while not exactly what you requested, is what I
use to get the same result. I have no clue who originally wrote it.


(defun over80 (repeat)
"go to the next line w/ length of more than 80.
With (possibly negative) arg, move to nth next line
with this characteristic. -TJIC 25 Feb 94"
(interactive "p")
(if (not repeat) (setq repeat 1))
(catch 'exit
( let (bol (direction ( if (> repeat 0) 1 -1)))
(while (and ( not (eq repeat 0))
(eq 0 (forward-line direction)))
(end-of-line)
(while ( <= (current-column) 80)
(progn
( if (not (eq 0 (forward-line direction)))
(throw 'exit t)
)
(end-of-line)))
( setq repeat ( - repeat direction))))
(beginning-of-line)
(setq bol (point))
(move-to-column 80)
(re-search-backward "[ \t]" bol 1)))

--
*********************************************************************
* Keith Vetter | He was born with the gift of laughter *
* Oracle | and a sense that the world was mad. *
* kve...@us.oracle.com | Raphael Sabatini *

0 new messages