Andy Piper <andy(a)xemacs.org> writes:
diff -u -r184.108.40.206 font-lock.el
--- lisp/font-lock.el 2000/02/19 11:52:58 220.127.116.11
+++ lisp/font-lock.el 2000/02/26 21:18:28
Did you want to include this...?
-;; Author: Jamie Zawinski <jwz(a)jwz.org>, for the LISPM
+;; Author: Jamie Zawinski <jwz(a)netscape.com>, for the LISPM Preservation Society.
+;; <andy(a)xemacs.org> 12-10-99. This still does not work right,
+;; after change functions will still get us. The simplest thing to do
+;; is unconditionally turn-off font-lock before revert (and thus nuke
+;; all hooks) and then turn it on again afterwards. This also happens
+;; to be much faster because fontifying from scratch is better than
+;; trying to do incremental changes for the whole buffer.
+(defalias 'font-lock-revert-cleanup 'turn-on-font-lock)
+(defalias 'font-lock-revert-setup 'turn-off-font-lock)
Some comments (from a casual glance) about your specifier stuff. I
agree that the specifier stuff can be hard. (I had to debug
+;;; Gutter helper functions
+(defun set-gutter-element (gutter-specifier prop val &optional locale tag-set)
I don't think this is quite correct:
+ "Set GUTTER-SPECIFIER gutter element PROP to VAL in optional
+This is a convenience function for setting gutter elements."
+ (let ((spec-list (specifier-spec-list gutter-specifier locale tag-set)))
+ (if spec-list
+ (mapcar #'(lambda (spec)
+ (setcdr (car (cdr spec))
+ (plist-put (cdr (car (cdr spec)))
+ prop val))
Note that for each locale there is a LIST of cons pairs.
+ spec) spec-list)
You don't want to use 'remove-all, that would remove the spec-list
from other locales too. Just use nil, which will do the right thing.
+ (set-specifier gutter-specifier (list prop val) locale
I don't think this a good idea. You probably want to inherit the other
properties from the lower locales. You should call plist-put on the
(specifier-instance gutter-specifier locale tag-set) if locale is a domain.
You seem to be doing a partial reinvention on frob-face-property.
1. frob-face-property is ugly because the font specifier of a face is
combination of many properties (family, weight etc..). We now
recognize that we might have been better off if these properties
were independent specifiers. You should be maybe stop here and
consider whether you want to take this road. (If understand
correctly the number of elements in a gutter isn't fixed so this
would be not so easy.)
2. All your helper functions seem to be instances of the same
structure. Why not add a generalized version like this to
Untested but obvious[ahem].
(defun modify-specifier-instances (specifier func &optional args force default
"Modify all specifications that match LOCALE and TAG-SET by FUNC.
For each specification that exists for SPECIFIER, in locale LOCALE that matches
TAG-SET, call the function FUNC with the instance as its first argument and
with optional arguments ARGS. The result is then used as the new value
of the instantiator.
If there is no specification in the domain LOCALE matching TAG-SET and FORCE is
non-nil, an explicit one is created from the matching specifier instance if
that exists or DEFAULT otherwise. If LOCALE is not a domain (i.e. a buffer),
DEFAULT is always used. FUNC is then applied like above and the
resulting specification is added."
(let ((spec-list (specifier-spec-list specifier locale tag-set)))
;; Distructively edit the spec-list
(mapc #'(lambda (spec)
(mapc #'(lambda (inst-pair)
(apply func (cdr inst-pair) args)))
(or (and (valid-specifier-domain-p locale)
Then your function can be rewritten as
;;; Gutter helper functions
(defun set-gutter-element (gutter-specifier prop val &optional locale tag-set)
"Set GUTTER-SPECIFIER gutter element PROP to VAL in optional LOCALE.
This is a convenience function for setting gutter elements."
(modify-specifier-instances gutter-specifier #'plist-put (list prop val)
'force nil locale tag-set))
(defun remove-gutter-element (gutter-specifier prop &optional locale tag-set)
"Remove gutter element PROP from GUTTER-SPECIFIER in optional LOCALE.
This is a convenience function for removing gutter elements."
(modify-specifier-instances gutter-specifier #'plist-remprop (list prop)
'force nil locale tag-set))
(defun set-gutter-element-visible-p (gutter-specifier
prop &optional visible-p
"Make gutter element PROP VISIBLE-P for GUTTER-SPECIFIER in optional LOCALE.
This is a convenience function for hiding and showing gutter elements."
I don't quite understand what this function is doing.
I hope this helps. I need some sleep.