[Top][All Lists]

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

Re: mode-aware fill-column?

From: mike hardy
Subject: Re: mode-aware fill-column?
Date: Tue, 17 Sep 2002 04:48:39 GMT
User-agent: Gnus v5.9.0/Emacs 21.0.102

Nostradamus foretold that on Tue Sep 17 2002, Oliver Scholz would write:

> 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

Excellent - works great!!  Thanks both for the info/code.  

I did try (before posting) using text-mode-hook (copied the format from
somewhere else) but I kept getting an error which I see on occasion
(don't recall what it was but it's a common one for me when
experimenting :->).  I bet it was for lack of this lamdba reference.




  Help Wanted: Psychic.  You know where to apply.

reply via email to

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