From owner-ntemacs-users@cs.washington.edu  Tue Feb  3 03:35:01 1998
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" " 3" "February" "1998" "11:02:54" "+0100" "Anders Lindgren" "andersl@csd.uu.se" nil "83" "NT Printing problem solved." "^From:" nil nil "2" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.7+CS/7.2ju) with SMTP id DAA18182 for <voelker@june.cs.washington.edu>; Tue, 3 Feb 1998 03:35:01 -0800
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id DAA37652 for <voelker@joker.cs.washington.edu>; Tue, 3 Feb 1998 03:34:59 -0800
Received: (majordom@localhost) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) id DAA02551 for ntemacs-users-outgoing; Tue, 3 Feb 1998 03:05:09 -0800 (PST)
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id DAA02547 for <ntemacs-users@trout.cs.washington.edu>; Tue, 3 Feb 1998 03:05:05 -0800 (PST)
Received: from groucho.csd.uu.se (groucho.csd.uu.se [130.238.12.2]) by june.cs.washington.edu (8.8.7+CS/7.2ju) with ESMTP id DAA17631 for <ntemacs-users@cs.washington.edu>; Tue, 3 Feb 1998 03:05:04 -0800
Received: (from andersl@localhost) 	by groucho.csd.uu.se (8.8.5/8.8.5) id LAA01463; 	Tue, 3 Feb 1998 11:02:55 +0100 (MET)
Message-ID: <ubdu3ah6m5t.fsf@groucho.csd.uu.se>
Lines: 83
X-Mailer: Gnus v5.3/Emacs 19.34
Precedence: bulk
From: Anders Lindgren <andersl@csd.uu.se>
Sender: owner-ntemacs-users@cs.washington.edu
To: ntemacs-users@cs.washington.edu
Subject: NT Printing problem solved.
Date: 03 Feb 1998 11:02:54 +0100

Hi!

Until now, there has been no satisfactory solution on how to print
from NT-Emacs.

Several attempts have been made, they can be categorized into two
groups:

* Defining a new set of commands used to print.

* Creating a "lpr" command in some language (like perl or unix shells)
  that is not present in a pure Windows + Emacs environment.


The first solution will fail since quite a few third-party packages
use the standard printing functions.  The second is not very practical
since most users doesn't have perl or a Unix shell laying around.

Below is a batch file named "lpr.bat" that is only based on command
found the standard Windows and in the Emacs distribution.  When placed
in the exec path the printing facilities of Emacs should work straigh
out of the box.

	-- Anders Lindgren

==============================8<------------------------------
@REM  lpr.bat --- Simple print command for Windows.
@ECHO OFF

REM  Copyright (C) 1998 Anders Lindgren
REM
REM  Author: Anders Lindgren <andersl@csd.uu.se>
REM  Keywords: print
REM  Date: 1998-01-29

REM  This program is free software; you can redistribute it and/or modify
REM  it under the terms of the GNU General Public License as published by
REM  the Free Software Foundation; either version 2, or (at your option)
REM  any later version.

REM  This program is distributed in the hope that it will be useful,
REM  but WITHOUT ANY WARRANTY; without even the implied warranty of
REM  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM  GNU General Public License for more details.

REM  You should have received a copy of the GNU General Public License
REM  along with GNU Emacs; see the file COPYING.  If not, write to the
REM  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
REM  Boston, MA 02111-1307, USA.


REM Commentary:

REM  Print program for Windows.
REM
REM  Usage:
REM     lpr [file]
REM
REM  Should no argument be given the input is read from stdin.
REM
REM  The output is always sent to LPT1:
REM
REM  The problem with the combination Windows and Emacs is that Emacs
REM  assumes that the print command (specified by `lpr-command') can
REM  accept input on stdin.  Unfortunately, there is no command in
REM  Windows that can read from stdin and copy the input to a file or
REM  stdout.
REM
REM  Fortunately, there is a program named `hexl' that is part of the
REM  standard Emacs distribution.  It is normally used to convert a
REM  file to and from hexadecimal form.  In this program we exploit the
REM  fact that it can read input from stdin.
REM  
REM
REM  Personally I think that the lack of features to support creation of
REM  small automatic program is _the_ major design flaw in Windows.


if "%1" == ""      hexl | hexl -de > lpt1:

if not "%1" == ""  type %1 > lpt1:

REM  lpr.bat ends here.

