all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RE: How to use set-fill-column as a hook?
@ 2002-12-10 15:42 Bingham, Jay
  0 siblings, 0 replies; 7+ messages in thread
From: Bingham, Jay @ 2002-12-10 15:42 UTC (permalink / raw)


Try this, it worked for me.

(add-hook 'latex-mode-hook (lambda () (setq fill-column 100)))

Any mode that has a mode hook, all that I have seen do, can be set in a
similar manner.  Just specify the appropriate mode hook and the value
that you want the fill-column to be for the mode.
Individual mode customizations have to be done with a mode hook because
the variable fill-column becomes buffer local when it is set in any
manner.  Since the since the mode hooks get executed each time the mode
in invoked, i.e. each time a buffer is created in that mode or you
change a buffer to that mode.

-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Quality
Assurance
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W.
Crane-

-----Original Message-----
From: Adam [mailto:a24061@void.yahoo.void.com] 
Sent: Tuesday, December 10, 2002 8:57 AM
To: help-gnu-emacs@gnu.org
Subject: How to use set-fill-column as a hook?

I have the following in ~/.emacs:

(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'latex-mode-hook 'turn-on-auto-fill)

I now want to set the fill-column differently for LaTeX files.

This doesn't do anything (I verified with C-h v that the value of 
fill-column is 70, the default):
(add-hook 'latex-mode-hook '('set-fill-column 100))

This gives an error when starting emacs:
(add-hook 'latex-mode-hook ('set-fill-column 100))

What's the correct syntax?


Also, once I've done that, can I set it differently for mail-mode and 
text-mode?

Thanks,
Adam

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <mailman.117.1039618386.19936.help-gnu-emacs@gnu.org>]
* RE: How to use set-fill-column as a hook?
@ 2002-12-11 14:52 Bingham, Jay
  0 siblings, 0 replies; 7+ messages in thread
From: Bingham, Jay @ 2002-12-11 14:52 UTC (permalink / raw)


In my .emacs I have:
(setq-default fill-column 75)
followed by:
(add-hook 'text-mode-hook 'turn-on-auto-fill)

When I evaluated
(add-hook 'latex-mode-hook (lambda () (setq fill-column 100)))
in the scratch buffer then created a temporary buffer and switched to
latex mode I had no problems the fill column was set to 100.
You may be right about latex mode running text mode hooks.  If that is
the case then I would recommend setting the default fill-column to the
value you want for text-mode and adding hooks for the modes that you
want to have a different value.

Good luck
-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Quality
Assurance
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W.
Crane-

-----Original Message-----
From: Adam [mailto:a24061@void.yahoo.void.com] 
Sent: Wednesday, December 11, 2002 6:43 AM
To: help-gnu-emacs@gnu.org
Subject: RE: How to use set-fill-column as a hook?

On Tuesday 10 December 2002 15:42, Bingham, Jay wrote:

> Try this, it worked for me.
> 
> (add-hook 'latex-mode-hook (lambda () (setq fill-column 100)))
> 
> Any mode that has a mode hook, all that I have seen do, can be set in
a
> similar manner.  Just specify the appropriate mode hook and the value
> that you want the fill-column to be for the mode.
> Individual mode customizations have to be done with a mode hook
because
> the variable fill-column becomes buffer local when it is set in any
> manner.  Since the since the mode hooks get executed each time the
mode
> in invoked, i.e. each time a buffer is created in that mode or you
> change a buffer to that mode.

I've tried it but I also have 
(add-hook 'text-mode-hook 'turn-on-auto-fill)
in ~/.emacs, and the value of fill-column inherited from text-mode is 
overriding the value I'm trying to set for latex-mode. (I think that 
latex-mode is running its own hooks _then_ the text-mode hooks.) I'd
really 
like to set them differently.

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <mailman.89.1039534939.19936.help-gnu-emacs@gnu.org>]
* How to use set-fill-column as a hook?
@ 2002-12-10 14:57 Adam
  2002-12-10 14:59 ` David Kastrup
  0 siblings, 1 reply; 7+ messages in thread
From: Adam @ 2002-12-10 14:57 UTC (permalink / raw)


I have the following in ~/.emacs:

(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'latex-mode-hook 'turn-on-auto-fill)

I now want to set the fill-column differently for LaTeX files.

This doesn't do anything (I verified with C-h v that the value of 
fill-column is 70, the default):
(add-hook 'latex-mode-hook '('set-fill-column 100))

This gives an error when starting emacs:
(add-hook 'latex-mode-hook ('set-fill-column 100))

What's the correct syntax?


Also, once I've done that, can I set it differently for mail-mode and 
text-mode?

Thanks,
Adam

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-12-11 19:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-10 15:42 How to use set-fill-column as a hook? Bingham, Jay
     [not found] <mailman.117.1039618386.19936.help-gnu-emacs@gnu.org>
2002-12-11 19:05 ` Adam
  -- strict thread matches above, loose matches on Subject: below --
2002-12-11 14:52 Bingham, Jay
     [not found] <mailman.89.1039534939.19936.help-gnu-emacs@gnu.org>
2002-12-11 12:43 ` Adam
2002-12-10 14:57 Adam
2002-12-10 14:59 ` David Kastrup
2002-12-10 15:27   ` Adam

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.