From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: line length control setting Date: Tue, 11 Nov 2003 14:47:56 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87n0b3auxe.fsf@ID-87814.user.dfncis.de> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1068559706 5978 80.91.224.253 (11 Nov 2003 14:08:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Nov 2003 14:08:26 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 11 15:08:23 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJZBv-0002gq-00 for ; Tue, 11 Nov 2003 15:08:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJa0q-0004TL-QW for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Nov 2003 10:01:00 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!dialin-145-254-194-109.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: dialin-145-254-194-109.arcor-ip.net (145.254.194.109) Original-X-Trace: news.uni-berlin.de 1068558941 52061289 145.254.194.109 (16 [87814]) X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:H9W8XHGUzHBJAz4EcuuAAL02ldQ= Original-Xref: shelby.stanford.edu gnu.emacs.help:118115 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14054 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14054 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 minibuffer: (when (and (not (minibufferp)) (> (current-column) fill-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 '((t (: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). Oliver -- 21 Brumaire an 212 de la Révolution Liberté, Egalité, Fraternité!