]> code.delx.au - gnu-emacs/blobdiff - lisp/lpr.el
*** empty log message ***
[gnu-emacs] / lisp / lpr.el
index 7b827704cad331dd1dc5b48f4d6fe44d6f6dd694..4df98d6d7515da5f5cf2cb0c3e351f29be641262 100644 (file)
@@ -1,7 +1,7 @@
 ;;; lpr.el --- print Emacs buffer on line printer
 
-;; Copyright (C) 1985, 1988, 1992, 1994, 2001, 2003
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1988, 1992, 1994, 2001, 2002, 2003,
+;;   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: unix
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -20,8 +20,8 @@
 
 ;; 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:
 
@@ -41,7 +41,7 @@
 
 
 (defgroup lpr nil
-  "Print Emacs buffer on line printer"
+  "Print Emacs buffer on line printer."
   :group 'wp)
 
 
@@ -140,8 +140,10 @@ 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 '("-F")
+(defcustom lpr-page-header-switches '("-h" "%s" "-F")
   "*List of strings to use as options for the page-header-generating program.
+If `%s' appears in any of the strings, it is substituted by the page title.
+Note that for correct quoting, `%s' should normally be a separate element.
 The variable `lpr-page-header-program' specifies the program to use."
   :type '(repeat string)
   :group 'lpr)
@@ -243,8 +245,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
-                    (nconc (list "-h" title)
-                           lpr-page-header-switches)))
+                    (mapcar (lambda (e) (format e title))
+                            lpr-page-header-switches)))
            (setq start (point-min)
                  end   (point-max))))
       (apply (or print-region-function 'call-process-region)
@@ -291,7 +293,7 @@ The characters tab, linefeed, space, return and formfeed are not affected."
        (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" nil t)
          (setq c (preceding-char))
          (delete-backward-char 1)
-         (insert (if (< c ?\ )
+         (insert (if (< c ?\s)
                      (format "\\^%c" (+ c ?@))
                    (format "\\%02x" c))))))))
 
@@ -326,4 +328,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