* 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
* Re: How to use set-fill-column as a hook?
2002-12-10 14:57 Adam
@ 2002-12-10 14:59 ` David Kastrup
2002-12-10 15:27 ` Adam
0 siblings, 1 reply; 7+ messages in thread
From: David Kastrup @ 2002-12-10 14:59 UTC (permalink / raw)
Adam <a24061@void.yahoo.void.com> writes:
> 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?
(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.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to use set-fill-column as a hook?
2002-12-10 14:59 ` David Kastrup
@ 2002-12-10 15:27 ` Adam
0 siblings, 0 replies; 7+ messages in thread
From: Adam @ 2002-12-10 15:27 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* 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
* RE: How to use set-fill-column as a hook?
[not found] <mailman.89.1039534939.19936.help-gnu-emacs@gnu.org>
@ 2002-12-11 12:43 ` Adam
0 siblings, 0 replies; 7+ messages in thread
From: Adam @ 2002-12-11 12:43 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* 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
* RE: How to use set-fill-column as a hook?
[not found] <mailman.117.1039618386.19936.help-gnu-emacs@gnu.org>
@ 2002-12-11 19:05 ` Adam
0 siblings, 0 replies; 7+ messages in thread
From: Adam @ 2002-12-11 19:05 UTC (permalink / raw)
On Wednesday 11 December 2002 14:52, Bingham, Jay wrote:
> 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.
I've now got the following in .emacs:
(setq-default fill-column 70)
(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)))
When I C-x C-f foo.txt and use C-h v to check fill-column, it says 75 (the
built-in default, I think)!. When I C-x C-f foo.tex, it's still 75. When I
C-x m, it changes to 60.
I think my Emacs must be behaving differently from yours! Is that possible?
^ 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 --
[not found] <mailman.89.1039534939.19936.help-gnu-emacs@gnu.org>
2002-12-11 12:43 ` How to use set-fill-column as a hook? Adam
[not found] <mailman.117.1039618386.19936.help-gnu-emacs@gnu.org>
2002-12-11 19:05 ` Adam
2002-12-11 14:52 Bingham, Jay
-- strict thread matches above, loose matches on Subject: below --
2002-12-10 15:42 Bingham, Jay
2002-12-10 14:57 Adam
2002-12-10 14:59 ` David Kastrup
2002-12-10 15:27 ` Adam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).