I have been using this and it works well. I have committed it to SVN.

Cheers,
Len.


On Mon, May 9, 2011 at 2:12 PM,  <[email protected]> wrote:
> Actually, I think fixing this problem may be a simple change in
> jde-java-font-lock.el.
>
> I think you could just change the line
>
> (add-hook 'jde-mode-hook #'jde-setup-syntax-coloring)
>
> To
>
> (add-hook 'java-mode-hook #'jde-setup-syntax-coloring)
>
> -james
>
> -----Original Message-----
> From: Paul Landes [mailto:[email protected]]
> Sent: Saturday, May 07, 2011 11:44 AM
> To: [email protected][email protected]
> Cc: 'Jason McBrayer'; [email protected]; 'Len Trigg'
> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>
> Very glad to hear you found a solution.
>
> Do you have time to move your hook code to the source?  If so, I can
> merge that in so that others don't have to add hooks as well.
>
> Thanks Jason.
>
>
> On May 6, 2011, at 8:57 PM, <[email protected]>
> <[email protected]
>  > wrote:
>
>> Actually, after continuing to futz with this stuff, I seem to have
>> figured
>> out a solution to the problem.  I was a little suspicious of how the
>> jde-mode init method sets up the font-lock-defaults variable _after_
>> the
>> java-mode has fully initialized.  Indeed, I added a simple hook to
>> java-mode
>> to set the font-lock-defaults in that mode before jde-mode
>> initializes, and
>> that seems to consistently initialize my font-lock-keywords
>> correctly.  This
>> is the code I added to my startup files:
>>
>>     (add-hook 'java-mode-hook
>>               '(lambda ()
>>                  (set (make-local-variable 'font-lock-defaults)
>> jde-java-font-lock-defaults)))
>>
>>
>> -----Original Message-----
>> From: Paul Landes [mailto:[email protected]]
>> Sent: Wednesday, May 04, 2011 10:55 PM
>> To: [email protected][email protected]
>> Cc: 'Jason McBrayer'; [email protected]
>> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>>
>> What are the values of font-lock-keywords before and after the buffer
>> fortification error?
>>
>> Anything interesting in *Messages*?
>>
>>
>> On May 3, 2011, at 10:31 PM, <[email protected]>
>> <[email protected]  > wrote:
>>
>>> There is no exception.  This is my original email:
>>>
>>> Hey,
>>> Just wondering if anyone else has experienced erratic font-lock
>>> behavior.
>>> When I run jdee in emacs 23 (and the trunk of jde), the font-lock-
>>> keywords
>>> seems to bounce back and forth between 2 different sets of values.
>>> When I
>>> first open up a java file, I'll get a certain font-lock behavior.
>>> If I
>>> refresh the buffer, often times (not always), I'll get different
>>> font-lock behavior.  When I dump the value of the font-lock-keywords,
>>> I actually see 2
>>> different values between the first buffer load and the refresh.
>>> After the
>>> first refresh, the font locking seems to settle down, but not always
>>> to the "correct" values.  I don't know if this has something to do
>>> with my own setup or what, so I was wondering if anyone else saw
>>> similar behavior.  To me, the effects are most noticeable in the
>>> import statements, as the package names are fontified in
>>> font-lock-constant face sometimes (incorrect), and
>>> jde-java-font-lock-package face other times (the "correct" face).
>>> Thanks,
>>> -james
>>>
>>> -----Original Message-----
>>> From: Paul Landes [mailto:[email protected]]
>>> Sent: Tuesday, May 03, 2011 10:46 PM
>>> To: [email protected][email protected]
>>> Cc: 'Jason McBrayer'; [email protected]
>>> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>>>
>>> Sorry, I for some reason don't have the original and am extrapolating
>>> on what you wrote.
>>>
>>> Eval this:
>>>
>>> (setq stack-trace-on-signal t
>>>        stack-trace-on-error t)
>>>
>>> and make the exception happen again.  You should get a stack trace.
>>>
>>> Here's my font-lock-keywords (take it if it is helpful):
>>>
>>> (t
>>> (("[         ]\\([+-][^      \n]+\\)" 1 font-lock-comment-face)
>>>  ("^[^       \n]+:.*" . font-lock-string-face)
>>>  ("^\\[[1-9][0-9]*\\]" . font-lock-string-face))
>>> ("[  ]\\([+-][^      \n]+\\)"
>>>  (1 font-lock-comment-face))
>>> ("^[^        \n]+:.*"
>>>  (0 font-lock-string-face))
>>> ("^\\[[1-9][0-9]*\\]"
>>>  (0 font-lock-string-face)))
>>>
>>>
>>>
>>> On May 3, 2011, at 9:09 PM, <[email protected]>
>>> <[email protected]  > wrote:
>>>
>>>> Maybe I'm not making myself clear.  The problem isn't that my faces
>>>> have the wrong color, the problem is that the wrong faces are
>>>> applied
>>>> (due, presumably, to the different values of font-lock-keywords).
>>>> your configuration below is just face configuration, so I'm not sure
>>>> how that will help anything.  What kind of stack trace are you
>>>> looking for?
>>>> You want
>>>> me to send the 2 different values of font-lock-keywords?
>>>>
>>>> -----Original Message-----
>>>> From: Paul Landes [mailto:[email protected]]
>>>> Sent: Tuesday, May 03, 2011 8:30 PM
>>>> To: [email protected][email protected]
>>>> Cc: 'Jason McBrayer'; [email protected]
>>>> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>>>>
>>>> I've looked around and don't see anything.  You're the first to
>>>> report this problem.
>>>>
>>>> Here's what I have in my custom elisp file.  Try it and maybe it
>>>> will
>>>> fix something.  Otherwise, I don't really have much to go on.  Maybe
>>>> you could forward a full stack trace.
>>>>
>>>> '(compilation-mode-hook (quote (turn-on-font-lock)))
>>>> '(global-font-lock-mode t nil (font-lock))  '(font-lock-builtin-face
>>>> ((((class color) (background light)) (:foreground "dark violet"))))
>>>> '(font-lock-comment-face ((t (:foreground "#b00000"))))
>>>> '(font-lock-constant-face ((((class color) (background light))
>>>> (:foreground "CadetBlue"))))  '(font-lock-doc-face ((t (:foreground
>>>> "steel blue"))))  '(font-lock-function-name-face ((t (:foreground
>>>> "blue3"))))  '(font-lock-keyword-face ((t (:foreground
>>>> "DarkOrange4"))))  '(font-lock-string-face ((t (:foreground "forest
>>>> green"))))  '(font-lock-type-face ((t (:foreground "#ca3278"))))
>>>> '(font-lock-variable-name-face ((t (:foreground "darkcyan"))))
>>>> '(font-lock-warning-face ((t (:foreground "red" :weight bold))))
>>>> '(jde-java-font-lock-bold-face ((t (:foreground "#666666" :weight
>>>> bold))))
>>>> '(jde-java-font-lock-code-face ((t (:foreground "#993300"))))
>>>> '(jde-java-font-lock-javadoc-face ((t (:foreground "#a00020"))))
>>>> '(jde-java-font-lock-modifier-face ((((class color) (background
>>>> light)) (:foreground "#0033FF"))))
>>>> '(jde-java-font-lock-package-face ((((class color) (background
>>>> light)) (:foreground "#6600CC"))))
>>>> '(jde-java-font-lock-private-face ((((class color) (background
>>>> light)) (:foreground "forest green"))))
>>>> '(jde-java-font-lock-protected-face ((((class color) (background
>>>> light)) (:foreground "purple"))))
>>>> '(jde-java-font-lock-public-face ((((class color) (background
>>>> light)) (:foreground "red"))))
>>>>
>>>>
>>>> On May 1, 2011, at 10:04 PM, <[email protected]>
>>>> <[email protected]  > wrote:
>>>>
>>>>> I haven't noticed the problem in any other modes, although I'm not
>>>>> opening many large files these days which aren't java files.  When
>>>>> I've been testing this behavior, I've observed it both with the
>>>>> beanshell running and not running.
>>>>>
>>>>> -----Original Message-----
>>>>> From: Paul Landes [mailto:[email protected]]
>>>>> Sent: Saturday, April 30, 2011 3:33 PM
>>>>> To: [email protected][email protected]
>>>>> Cc: 'Jason McBrayer'; [email protected]
>>>>> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>>>>>
>>>>> Does this happen in other modes?  It sounds like an issue more
>>>>> related to font-lock.
>>>>>
>>>>> Do you have beanshell running while this is happening?  If so, kill
>>>>> the *JDEE bsh* buffer.
>>>>>
>>>>>
>>>>> On Apr 27, 2011, at 10:48 AM, <[email protected]>
>>>>> <[email protected]
>>>>>> wrote:
>>>>>
>>>>>> A little more futzing led me to another interesting observation:
>>>>>> it
>>>>>> seems to be related to file size.  A quick test on a few different
>>>>>> files only showed the coloring issues on files over ~700 lines.
>>>>>> Testing with a big file and a small file, it seems that the
>>>>>> _initial value for font-lock-keywords depends on the file size_!
>>>>>> When I load a small file, the font-lock-keywords variable get
>>>>>> init-ed to one value (let's call that value "A") in that buffer
>>>>>> and
>>>>>> the coloring is correct.  No amount of reverting of the buffer
>>>>>> changes the coloring or the value.  But, when I open a large file,
>>>>>> the initial coloring is wrong, and the value of font-lock-keywords
>>>>>> is _different_ (let's call that value "B").  when I revert the
>>>>>> large file, then the coloring is correct, and the
>>>>>> font-lock-keywords is now set to "A"
>>>>>> (and the coloring seems to stay correct through subsequent buffer
>>>>>> reverts).
>>>>>>
>>>>>> So, anyone have an idea when the font-lock-keywords variable may
>>>>>> get setup differently (at least initially) depending on buffer
>>>>>> size?
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: [email protected] [mailto:[email protected]] On Behalf
>>>>>> Of Jason McBrayer
>>>>>> Sent: Wednesday, April 27, 2011 10:07 AM
>>>>>> To: [email protected]
>>>>>> Cc: [email protected]
>>>>>> Subject: Re: [jdee-users] erratic font-lock behavior (emacs 23)
>>>>>>
>>>>>> On Tue, Apr 26, 2011 at 11:12 PM,
>>>>>> <[email protected]>
>>>>>> wrote:
>>>>>>> I'm not sure I understand what you are asking.  I've customized
>>>>>>> all my faces.  The issue isn't the face color, it's that the
>>>>>>> wrong
>>>>>>> faces are
>>>>>> being
>>>>>>> applied, seemingly due to the fact that the value of font-lock-
>>>>>>> keyworks changes over the lifetime of the buffer.
>>>>>>
>>>>>> Could it be that you are accidentally sometimes in java-mode, and
>>>>>> sometimes in jde-mode?  Could you C-h m and see which mode is
>>>>>> active when each set of faces is applied? I've tested and seen
>>>>>> that
>>>>>> java- mode and jde-mode do have different sets of faces.
>>>>>>
>>>>>> --
>>>>>> Jason F. McBrayer
>>>>>> http://jfm.carcosa.net/
>>>>>>
>>>>>>
>>>>>>
>>>>> --------------------------------------------------------------------
>>>>> -
>>>>> -
>>>>> ------
>>>>> --
>>>>>> WhatsUp Gold - Download Free Network Management Software The most
>>>>>> intuitive, comprehensive, and cost-effective network management
>>>>>> toolset available today.  Delivers lowest initial acquisition cost
>>>>>> and overall TCO of any competing solution.
>>>>>> http://p.sf.net/sfu/whatsupgold-sd
>>>>>> _______________________________________________
>>>>>> jdee-users mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/jdee-users
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>
>

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
jdee-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jdee-users

Reply via email to