From f1be615c41027bfc11425c9e62598bc25fa323e1 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 16 Sep 2012 12:31:02 +0800 Subject: [PATCH] Alter last change to be compatible with Emacs 23. * lisp/progmodes/compile.el (compilation-parse-errors): Accept list values similar to font-lock-keywords. Suggested by Oleksandr Manzyuk. (compilation-error-regexp-alist): Doc fix. Fixes: debbugs:12136 --- lisp/ChangeLog | 5 +++-- lisp/progmodes/compile.el | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9d5f70eb224..2d2ff692309 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,8 @@ 2012-09-16 Chong Yidong - * progmodes/compile.el (compilation-parse-errors): Apply any value - that is a valid font-lock-face property (Bug#12136). + * progmodes/compile.el (compilation-parse-errors): Accept list + values similar to font-lock-keywords (Bug#12136). Suggested by + Oleksandr Manzyuk. (compilation-error-regexp-alist): Doc fix. 2012-09-15 Glenn Morris diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ae2f6973fa5..f5dedf0cd59 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -490,8 +490,10 @@ matched by the whole REGEXP becomes the hyperlink. Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where SUBMATCH is the number of a submatch and FACE is an expression -which evaluates to a face (more precisely, a valid value for the -`font-lock-face' property) for highlighting the submatch." +which evaluates to a face name (a symbol or string). +Alternatively, FACE can evaluate to a property list of the +form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the +listed text properties PROP# are given values VAL# as well." :type '(repeat (choice (symbol :tag "Predefined symbol") (sexp :tag "Error specification"))) :link `(file-link :tag "example file" @@ -1329,18 +1331,27 @@ to `compilation-error-regexp-alist' if RULES is nil." (compilation--put-prop end-col 'font-lock-face compilation-column-face) + ;; Obey HIGHLIGHT. (dolist (extra-item (nthcdr 6 item)) (let ((mn (pop extra-item))) (when (match-beginning mn) (let ((face (eval (car extra-item)))) (cond ((null face)) - ((or (symbolp face) - (stringp face) - (listp face)) + ((or (symbolp face) (stringp face)) (put-text-property (match-beginning mn) (match-end mn) 'font-lock-face face)) + ((and (listp face) + (eq (car face) 'face) + (or (symbolp (cadr face)) + (stringp (cadr face)))) + (put-text-property + (match-beginning mn) (match-end mn) + 'font-lock-face (cadr face)) + (add-text-properties + (match-beginning mn) (match-end mn) + (nthcdr 2 face))) (t (error "Don't know how to handle face %S" face))))))) -- 2.11.4.GIT