[Top][All Lists]

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

Checking for safe font-lock keywords and hi-lock mode.

From: David Koppelman
Subject: Checking for safe font-lock keywords and hi-lock mode.
Date: Thu, 19 Apr 2007 10:42:42 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

Is there any way to check whether font-lock keywords are safe? For
example, such a function might be named font-lock-pattern-safe and
used in the code below, where patterns might contain malicious code:

(font-lock-add-keywords nil
  (apply 'append
    (lambda (p) (if (font-lock-pattern-safe-p p) (list p) nil)) 
    patterns))) )

A return of true would mean safe, nil would mean maybe dangerous.

My immediate concern is hi-lock and I would use such a function in
hi-lock-find-patterns. (This automatically grabs font lock patterns
from a file.) If no such function is available right now then
hi-lock-find-patterns should be off by default and if on should ask. I
can have a patch ready by Friday either safe checking (if possible) or
else using some mixture of configuration setting, user input and

reply via email to

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