* message mode loses highlighting
@ 2003-06-25 15:40 Ted Zlatanov
2003-06-25 23:26 ` Johan Bockgård
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2003-06-25 15:40 UTC (permalink / raw)
I have the following in my .emacs:
(defface font-lock-empty-line-face
'((t (:height 80 :inherit default)))
"Font Lock mode face used for blank lines."
:group 'font-lock-highlighting-faces)
(defvar font-lock-empty-line 'font-lock-empty-line-face
"Face name to use for blank lines.")
(defun tzz-highlighting-install ()
(interactive)
(font-lock-mode t)
(font-lock-add-keywords
nil
`(("^\\([^-A-Za-z0-9]+\\)$" (0 'font-lock-empty-line-face))
("\n" (0 'font-lock-empty-line-face))
("\\(FIXME\\|TODO\\)" (1 'font-lock-warning-face prepend)))))
(dolist (hook '(emacs-lisp-mode-hook
cperl-mode-hook
shell-mode-hook
text-mode-hook
change-log-mode-hook
makefile-mode-hook
texinfo-mode-hook))
(add-hook hook 'tzz-highlighting-install))
And it shouldn't interfere with message mode, but it does. When I
compose a message, all the highlighting is gone.
Can anyone suggest a fix? I'm pretty sure this is the problem, since
it's the only thing I've changed in my .emacs and things work fine
without it.
Thanks
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-06-25 15:40 message mode loses highlighting Ted Zlatanov
@ 2003-06-25 23:26 ` Johan Bockgård
2003-06-26 4:42 ` Ted Zlatanov
0 siblings, 1 reply; 12+ messages in thread
From: Johan Bockgård @ 2003-06-25 23:26 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> I have the following in my .emacs:
[...]
> (dolist (hook '(emacs-lisp-mode-hook
> cperl-mode-hook
> shell-mode-hook
> text-mode-hook
> change-log-mode-hook
> makefile-mode-hook
> texinfo-mode-hook))
> (add-hook hook 'tzz-highlighting-install))
>
> And it shouldn't interfere with message mode, but it does.
Message-mode is a derived from text-mode and runs text-mode-hook.
--
The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners. -- Ernst Jan Plugge
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-06-25 23:26 ` Johan Bockgård
@ 2003-06-26 4:42 ` Ted Zlatanov
2003-06-26 5:24 ` Harry Putnam
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2003-06-26 4:42 UTC (permalink / raw)
On Thu, 26 Jun 2003, bojohan+news@dd.chalmers.se wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:
>
>> I have the following in my .emacs:
> [...]
>> (dolist (hook '(emacs-lisp-mode-hook
>> cperl-mode-hook
>> shell-mode-hook
>> text-mode-hook
>> change-log-mode-hook
>> makefile-mode-hook
>> texinfo-mode-hook))
>> (add-hook hook 'tzz-highlighting-install))
>>
>> And it shouldn't interfere with message mode, but it does.
>
> Message-mode is a derived from text-mode and runs text-mode-hook.
Sorry if I didn't make it clear, but I understand that part, my
question is why would the tzz-highlighting-install function turn off
ALL syntax highlighting in the message buffer? It doesn't do that in
an Emacs Lisp buffer, for instance.
Thanks
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-06-26 4:42 ` Ted Zlatanov
@ 2003-06-26 5:24 ` Harry Putnam
2003-06-26 11:38 ` Ted Zlatanov
0 siblings, 1 reply; 12+ messages in thread
From: Harry Putnam @ 2003-06-26 5:24 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> Sorry if I didn't make it clear, but I understand that part, my
> question is why would the tzz-highlighting-install function turn off
> ALL syntax highlighting in the message buffer? It doesn't do that in
> an Emacs Lisp buffer, for instance.
I faintly remember having a similar trouble with message mode and
highlight a long time ago. It went on for quite a while. I posted
about it but couldn't get it resolved.
I can't remember for sure what the fix was but I think it was
something simple like having two calls to fontlock in text mode from
old pieces of init files still lurking about in emacs or site-start.el
Might have been two similar or identical hooks to fontlock in text mode.
Do you have a text mode hook somewhere calling fontlock?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-06-26 5:24 ` Harry Putnam
@ 2003-06-26 11:38 ` Ted Zlatanov
2003-07-01 12:02 ` Katsumi Yamaoka
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2003-06-26 11:38 UTC (permalink / raw)
Cc: ding
On Wed, 25 Jun 2003, reader@newsguy.com wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:
>
>> Sorry if I didn't make it clear, but I understand that part, my
>> question is why would the tzz-highlighting-install function turn
>> off ALL syntax highlighting in the message buffer? It doesn't do
>> that in an Emacs Lisp buffer, for instance.
>
> I faintly remember having a similar trouble with message mode and
> highlight a long time ago. It went on for quite a while. I posted
> about it but couldn't get it resolved.
>
> I can't remember for sure what the fix was but I think it was
> something simple like having two calls to fontlock in text mode from
> old pieces of init files still lurking about in emacs or
> site-start.el
>
> Might have been two similar or identical hooks to fontlock in text
> mode.
>
> Do you have a text mode hook somewhere calling fontlock?
What I posted is the only customization involving fontlock I have. In
any case, add-keywords should not override any other font locking,
according to the docs, that's why I'm puzzled.
I guess I can look at the message mode source. I'm just so busy right
now that I will probably get to it next year :)
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-06-26 11:38 ` Ted Zlatanov
@ 2003-07-01 12:02 ` Katsumi Yamaoka
2003-07-07 14:36 ` Ted Zlatanov
0 siblings, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2003-07-01 12:02 UTC (permalink / raw)
Cc: ding
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 905 bytes --]
>>>>> In <4n7k79vzjy.fsf@lockgroove.bwh.harvard.edu>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
> What I posted is the only customization involving fontlock I have. In
> any case, add-keywords should not override any other font locking,
> according to the docs, that's why I'm puzzled.
> I guess I can look at the message mode source. I'm just so busy right
> now that I will probably get to it next year :)
If you use turn-on-font-lock for the message-mode, replace it
with `(lambda nil (font-lock-mode 1))' and your message buffer
will revive. :)
Since message-mode is derived from text-mode as Johan Bockg^[.A^[Nerd
said, font-lock is first turned on for the text-mode and only
keywords for the text-mode are used. When font-lock has already
been turned on, even if turn-on-font-lock is performed for the
message-mode, nothing changes (see font-lock.el).
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-01 12:02 ` Katsumi Yamaoka
@ 2003-07-07 14:36 ` Ted Zlatanov
2003-07-07 16:54 ` Wes Hardaker
2003-07-08 2:34 ` Katsumi Yamaoka
0 siblings, 2 replies; 12+ messages in thread
From: Ted Zlatanov @ 2003-07-07 14:36 UTC (permalink / raw)
Cc: ding
On Tue, 01 Jul 2003, yamaoka@jpl.org wrote:
>>>>>> In <4n7k79vzjy.fsf@lockgroove.bwh.harvard.edu>
>>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
>
>> What I posted is the only customization involving fontlock I have.
>> In any case, add-keywords should not override any other font
>> locking, according to the docs, that's why I'm puzzled.
>
> If you use turn-on-font-lock for the message-mode, replace it
> with `(lambda nil (font-lock-mode 1))' and your message buffer
> will revive. :)
This is my current function:
(defun tzz-highlighting-install ()
(interactive)
(font-lock-mode t)
(font-lock-add-keywords
nil
`(("^\\([^-A-Za-z0-9]+\\)$" (0 'font-lock-empty-line-face))
("\n" (0 'font-lock-empty-line-face))
("\\(FIXME\\|TODO\\)" (1 'font-lock-warning-face prepend)))))
According to the docs, font-lock-mode works the same with the t and
the 1 parameters, so what you suggest shouldn't make a difference.
> Since message-mode is derived from text-mode as Johan Bockgård
> said, font-lock is first turned on for the text-mode and only
> keywords for the text-mode are used. When font-lock has already
> been turned on, even if turn-on-font-lock is performed for the
> message-mode, nothing changes (see font-lock.el).
Hmm, so how can I do what I need to do?
Maybe I can detect message-mode and when it's active, skip execution
of the font-lock machinery above? It would be better for me, however,
to have the highlighting in message-mode as well.
Thanks for your help
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-07 14:36 ` Ted Zlatanov
@ 2003-07-07 16:54 ` Wes Hardaker
2003-07-08 2:34 ` Katsumi Yamaoka
1 sibling, 0 replies; 12+ messages in thread
From: Wes Hardaker @ 2003-07-07 16:54 UTC (permalink / raw)
Cc: ding
>>>>> On Mon, 07 Jul 2003 10:36:30 -0400, Ted Zlatanov <tzz@lifelogs.com> said:
Ted> Maybe I can detect message-mode and when it's active, skip
Ted> execution of the font-lock machinery above? It would be better
Ted> for me, however, to have the highlighting in message-mode as
Ted> well.
I posted a new file called gnus-highlight.el the other day that lets
you do highlighting based on simple regular expressions. It works for
both the summary buffer and the article buffer. I should do the
message buffer too though...
--
"In the bathtub of history the truth is harder to hold than the soap,
and much more difficult to find." -- Terry Pratchett
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-07 14:36 ` Ted Zlatanov
2003-07-07 16:54 ` Wes Hardaker
@ 2003-07-08 2:34 ` Katsumi Yamaoka
2003-07-10 20:33 ` Ted Zlatanov
1 sibling, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2003-07-08 2:34 UTC (permalink / raw)
Hi,
>>>>> In <4nbrw62ykx.fsf@lockgroove.bwh.harvard.edu>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
> This is my current function:
> (defun tzz-highlighting-install ()
[...]
I'm well aware of that. How did you use to turn on font-lock in
a messege buffer (before using it)? AFAIK, Gnus doesn't turn on
font-lock for the message-mode by default, except for XEmacs.
So, I'm using the following code:
(cond ((featurep 'xemacs)
)
(t
(add-hook 'message-mode-hook 'turn-on-font-lock)))
If the tzz-highlighting-install function is only the way to turn
on font-lock for the message-mode (by way of the text-mode), the
value of the message-font-lock-keywords variable will never be
regarded. It was mentioned in my last message as follows:
>> font-lock is first turned on for the text-mode and only keywords
>> for the text-mode are used.
> According to the docs, font-lock-mode works the same with the t and
> the 1 parameters, so what you suggest shouldn't make a difference.
You are right. The tzz- function will surely turn on font-lock
for the *text-mode* and it will be still turned on for the
message-mode. Even so, the message-font-lock-keywords variable
will still be ignored. What you should do is to add the
following hook in order to turn on font-lock again for the
*message-mode*. For that purpose, it is necessary to use
`(font-lock-mode 1)' rather than `turn-on-font-lock' since
t-o-f-l does nothing if font-lock is already turned on:
(add-hook 'message-mode-hook (lambda nil (font-lock-mode 1)))
P.S.
Sorry for my funny English. I am a sophisticated writer in
Japanese, but not in English. ;-)
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-08 2:34 ` Katsumi Yamaoka
@ 2003-07-10 20:33 ` Ted Zlatanov
2003-07-11 6:50 ` Katsumi Yamaoka
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2003-07-10 20:33 UTC (permalink / raw)
Cc: ding
On Tue, 08 Jul 2003, yamaoka@jpl.org wrote:
> I'm well aware of that. How did you use to turn on font-lock in
> a messege buffer (before using it)? AFAIK, Gnus doesn't turn on
> font-lock for the message-mode by default, except for XEmacs.
I have
(global-font-lock-mode t)
in my .emacs, and it affects message-mode as well I think.
> You are right. The tzz- function will surely turn on font-lock
> for the *text-mode* and it will be still turned on for the
> message-mode. Even so, the message-font-lock-keywords variable
> will still be ignored. What you should do is to add the
> following hook in order to turn on font-lock again for the
> *message-mode*. For that purpose, it is necessary to use
> `(font-lock-mode 1)' rather than `turn-on-font-lock' since
> t-o-f-l does nothing if font-lock is already turned on:
>
> (add-hook 'message-mode-hook (lambda nil (font-lock-mode 1)))
When I do M-x font-lock-mode in a message-mode buffer it disables
font-lock. Running it again re-enables font-lock.
M-: (font-lock-mode 1) in a message-mode buffer after the
tzz-highlighting-install function has no effect (but it returns t).
The buffer remains without highlighting. Adding it to the
message-mode-hook as a lambda function has no effect, either.
Basically, my problem is that tzz-highlighting-install should work,
and works in all other modes, but for message-mode it turns font-lock
off. font-lock, however, still thinks it's on! So maybe the
message-mode highlighting keywords are somehow affected by the
font-lock-add-keywords statement.
> P.S.
> Sorry for my funny English. I am a sophisticated writer in
> Japanese, but not in English. ;-)
No problem, I appreciate your help greatly. I don't know if I'll get
the characters right, since I don't speak Japanese, but here's a try:
どうもarigataう :)
I couldn't figure out a way to input "ari" or "gata" with the
japanese-hiragana input method.
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-10 20:33 ` Ted Zlatanov
@ 2003-07-11 6:50 ` Katsumi Yamaoka
2003-07-11 15:21 ` Ted Zlatanov
0 siblings, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2003-07-11 6:50 UTC (permalink / raw)
Cc: ding
>>>>> In <4nznjmyvdo.fsf@lockgroove.bwh.harvard.edu>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
> I have
> (global-font-lock-mode t)
> in my .emacs, and it affects message-mode as well I think.
Oops, I forgot it completely since I am using XEmacs usually.
In addition, I made two mistakes. One is I am using Develock[1],
the other is I forgot there is the font-lock-set-defaults buffer
local variable which indicates whether font-lock-keywords have
already been set. You can make your message buffer look like
fruit parfait again using the following hook:
(add-hook 'message-mode-hook
(lambda nil
(setq font-lock-set-defaults nil)
(font-lock-mode 1)))
or
(add-hook 'message-mode-hook
(lambda nil
(font-lock-mode -1)
(font-lock-mode 1)))
(Otherwise, you can use Develock instead ;-)
Therefore, we may have to turn off font-lock in the message-mode
function as follows:
--- message.el~ 2003-07-08 00:55:55 +0000
+++ message.el 2003-07-11 06:49:10 +0000
@@ -2345,6 +2345,8 @@
"<#!*/?\\(multipart\\|part\\|external\\|mml\\|secure\\)"))
;; Allow using comment commands to add/remove quoting.
(set (make-local-variable 'comment-start) message-yank-prefix)
+ (when (featurep 'font-lock)
+ (font-lock-mode -1))
(if (featurep 'xemacs)
(message-setup-toolbar)
(set (make-local-variable 'font-lock-defaults)
>> P.S.
>> Sorry for my funny English. I am a sophisticated writer in
>> Japanese, but not in English. ;-)
> No problem, I appreciate your help greatly. I don't know if I'll get
> the characters right, since I don't speak Japanese, but here's a try:
> どうもarigataう :)
Great! But please say a-ri-ga-to-u, not a-ri-ga-ta-u.
> I couldn't figure out a way to input "ari" or "gata" with the
> japanese-hiragana input method.
どうもありがとう :)
--
Katsumi Yamaoka <yamaoka@jpl.org>
[1] ftp://ftp.jpl.org/pub/elisp/develock.el.gz
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: message mode loses highlighting
2003-07-11 6:50 ` Katsumi Yamaoka
@ 2003-07-11 15:21 ` Ted Zlatanov
0 siblings, 0 replies; 12+ messages in thread
From: Ted Zlatanov @ 2003-07-11 15:21 UTC (permalink / raw)
Cc: ding
I believe I fixed it - at least, it works for me now:
(defun tzz-highlighting-install ()
(interactive)
(font-lock-mode -1)
(font-lock-mode 1)
(font-lock-add-keywords
nil
`(("^\\([^-A-Za-z0-9]+\\)$" (0 'font-lock-empty-line-face))
("\n" (0 'font-lock-empty-line-face))
("\\(FIXME\\|TODO\\)" (1 'font-lock-warning-face prepend)))))
(dolist (hook '(emacs-lisp-mode-hook
cperl-mode-hook
shell-mode-hook
text-mode-hook
change-log-mode-hook
makefile-mode-hook
message-mode-hook
texinfo-mode-hook))
(add-hook hook 'tzz-highlighting-install))
Both the
(font-lock-mode -1)
(font-lock-mode 1)
and the message-mode-hook addition were necessary in order to get the
desired font-lock keywords in message-mode while retaining the beloved
"fruit salad" Gnus highlighting.
Thanks!
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-07-11 15:21 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-25 15:40 message mode loses highlighting Ted Zlatanov
2003-06-25 23:26 ` Johan Bockgård
2003-06-26 4:42 ` Ted Zlatanov
2003-06-26 5:24 ` Harry Putnam
2003-06-26 11:38 ` Ted Zlatanov
2003-07-01 12:02 ` Katsumi Yamaoka
2003-07-07 14:36 ` Ted Zlatanov
2003-07-07 16:54 ` Wes Hardaker
2003-07-08 2:34 ` Katsumi Yamaoka
2003-07-10 20:33 ` Ted Zlatanov
2003-07-11 6:50 ` Katsumi Yamaoka
2003-07-11 15:21 ` Ted Zlatanov
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 NNTP newsgroup(s).