Annotation of GNUtools/emacs/lisp/lpr.el, revision 1.1.1.1

1.1       root        1: ;; Print Emacs buffer on line printer.
                      2: ;; Copyright (C) 1985, 1988 Free Software Foundation, Inc.
                      3: 
                      4: ;; This file is part of GNU Emacs.
                      5: 
                      6: ;; GNU Emacs is free software; you can redistribute it and/or modify
                      7: ;; it under the terms of the GNU General Public License as published by
                      8: ;; the Free Software Foundation; either version 1, or (at your option)
                      9: ;; any later version.
                     10: 
                     11: ;; GNU Emacs is distributed in the hope that it will be useful,
                     12: ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13: ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     14: ;; GNU General Public License for more details.
                     15: 
                     16: ;; You should have received a copy of the GNU General Public License
                     17: ;; along with GNU Emacs; see the file COPYING.  If not, write to
                     18: ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     19: 
                     20: 
                     21: ;(defconst lpr-switches nil
                     22: ;  "*List of strings to pass as extra switch args to lpr when it is invoked.")
                     23: 
                     24: (defvar lpr-command (if (memq system-type
                     25:                              '(usg-unix-v hpux silicon-graphics-unix))
                     26:                        "lp" "lpr")
                     27:   "Shell command for printing a file")
                     28: 
                     29: (defun lpr-buffer ()
                     30:   "Print buffer contents as with Unix command `lpr'.
                     31: `lpr-switches' is a list of extra switches (strings) to pass to lpr."
                     32:   (interactive)
                     33:   (print-region-1 (point-min) (point-max) lpr-switches))
                     34: 
                     35: (defun print-buffer ()
                     36:   "Print buffer contents as with Unix command `lpr -p'.
                     37: `lpr-switches' is a list of extra switches (strings) to pass to lpr."
                     38:   (interactive)
                     39:   (print-region-1 (point-min) (point-max) (cons "-p" lpr-switches)))
                     40: 
                     41: (defun lpr-region (start end)
                     42:   "Print region contents as with Unix command `lpr'.
                     43: `lpr-switches' is a list of extra switches (strings) to pass to lpr."
                     44:   (interactive "r")
                     45:   (print-region-1 start end lpr-switches))
                     46: 
                     47: (defun print-region (start end)
                     48:   "Print region contents as with Unix command `lpr -p'.
                     49: `lpr-switches' is a list of extra switches (strings) to pass to lpr."
                     50:   (interactive "r")
                     51:   (print-region-1 start end (cons "-p" lpr-switches)))
                     52: 
                     53: (defun print-region-1 (start end switches)
                     54:   (let ((name (concat (buffer-name) " Emacs buffer"))
                     55:        (width tab-width))
                     56:     (save-excursion
                     57:      (message "Spooling...")
                     58:      (if (/= tab-width 8)
                     59:         (let ((oldbuf (current-buffer)))
                     60:          (set-buffer (get-buffer-create " *spool temp*"))
                     61:          (widen) (erase-buffer)
                     62:          (insert-buffer-substring oldbuf start end)
                     63:          (setq tab-width width)
                     64:          (untabify (point-min) (point-max))
                     65:          (setq start (point-min) end (point-max))))
                     66:      (apply 'call-process-region
                     67:            (nconc (list start end lpr-command
                     68:                         nil nil nil)
                     69:                   (nconc (and (eq system-type 'berkeley-unix)
                     70:                               (list "-J" name "-T" name))
                     71:                          switches)))
                     72:      (message "Spooling...done"))))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.