comparison lisp/enriched.el @ 44376:b5dd3758c750

(enriched-face-ans): Delete special treatment for fg:... and bg:... faces. (enriched-decode-foreground): Return a list that specifies the foreground color, rather than creating a face. (enriched-decode-background): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Wed, 03 Apr 2002 15:28:45 +0000
parents aff7bdba6572
children 4c958bb71cb6
comparison
equal deleted inserted replaced
44375:a00feef20f38 44376:b5dd3758c750
345 (list (list "x-color" (cadr face)))) 345 (list (list "x-color" (cadr face))))
346 ((and (listp face) (eq (car face) :background)) 346 ((and (listp face) (eq (car face) :background))
347 (list (list "x-bg-color" (cadr face)))) 347 (list (list "x-bg-color" (cadr face))))
348 ((listp face) 348 ((listp face)
349 (apply 'append (mapcar 'enriched-face-ans face))) 349 (apply 'append (mapcar 'enriched-face-ans face)))
350 ((string-match "^fg:" (symbol-name face))
351 (list (list "x-color" (substring (symbol-name face) 3))))
352 ((string-match "^bg:" (symbol-name face))
353 (list (list "x-bg-color" (substring (symbol-name face) 3))))
354 ((let* ((fg (face-attribute face :foreground)) 350 ((let* ((fg (face-attribute face :foreground))
355 (bg (face-attribute face :background)) 351 (bg (face-attribute face :background))
356 (props (face-font face t)) 352 (props (face-font face t))
357 (ans (cdr (format-annotate-single-property-change 353 (ans (cdr (format-annotate-single-property-change
358 'face nil props enriched-translations)))) 354 'face nil props enriched-translations))))
434 (delete-region (point) (match-end 0))) 430 (delete-region (point) (match-end 0)))
435 (if (looking-at "^\n") 431 (if (looking-at "^\n")
436 (delete-char 1))) 432 (delete-char 1)))
437 433
438 (defun enriched-decode-foreground (from to &optional color) 434 (defun enriched-decode-foreground (from to &optional color)
439 (let ((face (intern (concat "fg:" color)))) 435 (if (and color (display-color-p) (facemenu-get-face face))
440 (cond ((null color) 436 (list from to 'face (cons ':foreground color))
441 (message "Warning: no color specified for <x-color>")) 437 (if (null color)
442 ((facep face)) 438 (message "Warning: no color specified for <x-color>")
443 ((and (display-color-p) (facemenu-get-face face)) 439 (message "Warning: color `%s' can't be displayed" color))
444 (set-face-foreground face color)) 440 nil))
445 ((make-face face)
446 (message "Warning: color `%s' can't be displayed" color)))
447 (list from to 'face face)))
448 441
449 (defun enriched-decode-background (from to &optional color) 442 (defun enriched-decode-background (from to &optional color)
450 (let ((face (intern (concat "bg:" color)))) 443 (if (and color (display-color-p) (facemenu-get-face face))
451 (cond ((null color) 444 (list from to 'face (cons ':background color))
452 (message "Warning: no color specified for <x-bg-color>")) 445 (if (null color)
453 ((facep face)) 446 (message "Warning: no color specified for <x-bg-color>")
454 ((and (display-color-p) (facemenu-get-face face)) 447 (message "Warning: color `%s' can't be displayed" color))
455 (set-face-background face color)) 448 nil))
456 ((make-face face)
457 (message "Warning: color `%s' can't be displayed" color)))
458 (list from to 'face face)))
459
460
461 449
462 ;;; Handling the `display' property. 450 ;;; Handling the `display' property.
463 451
464 452
465 (defun enriched-handle-display-prop (old new) 453 (defun enriched-handle-display-prop (old new)