diff options
author | Pierre Courtieu <courtieu@lri.fr> | 2010-09-03 07:18:56 +0000 |
---|---|---|
committer | Pierre Courtieu <courtieu@lri.fr> | 2010-09-03 07:18:56 +0000 |
commit | 904953a4df7fc2598a46fb59f2737f411a1469d0 (patch) | |
tree | 1e4b1d5eba8c2ffda691f98fbe5a4057e9049840 /coq/coq-db.el | |
parent | c9bfe11b0664bd6478f4ae75b10004b5d20a0386 (diff) |
First fix of bug introduced by the last font-lock fix. Not finished.
Diffstat (limited to 'coq/coq-db.el')
-rw-r--r-- | coq/coq-db.el | 19 |
1 files changed, 18 insertions, 1 deletions
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. |