Thank you for advising about font-lock issue.

I've found following comments in font-core.el of GNU Emacs in CVS:

  ;;; Global Font Lock mode.

  ;; A few people have hassled in the past for a way to make it easier to turn 
on
  ;; Font Lock mode, without the user needing to know for which modes s/he has 
to
  ;; turn it on, perhaps the same way hilit19.el/hl319.el does.  I've always
  ;; balked at that way, as I see it as just re-moulding the same problem in
  ;; another form.  That is; some person would still have to keep track of which
  ;; modes (which may not even be distributed with Emacs) support Font Lock 
mode.
  ;; The list would always be out of date.  And that person might have to be me.

  ;; Implementation.
  ;;
  ;; In a previous discussion the following hack came to mind.  It is a gross
  ;; hack, but it generally works.  We use the convention that major modes start
  ;; by calling the function `kill-all-local-variables', which in turn runs
  ;; functions on the hook variable `change-major-mode-hook'.  We attach our
  ;; function `font-lock-change-major-mode' to that hook.  Of course, when this
  ;; hook is run, the major mode is in the process of being changed and we do 
not
  ;; know what the final major mode will be.  So, `font-lock-change-major-mode'
  ;; only (a) notes the name of the current buffer, and (b) adds our function
  ;; `turn-on-font-lock-if-enabled' to the hook variables `find-file-hook' and
  ;; `post-command-hook' (for buffers that are not visiting files).  By the time
  ;; the functions on the first of these hooks to be run are run, the new major
  ;; mode is assumed to be in place.  This way we get a Font Lock function run
  ;; when a major mode is turned on, without knowing major modes or their hooks.
  ;;
  ;; Naturally this requires that (a) major modes run 
`kill-all-local-variables',
  ;; as they are supposed to do, and (b) the major mode is in place after the
  ;; file is visited or the command that ran `kill-all-local-variables' has
  ;; finished, whichever the sooner.  Arguably, any major mode that does not
  ;; follow the convension (a) is broken, and I can't think of any reason why 
(b)
  ;; would not be met (except `gnudoit' on non-files).  However, it is not 
clean.
...

So if we use font-lock thought tla--face-add and font-lock-keyword, I thought we
should use:

       1. font-lock-face text property
       2. kill-all-local-variables

However, if we don't use font-lock in inventory buffer, I wonder what should
I do. I have to rething after reading your mail carefully.

Reply via email to