rock@dasher.SanDiego.NCR.COM (Rock Kent) (09/29/88)
THIS PROCEDURE IS ONLY KNOWN TO WORK WITH PROCOMM VT100 TERMINAL EMULATION Much of the access to the Unix machines at our facility is through PCs running vt100 terminal emulation software. Most of those PCs have attached printers, but "local" printing has required that the info in question be saved as a file and then cat'd between the vt100 direct print enable and disable escape character sequences, \e[5i and \e[4i, respectively. Michael "Ford" Ditto's (ditto@cbmvax.UUCP) 132 column display function under emacs, 'set-screen-width {Message-ID: <4790@cbmvax.UUCP>} , introduced me to the elisp function (send-string-to-terminal STRING) and a more direct means of local printing. The following is print.el, a procedure for using the "direct" print mode of the vt100 terminal to locally print strings, buffers, and files from within GNU emacs. This is not a shar file. Cut at the line and stuff into the file print.el. Use load-file with GNU-emacs. I include the following in my .emacs: (autoload 'print-local-string "print.el" "" t) (autoload 'print-local-buffer "print.el" "" t) (autoload 'print-local-file "print.el" "" t) Works with 18.49. I didn't put the standard gnu banner on it because of its limited application. I would appreciate any pointers on generalizing print.el in order to make its printer dependence less intrusive. ----------snip-snip----------------------------------------------------- ; print.el: Procedures to print the contents of a buffer, string, or ; file on the printer attached to the terminal. ; ; THIS PROCEDURE DEPENDS ON THE VT100 DIRECT PRINT MODE. ; ; print.el, derivations therefrom, and extensions thereof, are free to all. ; ; This software is distributed 'as is', without warranties of any ; kind, but all comments, suggestions and bug reports are welcome. ; ; Rock.Kent@SanDiego.NCR.COM ; (defvar start-string "[5i" "The string which turns on direct print" ) (defvar stop-string "[4i" "The string which turns off direct print" ) (defun print-local-string (arg) " Function which takes advantage of the vt100 direct print control characters in order to print the a string directly to a local printer." (interactive "sPrint String: ") (print-local-engine arg)) (defun print-local-buffer (buffer) " Function which takes advantage of the vt100 direct print control characters in order to print the a string directly to a local printer." (interactive "bPrint Buffer: ") (save-excursion (switch-to-buffer buffer) (print-local-engine (buffer-string)))) (defun print-local-file (file) " Function which takes advantage of the vt100 direct print control characters in order to print the a string directly to a local printer." (interactive "fPrint File: ") (save-excursion (kill-buffer (progn (find-file file) (print-local-engine (buffer-string)))))) (defun print-local-engine (printstring) " The procedure which actually does the work." (send-string-to-terminal (concat start-string printstring stop-string))) ----------snip-snip----------------------------------------------------- Rock E. Kent (Dept 2001) usps: NCR Corp. E&M SD voice: (619) 485-2332 cems: RBO 16550 W. Bernardo Dr. net mail: rock@donner.SanDiego.NCR.COM San Diego, Ca. 92127 uucp: {sdcsvax,ncrcae,hp-sdd,nosc.ARPA}!ncr-sd!donner!rock -- - - > We take customer satisfaction personally. < - - Rock Kent (OCM - Dept 2001) ext: 2332 email: rock@donner