>>         ;; to a buffer belonging to another.
>>         (make-local-hook 'post-command-hook)

>Hmm, I don't think I need the above form because the add-hook form below
>makes the variable local anyway.

Indeed.

> >         (add-hook 'post-command-hook
> >                   'jde-detect-java-buffer-activation nil t)
> > 
> >  
> > This is the code from `jde-mode' (JDEE 2.3.4beta3).
>This should work even if the "from" buffer is not a jde-mode buffer. Are
>you saying that it doesn't?

Yes, i'm saying this - and it can not work in other modes:
This add-hook is called when `jde-mode' is called which is only called when a buffer X 
is opened which is "linked" to jde-mode. And because you add the function LOCALLY to 
post-command-hook only the local value (local in buffer X) contains this function - 
the global value of post-command-hook doesn't. Therefore this works only in 
jde-buffers - which is suboptimal IMHO ;-)

>Then the hook function would run in buffers that are not jde-mode
>buffers? This seemed a waste
>of processing cycles to me when I wrote the code.

No.
1. It should run in other mode buffers
2. You are right, that then the check if the current-buffer is running 
   jde-mode would be processed after each command in each buffer but this 
   is really not a problem - A powerful Emacs-setup contains some functions 
   in post-command-hook and this is not a problem if these funtions are 
   well designed, i.e. do their task only if needed and check this with a 
   efficient condition - and (equal major-mode 'jde-mode) is very efficient 
   ;-)

Thoughts?

>I will try to make the doc clearer on these issues.

Would be better to fix the things above ;-)

>jde-entering-java-buffer-hook functions are supposed to run whenever the
>user activates a jde-mode buffer,
>regardless of the mode of the previously active buffer. As far as I
>know, it works correctly and that
>is easily verifiable. Are you saying that the hook functions are not
>being run when a jde-mode buffer
>is entered from a buffer that is operating in a different mode?

Yes, indeed! See above...

Klaus

Reply via email to