(font-lock-turn-off-thing-lock, font-lock-after-fontify-buffer)
[bpt/emacs.git] / lisp / ps-print.el
index c327c25..d3b3e1d 100644 (file)
@@ -1,7 +1,8 @@
 ;;; ps-print.el --- print text from the buffer as PostScript
 
 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-;;   2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2002, 2003, 2004, 2005, 2006, 2007, 2008
+;;   Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
 ;;     Jacques Duthen (was <duthen@cegelec-red.fr>)
 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters)
 ;;     Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
-;; Version: 7.3.1
+;; Version: 7.3.2
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
-(defconst ps-print-version "7.3.1"
-  "ps-print.el, v 7.3.1 <2007/11/09 vinicius>
+(defconst ps-print-version "7.3.2"
+  "ps-print.el, v 7.3.2 <2008/01/09 vinicius>
 
 Vinicius's last change version -- this file may have been edited as part of
 Emacs without changes to the version number.  When reporting bugs, please also
@@ -25,19 +26,18 @@ Please send all bug fixes and enhancements to
 
 ;; This file is part of GNU Emacs.
 
-;; 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 3, or (at your option) any later
-;; version.
+;; 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 3 of the License, or
+;; (at your option) any later version.
 
-;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY
-;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-;; details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
-;; 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -1474,7 +1474,7 @@ Please send all bug fixes and enhancements to
 (defconst ps-windows-system
   (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)))
 (defconst ps-lp-system
-  (memq system-type '(usg-unix-v dgux hpux irix)))
+  (memq system-type '(usg-unix-v hpux irix)))
 
 
 ;; Load XEmacs/Emacs definitions
@@ -1752,7 +1752,28 @@ an explicit filename is given as the last argument."
   :group 'ps-print-printer)
 
 (defcustom ps-lpr-switches lpr-switches
-  "*A list of extra switches to pass to `ps-lpr-command'."
+  "*List of extra switches to pass to `ps-lpr-command'.
+
+The list element can be:
+
+   string      it should be an option for `ps-lpr-command' (which see).
+               For example: \"-o Duplex=DuplexNoTumble\"
+
+   symbol      it can be a function or variable symbol.  If it's a function
+               symbol, it should be a function with no argument.  The result
+               of the function or the variable value should be a string or a
+               list of strings.
+
+   list                the header should be a symbol function and the tail is the
+               arguments for this function.  This function should return a
+               string or a list of strings.
+
+Any other value is silently ignored.
+
+It is recommended to set `ps-printer-name' (which see) instead of including an
+explicit switch on this list.
+
+See `ps-lpr-command'."
   :type '(repeat :tag "PostScript lpr Switches"
                 (choice :menu-tag "PostScript lpr Switch"
                         :tag "PostScript lpr Switch"
@@ -6340,9 +6361,12 @@ If FACE is not a valid face name, use default face."
 
 (defun ps-screen-to-bit-face (face)
   (cons face
-       (vector (logior (if (ps-face-bold-p face) 1 0) ; bold
-                       (if (ps-face-italic-p face) 2 0) ; italic
-                       (if (ps-face-underlined-p face) 4 0)) ; underline
+       (vector (logior (if (ps-face-bold-p face)       1 0)  ; bold
+                       (if (ps-face-italic-p face)     2 0)  ; italic
+                       (if (ps-face-underlined-p face) 4 0)  ; underline
+                       (if (ps-face-strikeout-p face)  8 0)  ; strikeout
+                       (if (ps-face-overline-p face)  16 0)  ; overline
+                       (if (ps-face-box-p face)       64 0)) ; box
                (ps-face-foreground-name face)
                (ps-face-background-name face))))
 
@@ -6385,6 +6409,12 @@ If FACE is not a valid face name, use default face."
 (defun ps-generate-postscript (from to)
   (ps-plot-region from to 0))
 
+;; These are autoloaded, but ps-mule generates autoloads at the end of
+;; this file, so they are unknown at this point when compiling.
+(declare-function ps-mule-initialize "ps-mule" ())
+(declare-function ps-mule-begin-job  "ps-mule" (from to))
+(declare-function ps-mule-end-job    "ps-mule" ())
+
 (defun ps-generate (buffer from to genfunc)
   (save-excursion
     (let ((from (min to from))
@@ -6526,10 +6556,23 @@ If FACE is not a valid face name, use default face."
                 (and (fboundp 'start-process) 0)
                 nil
                 (ps-flatten-list       ; dynamic evaluation
-                 (mapcar 'ps-eval-switch ps-lpr-switches)))))
+                 (ps-string-list
+                  (mapcar 'ps-eval-switch ps-lpr-switches))))))
       (and ps-razzle-dazzle (message "Printing...done")))
     (kill-buffer ps-spool-buffer)))
 
+(defun ps-string-list (arg)
+  (let (lstr)
+    (dolist (elm arg)
+      (cond ((stringp elm)
+            (setq lstr (cons elm lstr)))
+           ((listp elm)
+            (let ((s (ps-string-list elm)))
+              (when s
+                (setq lstr (cons s lstr)))))
+           (t )))                      ; ignore any other value
+    (nreverse lstr)))
+
 ;; Dynamic evaluation
 (defun ps-eval-switch (arg)
   (cond ((stringp arg) arg)
@@ -6580,7 +6623,7 @@ If FACE is not a valid face name, use default face."
 ;; But autoload them here to make the separation invisible.
 \f
 ;;;### (autoloads (ps-mule-end-job ps-mule-begin-job ps-mule-initialize
-;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" "ba0ba38bf1f9831ca12701290fd4b211")
+;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" "a17af1e83e9b0292c042c259cdccdde3")
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\