;;; emh-face.el --- header highlighting in emh.
-;; Copyright (C) 1997 MORIOKA Tomohiko
+;; Copyright (C) 1997,2000 Free Software Foundation, Inc.
-;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Author: MORIOKA Tomohiko <tomo@m17n.org>
;; Created: 1997/3/4
-;; Version: $Id: emh-face.el,v 0.3 1997-03-14 05:41:55 morioka Exp $
;; Keywords: header, highlighting
;; This file is part of emh.
;;; Code:
-(require 'emu)
+(require 'emh-def)
+(require 'std11)
(defsubst emh-set-face-foreground (face color)
- (condition-case err
+ (condition-case nil
(set-face-foreground face color)
- (error (message "Color `%s' is not found." color))
- ))
+ (error (message "Color `%s' is not found." color))))
(defsubst emh-make-face-bold (face)
- (condition-case err
- (make-face-bold face)
- (error (message "Can not make bold face `%s'." face))
- ))
+ (set-face-font face (face-font 'bold)))
(defsubst emh-make-face-italic (face)
- (condition-case err
- (make-face-bold face)
- (error (message "Can not make italic face `%s'." face))
- ))
+ (set-face-font face (face-font 'italic)))
(or (find-face 'from-field-body)
(progn
(med (match-end 0))
(end (std11-field-end))
(field-name (buffer-substring beg med))
- (rule (cdr (or (assoc-if (function
- (lambda (key)
- (and (stringp key)
- (string-match key field-name)
- )))
- emh-header-face)
- (assq t emh-header-face)
- )))
+ (rule (catch 'found
+ (let ((rest emh-header-face))
+ (while rest
+ (let* ((rule (car rest))
+ (key (car rule)))
+ (if (and (stringp key)
+ (string-match key field-name))
+ (throw 'found (cdr rule))
+ ))
+ (setq rest (cdr rest))
+ )
+ (cdr (assq t emh-header-face))
+ )))
)
(overlay-put (make-overlay beg med) 'face (car rule))
- (overlay-put (make-overlay med end) 'face (second rule))
+ (overlay-put (make-overlay med end) 'face (cadr rule))
)
(forward-char)
))