unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 23.0.50; ps-print-buffer-with-faces hangs on w32
@ 2008-01-09 16:20 Lennart Borgman (gmail)
  2008-01-09 17:09 ` Jason Rumney
  2008-01-09 18:24 ` Vinicius Jose Latorre
  0 siblings, 2 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-09 16:20 UTC (permalink / raw)
  To: emacs-pretest-bug

Emacs hangs in direct-print-region-helper in the call to

   (write-region start end printer t 0)

at the end of the function. Emacs is completely hanged. I have to kill 
Emacs from Windows Task Manager.

On my pc (Windows XP pro) printer has here got the value C:\PRN. That 
value has nothing to do with my printer, which is a Windows printer.

To reproduce this do for example

   emacs -Q
   M-x ps-print-buffer-with-faces

on a pc with a Windows printer (the probably most common form of printer 
on a w32 pc today).


In GNU Emacs 23.0.50.1 (i386-mingw-nt5.1.2600)
  of 2008-01-04 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/g/include'

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: ENU
   locale-coding-system: cp1252
   default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   tool-bar-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   unify-8859-on-encoding-mode: t
   utf-translate-cjk-mode: t
   auto-compression-mode: t
   line-number-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <help-menu> <send-emacs-bug-report>
p i <backspace> s - p r o i n t <backspace> <backspace>
<backspace> <backspace> i n t - b u f f e r - w i t
h - f a c e s SPC h a n g s SPC o n SPC w 3 2 <return>
i <backspace> T h <backspace> <backspace> E m a c s
SPC h a n g s SPC i n SPC C-v k k <backspace> <backspace>
<escape> k k k <backspace> <backspace> <backspace>
C-w C-x k <return> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
Warning: no fonts matching `-*-dejavu sans 
mono-normal-r-normal-*-13-*-*-*-c-*-iso8859-1' available [2 times]
Warning: no fonts matching 
`-*-opensymbol-normal-r-normal-*-12-*-*-*-c-*-iso8859-1' available [2 times]
For information about GNU Emacs and the GNU system, type C-h C-a.
kill-region: The mark is not set now, so there is no region

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 16:20 23.0.50; ps-print-buffer-with-faces hangs on w32 Lennart Borgman (gmail)
@ 2008-01-09 17:09 ` Jason Rumney
  2008-01-09 18:09   ` Lennart Borgman (gmail)
  2008-01-09 18:24 ` Vinicius Jose Latorre
  1 sibling, 1 reply; 20+ messages in thread
From: Jason Rumney @ 2008-01-09 17:09 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug

Lennart Borgman (gmail) wrote:
> On my pc (Windows XP pro) printer has here got the value C:\PRN. That 
> value has nothing to do with my printer, which is a Windows printer.
What is a Windows printer? Do you mean a printer whose drivers do not 
expose a standard printer device?

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 18:24 ` Vinicius Jose Latorre
@ 2008-01-09 18:02   ` Lennart Borgman (gmail)
  2008-01-09 20:14     ` Vinicius Jose Latorre
  2008-01-10 14:36     ` Jason Rumney
  0 siblings, 2 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-09 18:02 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-pretest-bug

Vinicius Jose Latorre wrote:
> 
>> Emacs hangs in direct-print-region-helper in the call to

I should have said that this function is in dos-w32.el.

>>   (write-region start end printer t 0)
>>
>> at the end of the function. Emacs is completely hanged. I have to kill 
>> Emacs from Windows Task Manager.
> 
> Did you try to type `C-g' (one or more times)??  What happened?

Emacs is completely frozen.

>> On my pc (Windows XP pro) printer has here got the value C:\PRN. That 
>> value has nothing to do with my printer, which is a Windows printer.
> 
> What exactly does this mean?
> 
> Does any Emacs variable have the value "C:\\PRN"?

The variable `printer' above.

> What is a "Windows printer"?

I forgot what these printers are called. It seems like they are called 
"GDI printers" or "winprinters". Mine a hp laserjet 1020. (BTW there 
seems to exist GNU/Linux drivers for those printers today, 
seehttp://foo2zjs.rkkda.com/. They translate from PostScript.)

>> To reproduce this do for example
>>
>>   emacs -Q
>>   M-x ps-print-buffer-with-faces
> 
> Well, I can't reproduce this problem in my GNU/Linux (Debian).
> 
> Please, do the following steps:

Thanks, but this is a problem with how Emacs access the printer. As I 
understand it there is no problem with printing.el. I am sorry for 
beeing unclear.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 17:09 ` Jason Rumney
@ 2008-01-09 18:09   ` Lennart Borgman (gmail)
  2008-01-09 19:12     ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-09 18:09 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-pretest-bug

Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>> On my pc (Windows XP pro) printer has here got the value C:\PRN. That 
>> value has nothing to do with my printer, which is a Windows printer.
> What is a Windows printer? Do you mean a printer whose drivers do not 
> expose a standard printer device?

I think I should have said "winprinter" or "GDI printer" (see my reply 
to Vinicius). The printer is attached through USB.

Maybe I was wrong about that PRN does not have anything to do with this 
printer. Is that what you mean with a "standard printer device"?

Emacs support for printing on w32 is not complete (see the long 
discussions between me and Eli earlier). It seems to be rather much job 
to finish that. That is not what I am after now, I just tested to see 
what would happen, ie if Emacs failed in a nice way.

It did not. It hanged completely (C-g etc does not help, trying to close 
the frame/w32 window does not help). Is there anything we can do to 
avoid this hang?

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 16:20 23.0.50; ps-print-buffer-with-faces hangs on w32 Lennart Borgman (gmail)
  2008-01-09 17:09 ` Jason Rumney
@ 2008-01-09 18:24 ` Vinicius Jose Latorre
  2008-01-09 18:02   ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 20+ messages in thread
From: Vinicius Jose Latorre @ 2008-01-09 18:24 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug


> Emacs hangs in direct-print-region-helper in the call to
>
>   (write-region start end printer t 0)
>
> at the end of the function. Emacs is completely hanged. I have to kill 
> Emacs from Windows Task Manager.

Did you try to type `C-g' (one or more times)??  What happened?


> On my pc (Windows XP pro) printer has here got the value C:\PRN. That 
> value has nothing to do with my printer, which is a Windows printer.

What exactly does this mean?

Does any Emacs variable have the value "C:\\PRN"?

What is a "Windows printer"?


> To reproduce this do for example
>
>   emacs -Q
>   M-x ps-print-buffer-with-faces

Well, I can't reproduce this problem in my GNU/Linux (Debian).

Please, do the following steps:

1. start Emacs without -Q

2. switch to *scratch* buffer

3. type:   M-x (insert (ps-setup)) RET

4. save *scratch* buffer in a file and send it back to me.

5. exit Emacs

6. start Emacs with -Q

7. repeat steps 2 to 5


> on a pc with a Windows printer (the probably most common form of 
> printer on a w32 pc today).
>
>
> In GNU Emacs 23.0.50.1 (i386-mingw-nt5.1.2600)
>  of 2008-01-04 on LENNART-69DE564
> Windowing system distributor `Microsoft Corp.', version 5.1.2600
> configured using `configure --with-gcc (3.4) --cflags -Ic:/g/include'
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: ENU
>   locale-coding-system: cp1252
>   default-enable-multibyte-characters: t
>
> Major mode: Lisp Interaction
>
> Minor modes in effect:
>   tooltip-mode: t
>   tool-bar-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   unify-8859-on-encoding-mode: t
>   utf-translate-cjk-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>
> Recent input:
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <menu-bar> <help-menu> <send-emacs-bug-report>
> p i <backspace> s - p r o i n t <backspace> <backspace>
> <backspace> <backspace> i n t - b u f f e r - w i t
> h - f a c e s SPC h a n g s SPC o n SPC w 3 2 <return>
> i <backspace> T h <backspace> <backspace> E m a c s
> SPC h a n g s SPC i n SPC C-v k k <backspace> <backspace>
> <escape> k k k <backspace> <backspace> <backspace>
> C-w C-x k <return> <help-echo> <help-echo> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <menu-bar> <help-menu> <send-emacs-bug-report>
>
> Recent messages:
> Warning: no fonts matching `-*-dejavu sans 
> mono-normal-r-normal-*-13-*-*-*-c-*-iso8859-1' available [2 times]
> Warning: no fonts matching 
> `-*-opensymbol-normal-r-normal-*-12-*-*-*-c-*-iso8859-1' available [2 
> times]
> For information about GNU Emacs and the GNU system, type C-h C-a.
> kill-region: The mark is not set now, so there is no region

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 18:09   ` Lennart Borgman (gmail)
@ 2008-01-09 19:12     ` Eli Zaretskii
  2008-01-09 19:16       ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-09 19:12 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug, jasonr

> Date: Wed, 09 Jan 2008 19:09:27 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> Cc: emacs-pretest-bug@gnu.org
> 
> It did not. It hanged completely (C-g etc does not help, trying to close 
> the frame/w32 window does not help). Is there anything we can do to 
> avoid this hang?

Yes, install a program that can print to that printer, and set
lpr-program to point to it.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 19:12     ` Eli Zaretskii
@ 2008-01-09 19:16       ` Lennart Borgman (gmail)
  2008-01-10  4:09         ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-09 19:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, jasonr

Eli Zaretskii wrote:
>> Date: Wed, 09 Jan 2008 19:09:27 +0100
>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>> Cc: emacs-pretest-bug@gnu.org
>>
>> It did not. It hanged completely (C-g etc does not help, trying to close 
>> the frame/w32 window does not help). Is there anything we can do to 
>> avoid this hang?
> 
> Yes, install a program that can print to that printer, and set
> lpr-program to point to it.

In what way does that help a person that tries to print from Emacs 
without that program installed? Does not Emacs still hang completely 
with your advice?

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 18:02   ` Lennart Borgman (gmail)
@ 2008-01-09 20:14     ` Vinicius Jose Latorre
  2008-01-10 14:36     ` Jason Rumney
  1 sibling, 0 replies; 20+ messages in thread
From: Vinicius Jose Latorre @ 2008-01-09 20:14 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug


>> What is a "Windows printer"?
>
> I forgot what these printers are called. It seems like they are called 
> "GDI printers" or "winprinters". Mine a hp laserjet 1020. (BTW there 
> seems to exist GNU/Linux drivers for those printers today, see 
> http://foo2zjs.rkkda.com/. They translate from PostScript.)

BTW, foo2zjs driver depends on ghostscript.


>>> To reproduce this do for example
>>>
>>>   emacs -Q
>>>   M-x ps-print-buffer-with-faces
>>
>> Well, I can't reproduce this problem in my GNU/Linux (Debian).
>>
>> Please, do the following steps:
>
> Thanks, but this is a problem with how Emacs access the printer. As I 
> understand it there is no problem with printing.el. I am sorry for 
> beeing unclear.

Ok.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 19:16       ` Lennart Borgman (gmail)
@ 2008-01-10  4:09         ` Eli Zaretskii
  2008-01-10  7:57           ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-10  4:09 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug, jasonr

> Date: Wed, 09 Jan 2008 20:16:54 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> CC: jasonr@gnu.org, emacs-pretest-bug@gnu.org
> 
> Eli Zaretskii wrote:
> >> Date: Wed, 09 Jan 2008 19:09:27 +0100
> >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> >> Cc: emacs-pretest-bug@gnu.org
> >>
> >> It did not. It hanged completely (C-g etc does not help, trying to close 
> >> the frame/w32 window does not help). Is there anything we can do to 
> >> avoid this hang?
> > 
> > Yes, install a program that can print to that printer, and set
> > lpr-program to point to it.
> 
> In what way does that help a person that tries to print from Emacs 
> without that program installed?

I tried to explain how to print, not how to hang.

> Does not Emacs still hang completely with your advice?

It doesn't hang for me.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-10  4:09         ` Eli Zaretskii
@ 2008-01-10  7:57           ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-10  7:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, jasonr



Eli Zaretskii wrote:
>> Date: Wed, 09 Jan 2008 20:16:54 +0100
>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>> CC: jasonr@gnu.org, emacs-pretest-bug@gnu.org
>>
>> Eli Zaretskii wrote:
>>>> Date: Wed, 09 Jan 2008 19:09:27 +0100
>>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>>>> Cc: emacs-pretest-bug@gnu.org
>>>>
>>>> It did not. It hanged completely (C-g etc does not help, trying to close 
>>>> the frame/w32 window does not help). Is there anything we can do to 
>>>> avoid this hang?
>>> Yes, install a program that can print to that printer, and set
>>> lpr-program to point to it.
>> In what way does that help a person that tries to print from Emacs 
>> without that program installed?
> 
> I tried to explain how to print, not how to hang.

I am of course asking what we should do about the problem that Emacs 
hangs completely and the user might loose data. Do you have any idea 
about that?

>> Does not Emacs still hang completely with your advice?
> 
> It doesn't hang for me.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-09 18:02   ` Lennart Borgman (gmail)
  2008-01-09 20:14     ` Vinicius Jose Latorre
@ 2008-01-10 14:36     ` Jason Rumney
  2008-01-10 16:11       ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 20+ messages in thread
From: Jason Rumney @ 2008-01-10 14:36 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug

Lennart Borgman (gmail) wrote:
>>
>> What exactly does this mean?
>>
>> Does any Emacs variable have the value "C:\\PRN"?
>
> The variable `printer' above.
I don't have a variable `printer', is this from an external package you 
have installed?
I do have a variable `printer-name', but it's default value on Windows 
is the device name "PRN", not "C:\\PRN" (which though it looks like a 
file name will still refer to the PRN device under some circumstances in 
Windows, but I'm not sure Windows is consistent about this, and in some 
cases may actually refer to the file, especially if the printer driver 
for your default printer does not expose a standard character device).

>
>> What is a "Windows printer"?
>
> I forgot what these printers are called. It seems like they are called 
> "GDI printers" or "winprinters".
Calling them winprinters suggests that there is something that makes 
them a win over other more functional printers. Really the printer 
hardware is not the issue, often the printer will be better supported by 
Free Software like CUPS than by the manufacturers own Windows drivers, 
so calling them Windows printers is also misleading. What you really 
mean is that the Windows printer drivers that the manufacturer has 
supplied are limited to supporting only GDI based printing, as they do 
not expose a character device (and are connected via USB, so the COM or 
PAR character devices are not automatically available) that could be 
used to print directly to the printer in text mode or whatever command 
language(s) that the printer supports natively (eg Postscript, PCL or 
ESC/P). This problem can often be worked around by sharing the printer 
from Windows, and setting the printer-name within Emacs to the network 
share path of the printer (eg "//localhost/printer").

But it is unlikely that a printer with such limited drivers supports 
Postscript natively, so to use the ps-print commands, you'll need to set 
up a software postscript interpreter such as Ghostscript anyway.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-10 14:36     ` Jason Rumney
@ 2008-01-10 16:11       ` Lennart Borgman (gmail)
  2008-01-11 10:28         ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-10 16:11 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-pretest-bug, Eli Zaretskii

Jason Rumney wrote:
> Lennart Borgman (gmail) wrote:
>>>
>>> What exactly does this mean?
>>>
>>> Does any Emacs variable have the value "C:\\PRN"?
>>
>> The variable `printer' above.
> I don't have a variable `printer', is this from an external package you 
> have installed?

Hi Jason,

No, it is a variable in the function I mentioned in the bug report:

   Emacs hangs in direct-print-region-helper in the call to

     (write-region start end printer t 0)

   at the end of the function. Emacs is completely hanged. I have to
   kill Emacs from Windows Task Manager.

This function is in dos-w32.el.

> I do have a variable `printer-name', but it's default value on Windows 
> is the device name "PRN",

I have the same.

> not "C:\\PRN"

This is what Emacs has translated "PRN" to at the end of the function above.

>>> What is a "Windows printer"?
>>
>> I forgot what these printers are called. It seems like they are called 
>> "GDI printers" or "winprinters".
> Calling them winprinters suggests that there is something that makes 
> them a win over other more functional printers.

Maybe.

> Really the printer 
> hardware is not the issue, often the printer will be better supported by 
> Free Software like CUPS than by the manufacturers own Windows drivers, 
> so calling them Windows printers is also misleading. What you really 
> mean is that the Windows printer drivers that the manufacturer has 
> supplied are limited to supporting only GDI based printing, as they do 
> not expose a character device (and are connected via USB, so the COM or 
> PAR character devices are not automatically available)

Correct.

> that could be 
> used to print directly to the printer in text mode or whatever command 
> language(s) that the printer supports natively (eg Postscript, PCL or 
> ESC/P). This problem can often be worked around by sharing the printer 
> from Windows, and setting the printer-name within Emacs to the network 
> share path of the printer (eg "//localhost/printer").

Yes, that is perhaps a nice little trick. Though I had never had any 
reason to test it, but if you think it works then maybe this is 
something worth mentioning on (info "(emacs) Windows Printing")?

> But it is unlikely that a printer with such limited drivers supports 
> Postscript natively, so to use the ps-print commands, you'll need to set 
> up a software postscript interpreter such as Ghostscript anyway.

That is correct, but it is not the problem I am reporting. I must have 
made some bad mistake in my initial bug report since both you and Eli 
misunderstood me this way.

What I was reporting was that under certain (rather common conditions) 
Emacs can hang if a user tries to print a file. Emacs hangs very badly 
and can not be interrupted. You have to kill Emacs from outside - and 
that of course means that the user can loose data.

(It has nothing per se with ps-print-* to do, it hangs in the same way 
if one uses print-buffer. I actually did M-x ps-print-buffer just to see 
how Emacs failed.)

So my question is what we can do about this?

I doubt that there is anything we easily can do technically about it 
since I notice that in a cmd.exe console

    copy /b some-non-emtpy-file.txt PRN:

hangs the console window rather badly.

I think however that we should do something since GDI printers are 
common on w32. What we can do is to warn the user. The best way IMO 
would be to add a y/n question in the function 
direct-print-region-helper in dos-w32.el that warns the user that Emacs 
might hang. (And of course an option to bypass the question.)

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-10 16:11       ` Lennart Borgman (gmail)
@ 2008-01-11 10:28         ` Eli Zaretskii
  2008-01-11 10:47           ` Jason Rumney
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-11 10:28 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-pretest-bug, jasonr

> Date: Thu, 10 Jan 2008 17:11:36 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> CC: Vinicius Jose Latorre <viniciusjl@ig.com.br>, 
>  emacs-pretest-bug@gnu.org, Eli Zaretskii <eliz@gnu.org>
> 
> What I was reporting was that under certain (rather common conditions) 
> Emacs can hang if a user tries to print a file. Emacs hangs very badly 
> and can not be interrupted. You have to kill Emacs from outside - and 
> that of course means that the user can loose data.
> 
> (It has nothing per se with ps-print-* to do, it hangs in the same way 
> if one uses print-buffer. I actually did M-x ps-print-buffer just to see 
> how Emacs failed.)
> 
> So my question is what we can do about this?
> 
> I doubt that there is anything we easily can do technically about it 
> since I notice that in a cmd.exe console
> 
>     copy /b some-non-emtpy-file.txt PRN:
> 
> hangs the console window rather badly.

Exactly.  That will happen to any program that tries to write to a
device that does not exist.  If someone knows how to detect such
devices without hanging, I'd be glad to incorporate such detection
into Emacs.

> What we can do is to warn the user. The best way IMO 
> would be to add a y/n question in the function 
> direct-print-region-helper in dos-w32.el that warns the user that Emacs 
> might hang.

I'd be terribly annoyed to have such question each time I print.

> (And of course an option to bypass the question.)

If the option is off by default, it won't help.  If it is on, it will
annoy, and will generally be useless anyway, since the user cannot do
anything about this warning, except give up the printing command.  If
she doesn't give up, and she is in your situation, she will hang.
There's no way for her to find out whether she will or will not hang.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 10:28         ` Eli Zaretskii
@ 2008-01-11 10:47           ` Jason Rumney
  2008-01-11 10:59             ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Jason Rumney @ 2008-01-11 10:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, Lennart Borgman (gmail)

Eli Zaretskii wrote:
> If the option is off by default, it won't help.  If it is on, it will
> annoy, and will generally be useless anyway, since the user cannot do
> anything about this warning, except give up the printing command.  If
> she doesn't give up, and she is in your situation, she will hang.
> There's no way for her to find out whether she will or will not hang.
>   

Perhaps we should give up trying to make printing work out of the box on 
Windows, and instead produce an error by default telling the user they 
need to configure printing. In an office environment, printers are 
likely to be on the network, and the user will have to configure Emacs 
anyway. In a home environment, the printer is increasingly likely to be 
a USB connected inkjet or cheap laser that does not expose a character 
device for Windows to map to PRN.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 10:47           ` Jason Rumney
@ 2008-01-11 10:59             ` Eli Zaretskii
  2008-01-11 11:29               ` Lennart Borgman (gmail)
  2008-01-11 12:50               ` Vinicius Jose Latorre
  0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-11 10:59 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-pretest-bug, lennart.borgman

> Date: Fri, 11 Jan 2008 10:47:54 +0000
> From: Jason Rumney <jasonr@gnu.org>
> CC: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>, 
>  viniciusjl@ig.com.br, emacs-pretest-bug@gnu.org
> 
> Perhaps we should give up trying to make printing work out of the box on 
> Windows, and instead produce an error by default telling the user they 
> need to configure printing.

That was how Emacs 21 and before worked, and I remember a huge number
of FAQs on the gnu-emacs-help forum.  It's much quieter now, although
there's no way of knowing if that's because the default behavior of
Emacs 22.

Besides, what exactly would you tell the user that is helpful?

> In an office environment, printers are likely to be on the network,
> and the user will have to configure Emacs anyway. In a home
> environment, the printer is increasingly likely to be a USB
> connected inkjet or cheap laser that does not expose a character
> device for Windows to map to PRN.

I'd like first to try to find a way of detecting this.  Any ideas?
How about trying to find out what is the default printer configured by
Windows, for example?

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 10:59             ` Eli Zaretskii
@ 2008-01-11 11:29               ` Lennart Borgman (gmail)
  2008-01-11 12:50               ` Vinicius Jose Latorre
  1 sibling, 0 replies; 20+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-11 11:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, Jason Rumney

Eli Zaretskii wrote:
> I'd like first to try to find a way of detecting this.  Any ideas?
> How about trying to find out what is the default printer configured by
> Windows, for example?


Perhaps that can solve part of the problem. (default-printer-name) gives 
"USB001" for me.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 10:59             ` Eli Zaretskii
  2008-01-11 11:29               ` Lennart Borgman (gmail)
@ 2008-01-11 12:50               ` Vinicius Jose Latorre
  2008-01-11 15:29                 ` Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Vinicius Jose Latorre @ 2008-01-11 12:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, lennart.borgman, Jason Rumney


> I'd like first to try to find a way of detecting this.  Any ideas?
>   

Couldn't be a kind of recipe to user detect in which situation the user is?

For example, there is a recipe in printing package to user
determine if a PostScript printer has duplex feature:

;; NOTE 3: The duplex feature will only work on PostScript printers that
;;         support this feature.
;;         You can check if your PostScript printer supports duplex feature
;;         by checking the printer manual.  Or you can try these steps:
;;         1. Open a buffer (or use the *scratch* buffer).
;;         2. Type:
;;            First line (on first page)
;;            ^L
;;            Second line (on second page)
;;         3. Print this buffer with duplex turned on.
;;         If it's printed 2 (two) sheets of paper, then your PostScript
;;         printer doesn't have duplex feature; otherwise, it's ok, your
;;         printer does have duplex feature.


> How about trying to find out what is the default printer configured by
> Windows, for example?
>   

Humm, a colleague of mine had to write a code to detect the default 
printer in
Windows, he said me that this is not easy, it depends on at least the OS 
version.

He just wrote a code for a specific Windows version.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 12:50               ` Vinicius Jose Latorre
@ 2008-01-11 15:29                 ` Eli Zaretskii
  2008-01-14 15:42                   ` Vinicius Jose Latorre
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-11 15:29 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-pretest-bug, lennart.borgman, jasonr

> Date: Fri, 11 Jan 2008 09:50:11 -0300
> From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
> CC: Jason Rumney <jasonr@gnu.org>, lennart.borgman@gmail.com, 
>  emacs-pretest-bug@gnu.org
> 
> Humm, a colleague of mine had to write a code to detect the default 
> printer in
> Windows, he said me that this is not easy, it depends on at least the OS 
> version.
> 
> He just wrote a code for a specific Windows version.

Could you or your colleague describe the main idea(s) used in the
detection code?  Like which APIs are used, etc.?  Then someone here
could consider implementing those ideas in Emacs.

TIA

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-11 15:29                 ` Eli Zaretskii
@ 2008-01-14 15:42                   ` Vinicius Jose Latorre
  2008-01-14 20:32                     ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Vinicius Jose Latorre @ 2008-01-14 15:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-pretest-bug, lennart.borgman, jasonr


> Could you or your colleague describe the main idea(s) used in the
> detection code?  Like which APIs are used, etc.?  Then someone here
> could consider implementing those ideas in Emacs.
>   

I had a conversation with my colleague, as he programmed this stuff some 
years ago, he is trying to get  this information back again.

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

* Re: 23.0.50; ps-print-buffer-with-faces hangs on w32
  2008-01-14 15:42                   ` Vinicius Jose Latorre
@ 2008-01-14 20:32                     ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2008-01-14 20:32 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: emacs-pretest-bug, lennart.borgman, jasonr

> Date: Mon, 14 Jan 2008 12:42:12 -0300
> From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
> CC: jasonr@gnu.org, lennart.borgman@gmail.com, emacs-pretest-bug@gnu.org
> 
> 
> > Could you or your colleague describe the main idea(s) used in the
> > detection code?  Like which APIs are used, etc.?  Then someone here
> > could consider implementing those ideas in Emacs.
> >   
> 
> I had a conversation with my colleague, as he programmed this stuff some 
> years ago, he is trying to get  this information back again.

Thanks.

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

end of thread, other threads:[~2008-01-14 20:32 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-09 16:20 23.0.50; ps-print-buffer-with-faces hangs on w32 Lennart Borgman (gmail)
2008-01-09 17:09 ` Jason Rumney
2008-01-09 18:09   ` Lennart Borgman (gmail)
2008-01-09 19:12     ` Eli Zaretskii
2008-01-09 19:16       ` Lennart Borgman (gmail)
2008-01-10  4:09         ` Eli Zaretskii
2008-01-10  7:57           ` Lennart Borgman (gmail)
2008-01-09 18:24 ` Vinicius Jose Latorre
2008-01-09 18:02   ` Lennart Borgman (gmail)
2008-01-09 20:14     ` Vinicius Jose Latorre
2008-01-10 14:36     ` Jason Rumney
2008-01-10 16:11       ` Lennart Borgman (gmail)
2008-01-11 10:28         ` Eli Zaretskii
2008-01-11 10:47           ` Jason Rumney
2008-01-11 10:59             ` Eli Zaretskii
2008-01-11 11:29               ` Lennart Borgman (gmail)
2008-01-11 12:50               ` Vinicius Jose Latorre
2008-01-11 15:29                 ` Eli Zaretskii
2008-01-14 15:42                   ` Vinicius Jose Latorre
2008-01-14 20:32                     ` Eli Zaretskii

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).