help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: mode-aware fill-column?


From: Oliver Scholz
Subject: Re: mode-aware fill-column?
Date: Tue, 17 Sep 2002 01:47:21 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

mike hardy <address@hidden> writes:
[...]
> Using Emacs for personal editing I like text columns to wrap around 84
> chars.  But (some) ppl prefer to see 72-ish for posting to Usenet.  I'd
> like to accomodate them if there is some automatic way of changing
> fill-column's value between the two.  Say somehow using ~/.gnus.el to
> change it to 72 but all other times use 84 (and when exiting Gnus it
> reverts to 84 automatically)?

The usual way for a task like this in Emacs is to use a hook (See in
the manual: ==> Customization ==> Variables ==> Hooks). Almost every
major mode is supposed to provide at least one hook: the
<mode-name>-mode-hook. Since you use Gnus, you write messages in
`message-mode', so this would be `message-mode-hook'.

The variable `fill-column' becomes automatically a local variable if
you set it to a different value in a buffer. So all you have to do is
to put a `(setq fill-column 72)' in the `message-mode-hook'. But you
have to wrap this into an anonymous function via `lambda':

(add-hook 'message-mode-hook (lambda () (setq fill-column 72)))

    -- Oliver

-- 
Jour de la Vertu de l'Année 210 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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