# HG changeset patch # User Vinicius Jose Latorre # Date 1192067475 0 # Node ID eefadc1e1d5ee78caabbcaf55f853060084bd4fe # Parent 75646c5c257f08f8a4108c55cc3148f55d9389cb Fix :foreground and :background face attributes diff -r 75646c5c257f -r eefadc1e1d5e lisp/ChangeLog --- a/lisp/ChangeLog Thu Sep 20 07:51:47 2007 +0000 +++ b/lisp/ChangeLog Thu Oct 11 01:51:15 2007 +0000 @@ -1,3 +1,16 @@ +2007-10-10 Vinicius Jose Latorre + + * ps-print.el: Fix the usage of :foreground and :background face + attributes. Reported by Nikolaj Schumacher . + (ps-print-version): New version 7.2.5. + (ps-face-attributes, ps-face-attribute-list, ps-face-background): Fix + code. + (ps-face-foreground-color-p, ps-face-background-color-p) + (ps-face-color-p): New inline funs. + (ps-background, ps-begin-file, ps-build-reference-face-lists): Use + `mapc' rather than `mapcar'. + + 2007-08-29 Stefan Monnier * simple.el (invisible-p): Remove: implemented in C now. diff -r 75646c5c257f -r eefadc1e1d5e lisp/ps-print.el --- a/lisp/ps-print.el Thu Sep 20 07:51:47 2007 +0000 +++ b/lisp/ps-print.el Thu Oct 11 01:51:15 2007 +0000 @@ -10,11 +10,11 @@ ;; Maintainer: Kenichi Handa (multi-byte characters) ;; Vinicius Jose Latorre ;; Keywords: wp, print, PostScript -;; Version: 7.2.4 +;; Version: 7.2.5 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre -(defconst ps-print-version "7.2.4" - "ps-print.el, v 7.2.4 <2007/07/20 vinicius> +(defconst ps-print-version "7.2.5" + "ps-print.el, v 7.2.5 <2007/10/10 vinicius> Vinicius's last change version -- this file may have been edited as part of Emacs without changes to the version number. When reporting bugs, please also @@ -4814,15 +4814,15 @@ (defun ps-background (page-number) (let (has-local-background) - (mapcar #'(lambda (range) - (and (<= (aref range 0) page-number) - (<= page-number (aref range 1)) - (if has-local-background - (ps-output (aref range 2)) - (setq has-local-background t) - (ps-output "/printLocalBackground{\n" - (aref range 2))))) - ps-background-pages) + (mapc #'(lambda (range) + (and (<= (aref range 0) page-number) + (<= page-number (aref range 1)) + (if has-local-background + (ps-output (aref range 2)) + (setq has-local-background t) + (ps-output "/printLocalBackground{\n" + (aref range 2))))) + ps-background-pages) (and has-local-background (ps-output "}def\n")))) @@ -5458,7 +5458,7 @@ (ps-output "\n" ps-print-prologue-1 "\n/printGlobalBackground{\n") - (mapcar 'ps-output ps-background-all-pages) + (mapc 'ps-output ps-background-all-pages) (ps-output "}def\n/printLocalBackground{\n}def\n" "\n%%EndProlog\n\n%%BeginSetup\n" @@ -6091,6 +6091,18 @@ (ps-output " S\n"))) +(defsubst ps-face-foreground-color-p (attr) + (memq attr '(foreground-color :foreground))) + + +(defsubst ps-face-background-color-p (attr) + (memq attr '(background-color :background))) + + +(defsubst ps-face-color-p (attr) + (memq attr '(foreground-color :foreground background-color :background))) + + (defun ps-face-attributes (face) "Return face attribute vector. @@ -6114,9 +6126,9 @@ (setq ps-print-face-alist (cons new-face ps-print-face-alist))) new-face)))) - ((eq (car face) 'foreground-color) + ((ps-face-foreground-color-p (car face)) (vector 0 (cdr face) nil)) - ((eq (car face) 'background-color) + ((ps-face-background-color-p (car face)) (vector 0 nil (cdr face))) (t (vector 0 nil nil)))) @@ -6129,12 +6141,11 @@ ((symbolp face) (memq face ps-use-face-background)) ((listp face) - (or (memq (car face) '(foreground-color background-color)) + (or (ps-face-color-p (car face)) (let (ok) (while face (if (or (memq (car face) ps-use-face-background) - (memq (car face) - '(foreground-color background-color))) + (ps-face-color-p (car face))) (setq face nil ok t) (setq face (cdr face)))) @@ -6151,10 +6162,10 @@ ((not (listp face-or-list)) (ps-face-attributes face-or-list)) ;; only foreground color, not a `real' face - ((eq (car face-or-list) 'foreground-color) + ((ps-face-foreground-color-p (car face-or-list)) (vector 0 (cdr face-or-list) nil)) ;; only background color, not a `real' face - ((eq (car face-or-list) 'background-color) + ((ps-face-background-color-p (car face-or-list)) (vector 0 nil (cdr face-or-list))) ;; list of faces (t @@ -6209,10 +6220,10 @@ ;; Now, rebuild reference face lists (setq ps-print-face-alist nil) (if ps-auto-font-detect - (mapcar 'ps-map-face (face-list)) - (mapcar 'ps-set-face-bold ps-bold-faces) - (mapcar 'ps-set-face-italic ps-italic-faces) - (mapcar 'ps-set-face-underline ps-underlined-faces)) + (mapc 'ps-map-face (face-list)) + (mapc 'ps-set-face-bold ps-bold-faces) + (mapc 'ps-set-face-italic ps-italic-faces) + (mapc 'ps-set-face-underline ps-underlined-faces)) (setq ps-build-face-reference nil))