emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fontification-functions called for wrong buffer


From: James Clark
Subject: fontification-functions called for wrong buffer
Date: 01 Nov 2003 08:02:07 +0700

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))

James






reply via email to

[Prev in Thread] Current Thread [Next in Thread]