From 904953a4df7fc2598a46fb59f2737f411a1469d0 Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Fri, 3 Sep 2010 07:18:56 +0000 Subject: First fix of bug introduced by the last font-lock fix. Not finished. --- coq/coq-db.el | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'coq/coq-db.el') diff --git a/coq/coq-db.el b/coq/coq-db.el index 97e637eb..c8fd3f8a 100644 --- a/coq/coq-db.el +++ b/coq/coq-db.el @@ -92,13 +92,30 @@ regexp. See `coq-syntax-db' for DB structure." (let ((l db) res) (while l (let* ((hd (car l)) (tl (cdr l)) ; hd is the first infos list - (color (nth 4 hd))) ; colorization string + (color (concat "\\_<" (nth 4 hd) "\\_>"))) ; colorization string +; (color (nth 4 hd))) ; colorization string ;; TODO delete doublons (when (and color (or (not filter) (funcall filter hd))) (setq res (nconc res (list color)))) ; careful: nconc destructive! (setq l tl))) res)) +(defun coq-build-opt-regexp-from-db (db &optional filter) + "Take a keyword database DB and return a regexps for font-lock. +If non-nil Optional argument FILTER is a function applying to each line of DB. +For each line if FILTER returns nil, then the keyword is not added to the +regexp. See `coq-syntax-db' for DB structure." + (let ((l db) res) + (while l + (let* ((hd (car l)) (tl (cdr l)) ; hd is the first infos list + (color (nth 4 hd))) ; colorization string + ;; TODO delete doublons + (when (and color (or (not filter) (funcall filter hd))) + (setq res (nconc res (list color)))) ; careful: nconc destructive! + (setq l tl))) + (proof-ids-to-regexp res))) + + ;; Computes the max length of strings in a list (defun max-length-db (db) "Return the length of the longest first element (menu label) of DB. -- cgit v1.2.3