unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ps-print-color-p and the background colour of Emacs' frame
@ 2007-07-05 20:22 Christian Schlauer
  2007-07-20 17:31 ` Vinicius Jose Latorre
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Schlauer @ 2007-07-05 20:22 UTC (permalink / raw)
  To: emacs-devel

Observed with Emacs 22.1:

- emacs -q --no-site-file

- M-x set-background-color RET LightSkyBlue RET

- C-u M-x ps-print-buffer-with-faces RET RET

If I open that file with a PostScript viewer (Evince in Ubuntu 7.04),
there is no background colour in the text area. If I now *repeat*

- C-u M-x ps-print-buffer-with-faces RET RET

and open the file again, you'll see that the background of the text
area is in the colour LightSkyBlue, too.

===> Why *isn't* the background colour in the file when it is saved
     for the first time? Bug?

Now do

- M-x set-variable RET ps-print-color-p RET nil RET

- C-u M-x ps-print-buffer-with-faces RET RET

Open the file: background is blue, but text is black. Now simply repeat

- C-u M-x ps-print-buffer-with-faces RET RET

Open the file: background is white, text is black.

===> Why *is* the background colour in the file when it is saved for
     the *first* time? It shouldn't, see the description of
     ps-default-bg below. Bug?

Now do

- M-x set-variable RET ps-print-color-p RET black-white RET

- C-u M-x ps-print-buffer-with-faces RET RET

Open the file: background is white, text is black and italic, as
expected. Now simply repeat

- C-u M-x ps-print-buffer-with-faces RET RET

Open the file: background is blue -- WHY?

===> Why *is* the background colour in the file when it is saved for
     the second time? Bug?

,----[ C-h v ps-default-bg RET ]

[...]

| The `ps-default-bg' variable contains the default background color
| used by ps-print, that is, if there is a face in a text that doesn't
| have a background color, the `ps-default-bg' color should be used.

[...]

| It's used only when `ps-print-color-p' is non-nil.
| 
| See also `ps-use-face-background'.
| 
| You can customize this variable.
| 
| [back]
`----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-07-05 20:22 ps-print-color-p and the background colour of Emacs' frame Christian Schlauer
@ 2007-07-20 17:31 ` Vinicius Jose Latorre
  2007-07-23 18:54   ` Christian Schlauer
  0 siblings, 1 reply; 9+ messages in thread
From: Vinicius Jose Latorre @ 2007-07-20 17:31 UTC (permalink / raw)
  To: cs-usenet; +Cc: emacs-devel

Hi Christian,


Sorry for this delay, I'm very short in time now.

I've just updated Emacs CVS trunk and EMACS 23, but not EMACS 22 BRANCH 
(should I?).

Could you, please, test it again in your environment?


Thanks for your report,


Vinicius

PS: I fixed the problems below and also set ps-default-fg and 
ps-default-bg to nil, so the default colors are black for foreground and 
white for background.


Christian Schlauer wrote:
> Observed with Emacs 22.1:
>
> - emacs -q --no-site-file
>
> - M-x set-background-color RET LightSkyBlue RET
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> If I open that file with a PostScript viewer (Evince in Ubuntu 7.04),
> there is no background colour in the text area. If I now *repeat*
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> and open the file again, you'll see that the background of the text
> area is in the colour LightSkyBlue, too.
>
> ===> Why *isn't* the background colour in the file when it is saved
>      for the first time? Bug?
>
> Now do
>
> - M-x set-variable RET ps-print-color-p RET nil RET
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> Open the file: background is blue, but text is black. Now simply repeat
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> Open the file: background is white, text is black.
>
> ===> Why *is* the background colour in the file when it is saved for
>      the *first* time? It shouldn't, see the description of
>      ps-default-bg below. Bug?
>
> Now do
>
> - M-x set-variable RET ps-print-color-p RET black-white RET
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> Open the file: background is white, text is black and italic, as
> expected. Now simply repeat
>
> - C-u M-x ps-print-buffer-with-faces RET RET
>
> Open the file: background is blue -- WHY?
>
> ===> Why *is* the background colour in the file when it is saved for
>      the second time? Bug?
>
> ,----[ C-h v ps-default-bg RET ]
>
> [...]
>
> | The `ps-default-bg' variable contains the default background color
> | used by ps-print, that is, if there is a face in a text that doesn't
> | have a background color, the `ps-default-bg' color should be used.
>
> [...]
>
> | It's used only when `ps-print-color-p' is non-nil.
> | 
> | See also `ps-use-face-background'.
> | 
> | You can customize this variable.
> | 
> | [back]
> `----
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-07-20 17:31 ` Vinicius Jose Latorre
@ 2007-07-23 18:54   ` Christian Schlauer
  2007-07-25 15:22     ` Vinicius Jose Latorre
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Schlauer @ 2007-07-23 18:54 UTC (permalink / raw)
  To: emacs-devel

Hello Vinicius!

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> Sorry for this delay, I'm very short in time now.

No problem at all! Thanks for looking at it!

> I've just updated Emacs CVS trunk and EMACS 23, but not EMACS 22
> BRANCH (should I?).
>
> Could you, please, test it again in your environment?

I'm still using Emacs 22.1 -- I'll test it "soon" ;-)

> PS: I fixed the problems below and also set ps-default-fg and
> ps-default-bg to nil, so the default colors are black for foreground
> and white for background.

Richard wrote in <news:E1IA7J5-00007L-Ik@fencepost.gnu.org>
(alternatively available at
<http://permalink.gmane.org/gmane.emacs.devel/74824>) that he has
installed a change for ps-default-bg in Emacs 22. I guess that might
lead to a merge conflict as you've modified the other branches.

-- 
Christian Schlauer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-07-23 18:54   ` Christian Schlauer
@ 2007-07-25 15:22     ` Vinicius Jose Latorre
  2007-08-05 20:19       ` Christian Schlauer
  0 siblings, 1 reply; 9+ messages in thread
From: Vinicius Jose Latorre @ 2007-07-25 15:22 UTC (permalink / raw)
  To: cs-usenet; +Cc: emacs-devel

Christian Schlauer wrote:
>
>> I've just updated Emacs CVS trunk and EMACS 23, but not EMACS 22
>> BRANCH (should I?).
>>
>> Could you, please, test it again in your environment?
>>     
>
> I'm still using Emacs 22.1 -- I'll test it "soon" ;-)
>   

Ok, please, let me know the results of your tests.


>> PS: I fixed the problems below and also set ps-default-fg and
>> ps-default-bg to nil, so the default colors are black for foreground
>> and white for background.
>>     
>
> Richard wrote in <news:E1IA7J5-00007L-Ik@fencepost.gnu.org>
> (alternatively available at
> <http://permalink.gmane.org/gmane.emacs.devel/74824>) that he has
> installed a change for ps-default-bg in Emacs 22. I guess that might
> lead to a merge conflict as you've modified the other branches.

Well, now there is no conflict, Richard said to commit these fixes in 
EMACS 22 BRANCH.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-07-25 15:22     ` Vinicius Jose Latorre
@ 2007-08-05 20:19       ` Christian Schlauer
  2007-08-05 20:38         ` Vinicius Jose Latorre
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Schlauer @ 2007-08-05 20:19 UTC (permalink / raw)
  To: emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> Christian Schlauer wrote:

[...]

>> I'm still using Emacs 22.1 -- I'll test it "soon" ;-)
>>   
>
> Ok, please, let me know the results of your tests.

I updated my EMACS_22_BASE checkout and did

emacs -q --no-site-file

C-u M-x ps-print-buffer-with-faces RET C-g

M-x set-variable RET ps-default-bg RET frame-parameter RET

The last line is necessary in Emacs 22.1.50 as `ps-default-bg' is nil
now by default (as you wrote):

>>> PS: I fixed the problems below and also set ps-default-fg and
>>> ps-default-bg to nil, so the default colors are black for foreground
>>> and white for background.

Then I repeated the test sequences mentioned in my original posting.
Everything works as expected: the background of the PS files is white
_unless_ I set `ps-default-bg' to `frame-parameter' _and_
`ps-print-color-p' is t (the default). Thank you!

There is only an inaccurate doc string:

,----[ C-h v ps-default-bg RET ]
| It's used only when `ps-print-color-p' is non-nil.
`----

Correct is "It's used only when `ps-print-color-p' is not nil or
black-white." -- see below:

,----[ C-h v ps-print-color-p RET ]
| ps-print-color-p is a variable defined in `ps-print.el'.
| Its value is t
| 
| 
| Documentation:
| *Specify how buffer's text color is printed.
| 
| Valid values are:
| 
|    nil		Do not print colors.
| 
|    t		Print colors.
| 
|    black-white	Print colors on black/white printer.
| 		See also `ps-black-white-faces'.
| 
| Any other value is treated as t.
| 
| You can customize this variable.
`----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-08-05 20:19       ` Christian Schlauer
@ 2007-08-05 20:38         ` Vinicius Jose Latorre
  2007-08-07 21:44           ` Christian Schlauer
  0 siblings, 1 reply; 9+ messages in thread
From: Vinicius Jose Latorre @ 2007-08-05 20:38 UTC (permalink / raw)
  To: cs-usenet; +Cc: emacs-devel

Christian Schlauer wrote:
> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>
>   
>> Christian Schlauer wrote:
>>     
>
> [...]
>
>   
>>> I'm still using Emacs 22.1 -- I'll test it "soon" ;-)
>>>   
>>>       
>> Ok, please, let me know the results of your tests.
>>     
>
> I updated my EMACS_22_BASE checkout and did
>
> emacs -q --no-site-file
>
> C-u M-x ps-print-buffer-with-faces RET C-g
>
> M-x set-variable RET ps-default-bg RET frame-parameter RET
>
> The last line is necessary in Emacs 22.1.50 as `ps-default-bg' is nil
> now by default (as you wrote):
>
>   
>>>> PS: I fixed the problems below and also set ps-default-fg and
>>>> ps-default-bg to nil, so the default colors are black for foreground
>>>> and white for background.
>>>>         
>
> Then I repeated the test sequences mentioned in my original posting.
> Everything works as expected: the background of the PS files is white
> _unless_ I set `ps-default-bg' to `frame-parameter' _and_
> `ps-print-color-p' is t (the default). Thank you!
>   

Ok.


> There is only an inaccurate doc string:
>
> ,----[ C-h v ps-default-bg RET ]
> | It's used only when `ps-print-color-p' is non-nil.
> `----
>
> Correct is "It's used only when `ps-print-color-p' is not nil or
> black-white." -- see below:
>   

Humm, isn't black-white a non-nil (not nil) value?


> ,----[ C-h v ps-print-color-p RET ]
> | ps-print-color-p is a variable defined in `ps-print.el'.
> | Its value is t
> | 
> | 
> | Documentation:
> | *Specify how buffer's text color is printed.
> | 
> | Valid values are:
> | 
> |    nil		Do not print colors.
> | 
> |    t		Print colors.
> | 
> |    black-white	Print colors on black/white printer.
> | 		See also `ps-black-white-faces'.
> | 
> | Any other value is treated as t.
> | 
> | You can customize this variable.
> `----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-08-05 20:38         ` Vinicius Jose Latorre
@ 2007-08-07 21:44           ` Christian Schlauer
  2007-08-08 16:42             ` Vinicius Jose Latorre
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Schlauer @ 2007-08-07 21:44 UTC (permalink / raw)
  To: emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

> Christian Schlauer wrote:

[...]

>> There is only an inaccurate doc string:
>>
>> ,----[ C-h v ps-default-bg RET ]
>> | It's used only when `ps-print-color-p' is non-nil.
>> `----
>>
>> Correct is "It's used only when `ps-print-color-p' is not nil or
>> black-white." -- see below:
>>   
>
> Humm, isn't black-white a non-nil (not nil) value?
>
>
>> ,----[ C-h v ps-print-color-p RET ]
>> | ps-print-color-p is a variable defined in `ps-print.el'.
>> | | Valid values are:
>> | |    nil		Do not print colors.
>> | |    t		Print colors.
>> | |    black-white	Print colors on black/white printer.
>> | | Any other value is treated as t.
>> | | You can customize this variable.
>> `----

`black-white' is a non-nil value, but ps-default-bg isn't used when
ps-print-color-p is `black-white' -- the following is tested with
Emacs 22.1.50:

| ps-print-color-p | Background colour in PS file when    |
|                  | `ps-default-bg' is `frame-parameter? |
|------------------+--------------------------------------|
| t                | yes                                  |
| black-white      | no                                   |
| nil              | no                                   |

So the doc-string of ps-default-bg *could* say "It is used iff
`ps-print-color-p' is t."

But there is this nasty "Any other value is treated as t." in the
doc-string of ps-print-color-p, as quoted above. That suggests that
the only way to *avoid* the background colour in the PS file is to set
ps-print-color-p to `nil' or `black-white' -- if I set it to `foo',
that would be treated as t according to the doc-string. That's why I
ended up with the above formulation. My suggestions are:

1. Either write "It is used unless `ps-print-color-p' is nil or
   black-white." in the doc-string of ps-default-bg (I tested that,
   see the table above) or

2. get rid of the "Any other value is treated as t." in the doc-string
   of ps-print-color-p.

It seems to me that (2) makes most sense: I can't seem to set
ps-print-color-p to anything else than t/black-white/nil. I tried

M-x set-variable RET ps-print-color-p RET foo RET

and

M-x set-variable RET ps-print-color-p RET 4 RET

but that doesn't work. And

M-x customize-variable RET ps-print-color-p RET

shows a `Value Menu' consisting of t/black-white/nil. So how could the
user set it to any other value?

-- 
Christian Schlauer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-08-07 21:44           ` Christian Schlauer
@ 2007-08-08 16:42             ` Vinicius Jose Latorre
  2007-08-18  7:50               ` Christian Schlauer
  0 siblings, 1 reply; 9+ messages in thread
From: Vinicius Jose Latorre @ 2007-08-08 16:42 UTC (permalink / raw)
  To: cs-usenet; +Cc: emacs-devel

Christian Schlauer wrote:
> Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:
>   
>> Christian Schlauer wrote:
>
> [...]
>   
>>> There is only an inaccurate doc string:
>>>
>>> ,----[ C-h v ps-default-bg RET ]
>>> | It's used only when `ps-print-color-p' is non-nil.
>>> `----
>>>
>>> Correct is "It's used only when `ps-print-color-p' is not nil or
>>> black-white." -- see below:
>>>       
>> Humm, isn't black-white a non-nil (not nil) value?
>>
>>     
>>> ,----[ C-h v ps-print-color-p RET ]
>>> | ps-print-color-p is a variable defined in `ps-print.el'.
>>> | | Valid values are:
>>> | |    nil		Do not print colors.
>>> | |    t		Print colors.
>>> | |    black-white	Print colors on black/white printer.
>>> | | Any other value is treated as t.
>>> | | You can customize this variable.
>>> `----
>>>       
>
> `black-white' is a non-nil value, but ps-default-bg isn't used when
> ps-print-color-p is `black-white' -- the following is tested with
> Emacs 22.1.50:
>
> | ps-print-color-p | Background colour in PS file when    |
> |                  | `ps-default-bg' is `frame-parameter? |
> |------------------+--------------------------------------|
> | t                | yes                                  |
> | black-white      | no                                   |
> | nil              | no                                   |
>
> So the doc-string of ps-default-bg *could* say "It is used iff
> `ps-print-color-p' is t."
>   

Ok, now I see what you mean.

I've just updated ps-print.el in trunk, Emacs 22 branch and Emacs 
Unicode branch.

Now ps-default-bg and ps-default-fg has:

    This variable is used only when `ps-print-color-p' (which see) is 
neither nil
    nor black-white.

> But there is this nasty "Any other value is treated as t." in the
> doc-string of ps-print-color-p, as quoted above. That suggests that
> the only way to *avoid* the background colour in the PS file is to set
> ps-print-color-p to `nil' or `black-white' -- if I set it to `foo',
> that would be treated as t according to the doc-string. That's why I
> ended up with the above formulation. My suggestions are:
>
> 1. Either write "It is used unless `ps-print-color-p' is nil or
>    black-white." in the doc-string of ps-default-bg (I tested that,
>    see the table above) or
>
> 2. get rid of the "Any other value is treated as t." in the doc-string
>    of ps-print-color-p.
>
> It seems to me that (2) makes most sense: I can't seem to set
> ps-print-color-p to anything else than t/black-white/nil. I tried
>
> M-x set-variable RET ps-print-color-p RET foo RET
>
> and
>
> M-x set-variable RET ps-print-color-p RET 4 RET
>
> but that doesn't work. And
>
> M-x customize-variable RET ps-print-color-p RET
>
> shows a `Value Menu' consisting of t/black-white/nil. So how could the
> user set it to any other value? 

Through Emacs Lisp:

(setq ps-print-color-p 4)

(setq ps-print-color-p (or (some-fun 10) 4))

(defun my-settings ()
   ;; ... some settings ...
   (setq ps-print-color 'my-setting))

(defun my-print (...)
   (let ((ps-print-color-p 'use-this-value))
     (ps-print-buffer-with-face ...)))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ps-print-color-p and the background colour of Emacs' frame
  2007-08-08 16:42             ` Vinicius Jose Latorre
@ 2007-08-18  7:50               ` Christian Schlauer
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Schlauer @ 2007-08-18  7:50 UTC (permalink / raw)
  To: emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

[...]

> Now ps-default-bg and ps-default-fg has:
>
>    This variable is used only when `ps-print-color-p' (which see) is
> neither nil nor black-white.

Thank you -- that's good!
-- 
Christian Schlauer

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-08-18  7:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 20:22 ps-print-color-p and the background colour of Emacs' frame Christian Schlauer
2007-07-20 17:31 ` Vinicius Jose Latorre
2007-07-23 18:54   ` Christian Schlauer
2007-07-25 15:22     ` Vinicius Jose Latorre
2007-08-05 20:19       ` Christian Schlauer
2007-08-05 20:38         ` Vinicius Jose Latorre
2007-08-07 21:44           ` Christian Schlauer
2007-08-08 16:42             ` Vinicius Jose Latorre
2007-08-18  7:50               ` Christian Schlauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).