[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: line length control setting

From: Oliver Scholz
Subject: Re: line length control setting
Date: Tue, 11 Nov 2003 14:47:56 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

Adam Hardy <> writes:

> Hi All,
> I am using a brute force method of stopping myself from writing long
> lines of code, using this in my .emacs:
> (defun my-dont-insert-after-fill-column (&rest x)
>    (when (> (current-column)
>             fill-column)
>      (delete-char -1)
>      (beep)))
> (add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
> But I discovered this is also acting on the command buffer, so I
> cannot add more than my fill column when doing simple file copies or
> renames or text search & replaces.

Well, you could just check whether the current buffer is the

(when (and (not (minibufferp))
           (> (current-column)
However, for my taste this is a little bit too obnoxious, too.  I'd
rather prefer some strong visual indication, like turning all lines
longer than 70 chars into a bright red:

(defface ah-overlong-lines
     (:background "red")))
  "Face used to display overlong lines")

(defconst ah-overlong-lines-keywords
  '(("^.\\{70,500\\}$" 0 'ah-overlong-lines prepend)))

(font-lock-add-keywords nil ah-overlong-lines-keywords)

I seem to recall that there is some package that does something with
colour. I think with the colour of the cursor.  But I don't remember
its name.

Or simply turn auto-fill-mode on.  This does also some sort of the
right thing for programming modes (although it is not quite as smart
as I wish it would be).

21 Brumaire an 212 de la Révolution
Liberté, Egalité, Fraternité!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]