X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4ad25e4311961dd134b167fd51a3d968f58bd728..6978c919f6961fc66b00ae88ddae056ecd68324f:/lisp/lpr.el diff --git a/lisp/lpr.el b/lisp/lpr.el index 6f6f3d53b2..c44971e4f3 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -1,9 +1,10 @@ -;;; lpr.el --- print Emacs buffer on line printer. +;;; lpr.el --- print Emacs buffer on line printer -;; Copyright (C) 1985, 1988, 1992, 1994, 2001 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1988, 1992, 1994, 2001, 2002, 2003, +;; 2004, 2005 Free Software Foundation, Inc. -;; Maintainer: FSF -;; Keywords: unix +;; Maintainer: FSF +;; Keywords: unix ;; This file is part of GNU Emacs. @@ -19,26 +20,28 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: -;; Commands to send the region or a buffer your printer. Entry points -;; are `lpr-buffer', `print-buffer', lpr-region', or `print-region'; option +;; Commands to send the region or a buffer to your printer. Entry points +;; are `lpr-buffer', `print-buffer', `lpr-region', or `print-region'; option ;; variables include `printer-name', `lpr-switches' and `lpr-command'. ;;; Code: +;;;###autoload (defvar lpr-windows-system (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt))) +;;;###autoload (defvar lpr-lp-system (memq system-type '(usg-unix-v dgux hpux irix))) (defgroup lpr nil - "Print Emacs buffer on line printer" + "Print Emacs buffer on line printer." :group 'wp) @@ -74,8 +77,8 @@ See `lpr-command'." :type '(repeat (string :tag "Argument")) :group 'lpr) -(defcustom lpr-add-switches (eq system-type 'berkeley-unix) - "*Non-nil means construct -T and -J options for the printer program. +(defcustom lpr-add-switches (memq system-type '(berkeley-unix gnu/linux)) + "*Non-nil means construct `-T' and `-J' options for the printer program. These are made assuming that the program is `lpr'; if you are using some other incompatible printer program, this variable should be nil." @@ -127,7 +130,7 @@ and print the result." (defcustom print-region-function nil "Function to call to print the region on a printer. See definition of `print-region-1' for calling conventions." - :type 'function + :type '(choice (const nil) function) :group 'lpr) (defcustom lpr-page-header-program "pr" @@ -137,7 +140,7 @@ See definition of `print-region-1' for calling conventions." ;; Berkeley systems support -F, and GNU pr supports both -f and -F, ;; So it looks like -F is a better default. -(defcustom lpr-page-header-switches '("-h" "-F") +(defcustom lpr-page-header-switches '("-F") "*List of strings to use as options for the page-header-generating program. The variable `lpr-page-header-program' specifies the program to use." :type '(repeat string) @@ -162,7 +165,7 @@ If it is nil (the default), we run the `pr' program (or whatever program Otherwise, the switches in `lpr-headers-switches' are used in the print command itself; we expect them to request pagination. - + See the variables `lpr-switches' and `lpr-command' for further customization of the printer command." (interactive) @@ -187,7 +190,7 @@ If it is nil (the default), we run the `pr' program (or whatever program Otherwise, the switches in `lpr-headers-switches' are used in the print command itself; we expect them to request pagination. - + See the variables `lpr-switches' and `lpr-command' for further customization of the printer command." (interactive "r") @@ -240,7 +243,8 @@ for further customization of the printer command." (let ((new-coords (print-region-new-buffer start end))) (apply 'call-process-region (car new-coords) (cdr new-coords) lpr-page-header-program t t nil - lpr-page-header-switches)) + (nconc (list "-h" title) + lpr-page-header-switches))) (setq start (point-min) end (point-max)))) (apply (or print-region-function 'call-process-region) @@ -280,14 +284,16 @@ The printable representations use ^ (for ASCII control characters) or hex. The characters tab, linefeed, space, return and formfeed are not affected." (interactive "r") (save-excursion - (goto-char begin) - (let (c) - (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" end t) - (setq c (preceding-char)) - (delete-backward-char 1) - (insert (if (< c ?\ ) - (format "\\^%c" (+ c ?@)) - (format "\\%02x" c))))))) + (save-restriction + (narrow-to-region begin end) + (goto-char (point-min)) + (let (c) + (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" nil t) + (setq c (preceding-char)) + (delete-backward-char 1) + (insert (if (< c ?\s) + (format "\\^%c" (+ c ?@)) + (format "\\%02x" c)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions hacked from `ps-print' package. @@ -320,4 +326,5 @@ The characters tab, linefeed, space, return and formfeed are not affected." (provide 'lpr) +;;; arch-tag: 21c3f821-ebec-4ca9-ac67-a81e4b75c62a ;;; lpr.el ends here