[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch for sql.el
Re: Patch for sql.el
04 May 2004 17:59:49 -0400
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50
> I did a little testing and made some adjustments. Sql.el is a little
> different from most modes -- the keywords are dependent upon the setting
> of a buffer local variable (`sql-product'). It is therefore possible that
> the font-lock settings may change after the buffer has been fontified.
> I addressed this by setting the variable `font-lock-set-defaults' to nil
> when `font-lock-defaults' is changed. If `font-lock-mode' is active,
> I call `font-lock-mode-internal' to turn it off and then call it again
> to restore font-lock with the new settings.
Hmm... that's bad. I guess the "cleanest" way to do it with the current
font-lock.el code would be to only put the ANSI patterns on
sql-font-lock-keywords and then use font-lock-add-keywords and
font-lock-remove-keywords for the product-specific patterns
(and call font-lock-fontify-buffer to refresh the buffer).
But that does not allow you to play with the syntax-alist property.
The problem with the current code is that not only you're using internal
font-lock variables and functions, but you end up throwing away keywords
that might have been added by a minor-mode (such as smerge-mode).
This is an other area of font-lock which is just very unsatisfactory
right now. I think most major modes work around this by using a single set
of keywords which covers all cases (which of course is only workable if
there is no conflict/ambiguity).
In the mean time, I installed your patch.
PS: the `Products' menu could be generated dynamically.
PPS: BTW, I thought I'd sent you a patch about it, but I must have dreamt
it, so here it is finally: clean up the "system-flag" handling in
abbrev-table as follows:
'(("ins" "insert" nil nil t)
("upd" "update" nil nil t)
("del" "delete" nil nil t)
("sel" "select" nil nil t)
("proc" "procedure" nil nil t)
("func" "function" nil nil t)
("cr" "create" nil nil t))))