From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Adam Newsgroups: gmane.emacs.help Subject: Re: How to use set-fill-column as a hook? Date: Tue, 10 Dec 2002 15:27:37 GMT Organization: n/a Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <6hnJ9.5028$ci6.42894520@news-text.cableinet.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: main.gmane.org 1039534724 23452 80.91.224.249 (10 Dec 2002 15:38:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 10 Dec 2002 15:38:44 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18LmT5-000666-00 for ; Tue, 10 Dec 2002 16:38:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18LmLE-0006Tf-05 for gnu-help-gnu-emacs@m.gmane.org; Tue, 10 Dec 2002 10:30:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-text.cableinet.net.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: 80.194.70.67 Original-X-Complaints-To: abuse@blueyonder.co.uk Original-X-Trace: news-text.cableinet.net 1039534057 80.194.70.67 (Tue, 10 Dec 2002 15:27:37 GMT) Original-NNTP-Posting-Date: Tue, 10 Dec 2002 15:27:37 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:107951 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4491 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4491 On Tuesday 10 December 2002 14:59, David Kastrup wrote: >> What's the correct syntax? > > (add-hook 'latex-mode-hook (lambda() (set-fill-column 100))) > >> Also, once I've done that, can I set it differently for mail-mode and >> text-mode? > > Sure, just the same like above. Of course, latex-mode also runs > text-mode-hook, but it might run it before latex-mode-hook. OK, that's exactly what I wanted but things are occurring in the wrong order. I now have the following in my .emacs file: (add-hook 'text-mode-hook 'turn-on-auto-fill) (add-hook 'latex-mode-hook 'turn-on-auto-fill) (add-hook 'html-mode-hook 'turn-off-auto-fill) (add-hook 'latex-mode-hook (lambda() (set-fill-column 100))) (add-hook 'mail-mode-hook (lambda() (set-fill-column 60))) (add-hook 'text-mode-hook (lambda() (set-fill-column 80))) When I start Emacs in *scratch*, fill-column = 70 (default). If I open a text or LaTeX file, it changes to 80. If I "C-x m", it changes to 60. So mail-mode is picking up turn-on-auto-fill from text-mode, but its own set-fill-column is overriding that of text-mode. But latex-mode's set-fill-column is being overridden by the text-mode-hook. Any ideas on how to change that? -- Adam