all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords
@ 2005-09-02  9:04 Klaus Zeitler
  2005-09-02 14:34 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Klaus Zeitler @ 2005-09-02  9:04 UTC (permalink / raw)



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:             kzeitler@lucent.com  |
 ------------------------------------------
---
Why bother building any more nuclear warheads until we use the ones we have?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-05 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02  9:04 (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords Klaus Zeitler
2005-09-02 14:34 ` Stefan Monnier
2005-09-05  8:58   ` Klaus Zeitler
2005-09-05 15:54     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.