1 Nov 2003 02:02
fontification-functions called for wrong buffer
James Clark <jjc <at> jclark.com>
2003-11-01 01:02:07 GMT
2003-11-01 01:02:07 GMT
I have a mode that adds a function to fontification functions. It works
in 21.3 but not with the current CVS version. The problem is that in
the CVS version of emacs, when a buffer X has a function Y in its
fontification-functions variable (which is supposed to be automatically
buffer-local), Y gets called not just when the current buffer is X but
also when the current buffer is a minibuffer or an echo window. I can
easily work around this, but it seems like a bug to me.
If you eval the following, then do M-x my-fontify-start, and then M-x
my-fontify-end, you will see the problem. With 21.3, my-fontifier will
have been called for just one buffer; with the CVS version of emacs, it
will have been called for more than one.
(defvar my-fontified-buffers nil)
(defun my-fontifier (start)
(or (memq (current-buffer) my-fontified-buffers)
(setq my-fontified-buffers
(cons (current-buffer) my-fontified-buffers))))
(defun my-fontify-start ()
(interactive)
(setq my-fontified-buffers nil)
(add-hook 'fontification-functions 'my-fontifier))
(defun my-fontify-end ()
(interactive)
(remove-hook 'fontification-functions 'my-fontifier)
(message "Fontified buffers: %s" my-fontified-buffers))
(Continue reading)
RSS Feed