[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords
From: |
Klaus Zeitler |
Subject: |
(add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords |
Date: |
Fri, 02 Sep 2005 11:04:02 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (usg-unix-v) |
For a long time I've been using the simple show-tabs function below. With CVS
emacs I've noticed now that the same element gets appended to global
font-lock-keywords over and over again.
1. emacs -Q&
2. M-x global-font-lock-mode
3. in scratch buffer evaluate the following 2 expressions:
(defun show-tabs () "Show tabs with a slightly changed background"
(setq font-lock-keywords
(append font-lock-keywords '(("[\t]+" (0 'tab-face t))))))
(add-hook 'font-lock-mode-hook 'show-tabs)
4. in scratch buffer: C-h v font-lock-keywords
Local in buffer *scratch*; global value is
(("[ ]+"
(0 'tab-face t)))
5. every C-h v font-lock-keywords adds one more entry to global
font-lock-keywords
Value:
(t
(("[ ]+"
(0 'tab-face t)))
("[ ]+"
(0 'tab-face t)))
Moreover if I load e.g. a text file, then C-h v in that buffer will give me
something like:
Value:
(t
(("[ ]+"
(0 'tab-face t)))
("[ ]+"
(0 'tab-face t)))
Local in buffer x.txt; global value is
(("[ ]+"
(0 'tab-face t))
("[ ]+"
(0 'tab-face t))
("[ ]+"
(0 'tab-face t))
("[ ]+"
(0 'tab-face t))
("[ ]+"
(0 'tab-face t)))
--
------------------------------------------
| Klaus Zeitler Lucent Technologies |
| Email: address@hidden |
------------------------------------------
---
Why bother building any more nuclear warheads until we use the ones we have?
- (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords,
Klaus Zeitler <=