Mercurial > emacs
comparison lisp/enriched.el @ 30456:597562b7a8c6
(enriched-face-ans): For a `foreground-color'
property, return '(("x-color" COLOR))' so that COLOR will be
output as a parameter of the x-color annotation. Likewise for the
`background-color' property. In the case of normal face
properties, don't return annotations for unspecified foreground
and background face attributes.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 25 Jul 2000 16:05:25 +0000 |
parents | 2ec1f9510791 |
children | a97dcc26018d |
comparison
equal
deleted
inserted
replaced
30455:1130a792b2f7 | 30456:597562b7a8c6 |
---|---|
347 (and new (enriched-face-ans new)))) | 347 (and new (enriched-face-ans new)))) |
348 | 348 |
349 (defun enriched-face-ans (face) | 349 (defun enriched-face-ans (face) |
350 "Return annotations specifying FACE." | 350 "Return annotations specifying FACE." |
351 (cond ((and (consp face) (eq (car face) 'foreground-color)) | 351 (cond ((and (consp face) (eq (car face) 'foreground-color)) |
352 (list "x-color" (cdr face))) | 352 (list (list "x-color" (cdr face)))) |
353 ((and (consp face) (eq (car face) 'background-color)) | 353 ((and (consp face) (eq (car face) 'background-color)) |
354 (list "x-bg-color" (cdr face))) | 354 (list (list "x-bg-color" (cdr face)))) |
355 ((string-match "^fg:" (symbol-name face)) | 355 ((string-match "^fg:" (symbol-name face)) |
356 (list (list "x-color" (substring (symbol-name face) 3)))) | 356 (list (list "x-color" (substring (symbol-name face) 3)))) |
357 ((string-match "^bg:" (symbol-name face)) | 357 ((string-match "^bg:" (symbol-name face)) |
358 (list (list "x-bg-color" (substring (symbol-name face) 3)))) | 358 (list (list "x-bg-color" (substring (symbol-name face) 3)))) |
359 ((let* ((fg (face-foreground face)) | 359 ((let* ((fg (face-foreground face)) |
360 (bg (face-background face)) | 360 (bg (face-background face)) |
361 (props (face-font face t)) | 361 (props (face-font face t)) |
362 (ans (cdr (format-annotate-single-property-change | 362 (ans (cdr (format-annotate-single-property-change |
363 'face nil props enriched-translations)))) | 363 'face nil props enriched-translations)))) |
364 (if fg (setq ans (cons (list "x-color" fg) ans))) | 364 (unless (eq fg 'unspecified) |
365 (if bg (setq ans (cons (list "x-bg-color" bg) ans))) | 365 (setq ans (cons (list "x-color" fg) ans))) |
366 (unless (eq bg 'unspecified) | |
367 (setq ans (cons (list "x-bg-color" bg) ans))) | |
366 ans)))) | 368 ans)))) |
367 | 369 |
368 ;;; | 370 ;;; |
369 ;;; Decoding files | 371 ;;; Decoding files |
370 ;;; | 372 ;;; |