help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [h-e-w] Printing from Emacs


From: Phil Betts
Subject: RE: [h-e-w] Printing from Emacs
Date: Wed, 15 Sep 2004 17:20:38 +0100

Lennart Borgman wrote:
> I am currently rewriting w32-winprint.el as w32-print.el. The basic
> functionality will still be the same.

While you're doing this Lennart, you might want to look at a small
problem I spotted in w32-winprint.el

The code that is meant to check if it is running on Windows doesn't.

The test is:

    (if (not (string-match "i386" system-configuration))
    ...

FYI, these are the values of system-configuration for various systems
I'm using:

Emacs flavour    |OS                    |CPU   |system-configuration
-----------------+----------------------+------+----------------------
Native NT emacs  |w2k                   |586:  |i386-mingw-nt5.0.2195
cygwin GNU emacs |w2k                   |586:  |i686-pc-cygwin
cygwin XEmacs    |w2k                   |586:  |i686-pc-cygwin
GNU emacs        |SCO UnixWare          |586:  |i386-univel-sysv4.2MP
XEmacs           |Tru64 Unix            |alpha |alpha-dec-osf5.0
GNU emacs        |SINIX (Siemens' Unix) |MIPS  |mips-siemens-sysv4
GNU emacs        |Linux                 |486   |i486-pc-linux-gnulibc1

You can see that the current code would mis-identify the SCO UnixWare
system as Windows.  Note also that there was a version of NT for Alpha
CPUs, so the CPU is not a good choice for identifying the OS.  The two
cygwin ports will not be identified as Windows versions (although this
is probably what we want here since neither version defines the
w32-shell-execute function)

In this particular case, it would seem that the key determinant is the
existence of function w32-shell-execute.  It would therefore be best
to explicitly check for it like this:

    (if (not (fboundp w32-shell-execute))
    ...

In other cases, a more general and (mostly) reliable check for the
native NT emacs is:

    (if (not (eq 'window-system "w32"))
    ...

but it's not the best test in this case.  This is because, if the
cygwin ports ever implement w32-shell-execute, window-system would
probably still be "x" (or nil), so they would fail the test.  The test
also fails if NT emacs is started with -nw (although you shouldn't do
this without medical supervision - it's badly broken and liable to
send you a bit mad!)

Regards,

  Phil Betts


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************





reply via email to

[Prev in Thread] Current Thread [Next in Thread]