;;; 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, 2008
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1993-2013 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.2
+;; Version: 7.3.5
;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
-(defconst ps-print-version "7.3.2"
- "ps-print.el, v 7.3.2 <2008/01/09 vinicius>
+(defconst ps-print-version "7.3.5"
+ "ps-print.el, v 7.3.5 <2009/12/23 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
;; 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:
;; (setq ps-font-info-database '(<your stuff> <the standard stuff>))
;; or, use `ps-print-hook' (see section Hooks):
;; (add-hook 'ps-print-hook
-;; '(lambda ()
+;; (lambda ()
;; (or (assq 'Helvetica ps-font-info-database)
;; (setq ps-font-info-database (append ...)))))
;;
;; variables `ps-bold-faces', `ps-italic-faces' and `ps-underlined-faces'.
;; These variables contain lists of faces that ps-print should consider bold,
;; italic or underline; to set them, put code like the following into your
-;; .emacs file:
+;; init file:
;;
;; (setq ps-bold-faces '(my-blue-face))
;; (setq ps-italic-faces '(my-red-face))
;; foreground colors to be used when text foreground and background colors are
;; equals. It'll be used the first foreground color in `ps-fg-list' which is
;; different from the background color. If `ps-fg-list' is nil, the default
-;; foreground color is used.
+;; foreground color is used.
;;
;;
;; How Ps-Print Maps Faces
;; Acknowledgments
;; ---------------
;;
+;; Thanks to Eduard Wiebe <usenet@pusto.de> for fixing face
+;; background/foreground extraction.
+;;
+;; Thanks to Friedrich Delgado Friedrichs <friedel@nomaden.org> for new label
+;; printer page sizes.
+;;
;; Thanks to Michael Piotrowski <mxp@dynalabs.de> for improving the DSC
;; compliance of the generated PostScript.
;;
(require 'lpr)
-(or (featurep 'lisp-float-type)
- (error "`ps-print' requires floating point support"))
-
-
(if (featurep 'xemacs)
- ()
+ (or (featurep 'lisp-float-type)
+ (error "`ps-print' requires floating point support"))
(unless (and (boundp 'emacs-major-version)
(>= emacs-major-version 23))
(error "`ps-print' only supports Emacs 23 and higher")))
-(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 hpux irix)))
-
-
;; Load XEmacs/Emacs definitions
-(eval-and-compile (require 'ps-def))
+(require 'ps-def)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Interface to the command system
(defgroup postscript nil
- "PostScript Group."
+ "Support for printing and PostScript."
:tag "PostScript"
:version "20"
- :group 'emacs)
+ :group 'external)
(defgroup ps-print nil
"PostScript generator for Emacs."
(defcustom ps-error-handler-message 'paper
- "*Specify where the error handler message should be sent.
+ "Specify where the error handler message should be sent.
Valid values are:
:group 'ps-print-miscellany)
(defcustom ps-user-defined-prologue nil
- "*User defined PostScript prologue code inserted before all prologue code.
+ "User defined PostScript prologue code inserted before all prologue code.
`ps-user-defined-prologue' may be a string or a symbol function which returns a
string. Note that this string is inserted after `ps-adobe-tag' and PostScript
:group 'ps-print-miscellany)
(defcustom ps-print-prologue-header nil
- "*PostScript prologue header comments besides that ps-print generates.
+ "PostScript prologue header comments besides that ps-print generates.
`ps-print-prologue-header' may be a string or a symbol function which returns a
string. Note that this string is inserted on PostScript prologue header
:version "20"
:group 'ps-print-miscellany)
-(defcustom ps-printer-name (and (boundp 'printer-name)
- (symbol-value 'printer-name))
- "*The name of a local printer for printing PostScript files.
+(defcustom ps-printer-name nil
+ "The name of a local printer for printing PostScript files.
On Unix-like systems, a string value should be a name understood by lpr's -P
option; a value of nil means use the value of `printer-name' instead.
:group 'ps-print-printer)
(defcustom ps-printer-name-option
- (cond (ps-windows-system
- "/D:")
- (ps-lp-system
- "-d")
- (t
- "-P" ))
- "*Option for `ps-printer-name' variable (see it).
+ (cond (lpr-windows-system "/D:")
+ (t lpr-printer-switch))
+ "Option for `ps-printer-name' variable (see it).
On Unix-like systems, if `lpr' is in use, this should be the string
\"-P\"; if `lp' is in use, this should be the string \"-d\".
needs an empty printer name option--that is, pass the printer name
with no special option preceding it.
-Any value that is not a string is treated as nil.
-
This variable is used only when `ps-printer-name' is a non-empty string."
:type '(choice :menu-tag "Printer Name Option"
:tag "Printer Name Option"
:group 'ps-print-printer)
(defcustom ps-lpr-command lpr-command
- "*Name of program for printing a PostScript file.
+ "Name of program for printing a PostScript file.
On MS-DOS and MS-Windows systems, if the value is an empty string then Emacs
will write directly to the printer port named by `ps-printer-name'. The
:group 'ps-print-printer)
(defcustom ps-lpr-switches lpr-switches
- "*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:
:version "20"
:group 'ps-print-printer)
-(defcustom ps-print-region-function nil
- "*Specify a function to print the region on a PostScript printer.
+(defcustom ps-print-region-function
+ (if (memq system-type '(ms-dos windows-nt))
+ #'direct-ps-print-region-function
+ #'call-process-region)
+ "Specify a function to print the region on a PostScript printer.
See definition of `call-process-region' for calling conventions. The fourth
and the sixth arguments are both nil."
- :type '(choice (const nil) function)
+ :type 'function
:version "20"
:group 'ps-print-printer)
(defcustom ps-manual-feed nil
- "*Non-nil means the printer will manually feed paper.
+ "Non-nil means the printer will manually feed paper.
If it's nil, automatic feeding takes place."
:type 'boolean
:version "20"
:group 'ps-print-printer)
-(defcustom ps-end-with-control-d (and ps-windows-system t)
- "*Non-nil means insert C-d at end of PostScript file generated."
+(defcustom ps-end-with-control-d (and lpr-windows-system t)
+ "Non-nil means insert C-d at end of PostScript file generated."
:version "21.1"
:type 'boolean
:version "20"
;;;###autoload
(defcustom ps-page-dimensions-database
- (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4")
- (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3")
- (list 'letter (* 72 8.5) (* 72 11.0) "Letter")
- (list 'legal (* 72 8.5) (* 72 14.0) "Legal")
- (list 'letter-small (* 72 7.68) (* 72 10.16) "LetterSmall")
- (list 'tabloid (* 72 11.0) (* 72 17.0) "Tabloid")
- (list 'ledger (* 72 17.0) (* 72 11.0) "Ledger")
- (list 'statement (* 72 5.5) (* 72 8.5) "Statement")
- (list 'executive (* 72 7.5) (* 72 10.0) "Executive")
- (list 'a4small (* 72 7.47) (* 72 10.85) "A4Small")
- (list 'b4 (* 72 10.125) (* 72 14.33) "B4")
- (list 'b5 (* 72 7.16) (* 72 10.125) "B5"))
- "*List associating a symbolic paper type to its width, height and doc media.
+ (purecopy
+ (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4")
+ (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3")
+ (list 'letter (* 72 8.5) (* 72 11.0) "Letter")
+ (list 'legal (* 72 8.5) (* 72 14.0) "Legal")
+ (list 'letter-small (* 72 7.68) (* 72 10.16) "LetterSmall")
+ (list 'tabloid (* 72 11.0) (* 72 17.0) "Tabloid")
+ (list 'ledger (* 72 17.0) (* 72 11.0) "Ledger")
+ (list 'statement (* 72 5.5) (* 72 8.5) "Statement")
+ (list 'executive (* 72 7.5) (* 72 10.0) "Executive")
+ (list 'a4small (* 72 7.47) (* 72 10.85) "A4Small")
+ (list 'b4 (* 72 10.125) (* 72 14.33) "B4")
+ (list 'b5 (* 72 7.16) (* 72 10.125) "B5")
+ ;; page sizes for label printer
+ ;; NOTE: the page sizes below don't have n-up > 1.
+ '(addresslarge 236.0 99.0 "AddressLarge")
+ '(addresssmall 236.0 68.0 "AddressSmall")
+ '(cuthanging13 90.0 222.0 "CutHanging13")
+ '(cuthanging15 90.0 114.0 "CutHanging15")
+ '(diskette 181.0 136.0 "Diskette")
+ '(eurofilefolder 139.0 112.0 "EuropeanFilefolder")
+ '(eurofoldernarrow 526.0 107.0 "EuroFolderNarrow")
+ '(eurofolderwide 526.0 136.0 "EuroFolderWide")
+ '(euronamebadge 189.0 108.0 "EuroNameBadge")
+ '(euronamebadgelarge 223.0 136.0 "EuroNameBadgeLarge")
+ '(filefolder 230.0 37.0 "FileFolder")
+ '(jewelry 76.0 136.0 "Jewelry")
+ '(mediabadge 180.0 136.0 "MediaBadge")
+ '(multipurpose 126.0 68.0 "MultiPurpose")
+ '(retaillabel 90.0 104.0 "RetailLabel")
+ '(shipping 271.0 136.0 "Shipping")
+ '(slide35mm 26.0 104.0 "Slide35mm")
+ '(spine8mm 187.0 26.0 "Spine8mm")
+ '(topcoated 425.19685 136.0 "TopCoatedPaper")
+ '(topcoatedpaper 396.0 136.0 "TopcoatedPaper150")
+ '(vhsface 205.0 127.0 "VHSFace")
+ '(vhsspine 400.0 50.0 "VHSSpine")
+ '(zipdisk 156.0 136.0 "ZipDisk")))
+ "List associating a symbolic paper type to its width, height and doc media.
See `ps-paper-type'."
:type '(repeat (list :tag "Paper Type"
- (symbol :tag "Name")
- (number :tag "Width")
- (number :tag "Height")
+ (symbol :tag "Symbol Name")
+ (number :tag "Width in points")
+ (number :tag "Height in points")
(string :tag "Media")))
:version "20"
:group 'ps-print-page)
;;;###autoload
(defcustom ps-paper-type 'letter
- "*Specify the size of paper to format for.
+ "Specify the size of paper to format for.
Should be one of the paper types defined in `ps-page-dimensions-database', for
example `letter', `legal' or `a4'."
:type '(symbol :validate (lambda (wid)
:group 'ps-print-page)
(defcustom ps-warn-paper-type t
- "*Non-nil means give an error if paper size is not equal to `ps-paper-type'.
+ "Non-nil means give an error if paper size is not equal to `ps-paper-type'.
It's used when `ps-spool-config' is set to `setpagedevice'."
:type 'boolean
:group 'ps-print-page)
(defcustom ps-landscape-mode nil
- "*Non-nil means print in landscape mode."
+ "Non-nil means print in landscape mode."
:type 'boolean
:version "20"
:group 'ps-print-page)
(defcustom ps-print-upside-down nil
- "*Non-nil means print upside-down (that is, rotated by 180 degrees)."
+ "Non-nil means print upside-down (that is, rotated by 180 degrees)."
:type 'boolean
:version "21.1"
:group 'ps-print-page)
(defcustom ps-selected-pages nil
- "*Specify which pages to print.
+ "Specify which pages to print.
If nil, print all pages.
:group 'ps-print-page)
(defcustom ps-even-or-odd-pages nil
- "*Specify if it prints even/odd pages.
+ "Specify if it prints even/odd pages.
Valid values are:
Any other value is treated as nil.
-If you set `ps-selected-pages' (see it for documentation), first the pages are
-filtered by `ps-selected-pages' and then by `ps-even-or-odd-pages'. For
-example, if we have:
+If you set option `ps-selected-pages', first the pages are
+filtered by option `ps-selected-pages' and then by `ps-even-or-odd-pages'.
+For example, if we have:
(setq ps-selected-pages '(1 4 (6 . 10) (12 . 16) 20))
-Combining with `ps-even-or-odd-pages' and `ps-n-up-printing', we have:
+Combining with `ps-even-or-odd-pages' and option `ps-n-up-printing', we have:
`ps-n-up-printing' = 1:
`ps-even-or-odd-pages' PAGES PRINTED
:group 'ps-print-page)
(defcustom ps-print-control-characters 'control-8-bit
- "*Specify the printable form for control and 8-bit characters.
+ "Specify the printable form for control and 8-bit characters.
That is, instead of sending, for example, a ^D (\\004) to printer,
it is sent the string \"^D\".
:group 'ps-print-miscellany)
(defcustom ps-n-up-printing 1
- "*Specify the number of pages per sheet paper."
+ "Specify the number of pages per sheet paper."
:type '(integer
:tag "N Up Printing"
:validate
:group 'ps-print-n-up)
(defcustom ps-n-up-margin (/ (* 72 1.0) 2.54) ; 1 cm
- "*Specify the margin in points between the sheet border and n-up printing."
+ "Specify the margin in points between the sheet border and n-up printing."
:type 'number
:version "20"
:group 'ps-print-n-up)
(defcustom ps-n-up-border-p t
- "*Non-nil means a border is drawn around each page."
+ "Non-nil means a border is drawn around each page."
:type 'boolean
:version "20"
:group 'ps-print-n-up)
(defcustom ps-n-up-filling 'left-top
- "*Specify how page matrix is filled on each sheet of paper.
+ "Specify how page matrix is filled on each sheet of paper.
Following are the valid values for `ps-n-up-filling' with a filling example
using a 3x4 page matrix:
:group 'ps-print-n-up)
(defcustom ps-number-of-columns (if ps-landscape-mode 2 1)
- "*Specify the number of columns."
+ "Specify the number of columns."
:type 'number
:version "20"
:group 'ps-print-miscellany)
(defcustom ps-zebra-stripes nil
- "*Non-nil means print zebra stripes.
+ "Non-nil means print zebra stripes.
See also documentation for `ps-zebra-stripe-height' and `ps-zebra-color'."
:type 'boolean
:version "20"
:group 'ps-print-zebra)
(defcustom ps-zebra-stripe-height 3
- "*Number of zebra stripe lines.
+ "Number of zebra stripe lines.
See also documentation for `ps-zebra-stripes' and `ps-zebra-color'."
:type 'number
:version "20"
:group 'ps-print-zebra)
(defcustom ps-zebra-color 0.95
- "*Zebra stripe gray scale or RGB color.
+ "Zebra stripe gray scale or RGB color.
See also documentation for `ps-zebra-stripes' and `ps-zebra-stripe-height'."
:type '(choice :menu-tag "Zebra Gray/Color"
:tag "Zebra Gray/Color"
:group 'ps-print-zebra)
(defcustom ps-zebra-stripe-follow nil
- "*Specify how zebra stripes continue on next page.
+ "Specify how zebra stripes continue on next page.
Visually, valid values are (the character `+' at right of each column indicates
that a line is printed):
:group 'ps-print-zebra)
(defcustom ps-line-number nil
- "*Non-nil means print line number."
+ "Non-nil means print line number."
:type 'boolean
:version "20"
:group 'ps-print-miscellany)
(defcustom ps-line-number-step 1
- "*Specify the interval that line number is printed.
+ "Specify the interval that line number is printed.
For example, `ps-line-number-step' is set to 2, the printing will look like:
:group 'ps-print-miscellany)
(defcustom ps-line-number-start 1
- "*Specify the starting point in the interval given by `ps-line-number-step'.
+ "Specify the starting point in the interval given by `ps-line-number-step'.
For example, if `ps-line-number-step' is set to 3 and `ps-line-number-start' is
set to 3, the printing will look like:
:group 'ps-print-miscellany)
(defcustom ps-print-background-image nil
- "*EPS image list to be printed on background.
+ "EPS image list to be printed on background.
The elements are:
:group 'ps-print-background)
(defcustom ps-print-background-text nil
- "*Text list to be printed on background.
+ "Text list to be printed on background.
The elements are:
;; ------------------------------------------
(defcustom ps-left-margin (/ (* 72 2.0) 2.54) ; 2 cm
- "*Left margin in points (1/72 inch)."
+ "Left margin in points (1/72 inch)."
:type 'number
:version "20"
:group 'ps-print-horizontal)
(defcustom ps-right-margin (/ (* 72 2.0) 2.54) ; 2 cm
- "*Right margin in points (1/72 inch)."
+ "Right margin in points (1/72 inch)."
:type 'number
:version "20"
:group 'ps-print-horizontal)
(defcustom ps-inter-column (/ (* 72 2.0) 2.54) ; 2 cm
- "*Horizontal space between columns in points (1/72 inch)."
+ "Horizontal space between columns in points (1/72 inch)."
:type 'number
:version "20"
:group 'ps-print-horizontal)
;; |--------|
(defcustom ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
- "*Bottom margin in points (1/72 inch)."
+ "Bottom margin in points (1/72 inch)."
:type 'number
:version "20"
:group 'ps-print-vertical)
(defcustom ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
- "*Top margin in points (1/72 inch)."
+ "Top margin in points (1/72 inch)."
:type 'number
:version "20"
:group 'ps-print-vertical)
(defcustom ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
- "*Vertical space in points (1/72 inch) between the main text and the header."
+ "Vertical space in points (1/72 inch) between the main text and the header."
:type 'number
:version "20"
:group 'ps-print-vertical)
(defcustom ps-header-line-pad 0.15
- "*Portion of a header title line height to insert.
+ "Portion of a header title line height to insert.
The insertion is done between the header frame and the text it contains,
both in the vertical and horizontal directions."
:type 'number
:group 'ps-print-vertical)
(defcustom ps-footer-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
- "*Vertical space in points (1/72 inch) between the main text and the footer."
+ "Vertical space in points (1/72 inch) between the main text and the footer."
:type 'number
:version "20"
:group 'ps-print-vertical)
(defcustom ps-footer-line-pad 0.15
- "*Portion of a footer title line height to insert.
+ "Portion of a footer title line height to insert.
The insertion is done between the footer frame and the text it contains,
both in the vertical and horizontal directions."
:type 'number
;;; Header/Footer setup
(defcustom ps-print-header t
- "*Non-nil means print a header at the top of each page.
+ "Non-nil means print a header at the top of each page.
By default, the header displays the buffer name, page number, and, if the
buffer is visiting a file, the file's directory. Headers are customizable by
changing variables `ps-left-header' and `ps-right-header'."
:group 'ps-print-headers)
(defcustom ps-print-header-frame t
- "*Non-nil means draw a gaudy frame around the header."
+ "Non-nil means draw a gaudy frame around the header."
:type 'boolean
:version "20"
:group 'ps-print-headers)
(border-width . 0.4)
(border-color . 0.0)
(shadow-color . 0.0))
- "*Specify header frame properties alist.
+ "Specify header frame properties alist.
Valid frame properties are:
:group 'ps-print-headers)
(defcustom ps-header-lines 2
- "*Number of lines to display in page header, when generating PostScript."
+ "Number of lines to display in page header, when generating PostScript."
:type 'integer
:version "20"
:group 'ps-print-headers)
(defcustom ps-print-footer nil
- "*Non-nil means print a footer at the bottom of each page.
+ "Non-nil means print a footer at the bottom of each page.
By default, the footer displays page number.
Footers are customizable by changing variables `ps-left-footer' and
`ps-right-footer'."
:group 'ps-print-headers)
(defcustom ps-print-footer-frame t
- "*Non-nil means draw a gaudy frame around the footer."
+ "Non-nil means draw a gaudy frame around the footer."
:type 'boolean
:version "21.1"
:group 'ps-print-headers)
(border-width . 0.4)
(border-color . 0.0)
(shadow-color . 0.0))
- "*Specify footer frame properties alist.
+ "Specify footer frame properties alist.
Don't change this alist directly, instead use customization, or `ps-value',
`ps-get', `ps-put' and `ps-del' functions (see them for documentation).
:group 'ps-print-headers)
(defcustom ps-footer-lines 2
- "*Number of lines to display in page footer, when generating PostScript."
+ "Number of lines to display in page footer, when generating PostScript."
:type 'integer
:version "21.1"
:group 'ps-print-headers)
(defcustom ps-print-only-one-header nil
- "*Non-nil means print only one header/footer at the top/bottom of each page.
+ "Non-nil means print only one header/footer at the top/bottom of each page.
This is useful when printing more than one column, so it is possible to have
only one header/footer over all columns or one header/footer per column.
See also `ps-print-header' and `ps-print-footer'."
:group 'ps-print-headers)
(defcustom ps-switch-header 'duplex
- "*Specify if headers/footers are switched or not.
+ "Specify if headers/footers are switched or not.
Valid values are:
:group 'ps-print-headers)
(defcustom ps-show-n-of-n t
- "*Non-nil means show page numbers as N/M, meaning page N of M.
+ "Non-nil means show page numbers as N/M, meaning page N of M.
NOTE: page numbers are displayed as part of headers,
see variable `ps-print-header'."
:type 'boolean
:group 'ps-print-headers)
(defcustom ps-spool-config
- (if ps-windows-system
+ (if lpr-windows-system
nil
'lpr-switches)
- "*Specify who is responsible for setting duplex and page size.
+ "Specify who is responsible for setting duplex and page size.
Valid values are:
(defcustom ps-spool-duplex nil ; Not many people have duplex printers,
; so default to nil.
- "*Non-nil generates PostScript for a two-sided printer.
+ "Non-nil generates PostScript for a two-sided printer.
For a duplex printer, the `ps-spool-*' and `ps-print-*' commands will insert
blank pages as needed between print jobs so that the next buffer printed will
start on the right page. Also, if headers are turned on, the headers will be
:group 'ps-print-headers)
(defcustom ps-spool-tumble nil
- "*Specify how the page images on opposite sides of a sheet are oriented.
+ "Specify how the page images on opposite sides of a sheet are oriented.
If `ps-spool-tumble' is nil, produces output suitable for binding on the left
or right. If `ps-spool-tumble' is non-nil, produces output suitable for
binding at the top or bottom.
(space-width . 2.2)
(avg-char-width . 4.10811))
)
- "*Font info database.
+ "Font info database.
Each element comprises: font family (the key), name, bold, italic, bold-italic,
reference size, line height, space width, average character width.
To get the info for another specific font (say Helvetica), do the following:
:group 'ps-print-font)
(defcustom ps-font-family 'Courier
- "*Font family name for ordinary text, when generating PostScript."
+ "Font family name for ordinary text, when generating PostScript."
:type 'symbol
:version "20"
:group 'ps-print-font)
(defcustom ps-font-size '(7 . 8.5)
- "*Font size, in points, for ordinary text, when generating PostScript.
+ "Font size, in points, for ordinary text, when generating PostScript.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)."
:type '(choice :menu-tag "Ordinary Text Font Size"
:tag "Ordinary Text Font Size"
:group 'ps-print-font)
(defcustom ps-header-font-family 'Helvetica
- "*Font family name for text in the header, when generating PostScript."
+ "Font family name for text in the header, when generating PostScript."
:type 'symbol
:version "20"
:group 'ps-print-font)
(defcustom ps-header-font-size '(10 . 12)
- "*Font size, in points, for text in the header, when generating PostScript.
+ "Font size, in points, for text in the header, when generating PostScript.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)."
:type '(choice :menu-tag "Header Font Size"
:tag "Header Font Size"
:group 'ps-print-font)
(defcustom ps-header-title-font-size '(12 . 14)
- "*Font size, in points, for the top line of text in header, in PostScript.
+ "Font size, in points, for the top line of text in header, in PostScript.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)."
:type '(choice :menu-tag "Header Title Font Size"
:tag "Header Title Font Size"
:group 'ps-print-font)
(defcustom ps-footer-font-family 'Helvetica
- "*Font family name for text in the footer, when generating PostScript."
+ "Font family name for text in the footer, when generating PostScript."
:type 'symbol
:version "21.1"
:group 'ps-print-font)
(defcustom ps-footer-font-size '(10 . 12)
- "*Font size, in points, for text in the footer, when generating PostScript.
+ "Font size, in points, for text in the footer, when generating PostScript.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)."
:type '(choice :menu-tag "Footer Font Size"
:tag "Footer Font Size"
:group 'ps-print-font)
(defcustom ps-line-number-color "black"
- "*Specify color for line-number, when generating PostScript."
+ "Specify color for line-number, when generating PostScript."
:type '(choice :menu-tag "Line Number Color"
:tag "Line Number Color"
(number :tag "Gray Scale" :value 0)
:group 'ps-print-miscellany)
(defcustom ps-line-number-font "Times-Italic"
- "*Font for line-number, when generating PostScript."
+ "Font for line-number, when generating PostScript."
:type 'string
:version "20"
:group 'ps-print-font
:group 'ps-print-miscellany)
(defcustom ps-line-number-font-size 6
- "*Font size, in points, for line number, when generating PostScript.
+ "Font size, in points, for line number, when generating PostScript.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)."
:type '(choice :menu-tag "Line Number Font Size"
:tag "Line Number Font Size"
(or (fboundp 'x-color-values) ; Emacs
(fboundp 'color-instance-rgb-components))
; XEmacs
- "*Specify how buffer's text color is printed.
+ "Specify how buffer's text color is printed.
Valid values are:
:group 'ps-print-color)
(defcustom ps-default-fg nil
- "*RGB values of the default foreground color.
+ "RGB values of the default foreground color.
The `ps-default-fg' variable contains the default foreground color used by
ps-print, that is, if there is a face in a text that doesn't have a foreground
This variable is used only when `ps-print-color-p' (which see) is neither nil
nor black-white."
:type '(choice :menu-tag "Default Foreground Gray/Color"
- :tag "Default Foreground Gray/Color"
(const :tag "Session Foreground" t)
(const :tag "Frame Foreground" frame-parameter)
(number :tag "Gray Scale" :value 0.0)
(list :tag "RGB Color" :value (0.0 0.0 0.0)
(number :tag "Red")
(number :tag "Green")
- (number :tag "Blue")))
+ (number :tag "Blue"))
+ (other :tag "Default Foreground Gray/Color" nil))
:version "20"
:group 'ps-print-color)
(defcustom ps-default-bg nil
- "*RGB values of the default background color.
+ "RGB values of the default background color.
The `ps-default-bg' variable contains the default background color used by
ps-print, that is, if there is a face in a text that doesn't have a background
See also `ps-use-face-background'."
:type '(choice :menu-tag "Default Background Gray/Color"
- :tag "Default Background Gray/Color"
(const :tag "Session Background" t)
(const :tag "Frame Background" frame-parameter)
(number :tag "Gray Scale" :value 1.0)
(list :tag "RGB Color" :value (1.0 1.0 1.0)
(number :tag "Red")
(number :tag "Green")
- (number :tag "Blue")))
+ (number :tag "Blue"))
+ (other :tag "Default Background Gray/Color" nil))
:version "20"
:group 'ps-print-color)
(defcustom ps-fg-list nil
- "*Specify foreground color list.
+ "Specify foreground color list.
This list is used to chose a text foreground color which is different than the
background color. It'll be used the first foreground color in `ps-fg-list'
:group 'ps-print-color)
(defcustom ps-fg-validate-p t
- "*Non-nil means validate if foreground color is different than background.
+ "Non-nil means validate if foreground color is different than background.
If text foreground and background colors are equals, no text will appear.
:group 'ps-print-color)
(defcustom ps-auto-font-detect t
- "*Non-nil means automatically detect bold/italic/underline face attributes.
+ "Non-nil means automatically detect bold/italic/underline face attributes.
If nil, we rely solely on the lists `ps-bold-faces', `ps-italic-faces', and
`ps-underlined-faces'."
:type 'boolean
(font-lock-type-face "black" nil italic)
(font-lock-variable-name-face "black" nil bold italic)
(font-lock-warning-face "black" nil bold italic))
- "*Specify list of face attributes to print colors on black/white printers.
+ "Specify list of face attributes to print colors on black/white printers.
The list elements are the same as defined on `ps-extend-face' (which see).
font-lock-variable-name-face
font-lock-keyword-face
font-lock-warning-face))
- "*A list of the \(non-bold\) faces that should be printed in bold font.
+ "A list of the \(non-bold\) faces that should be printed in bold font.
This applies to generating PostScript."
:type '(repeat face)
:version "20"
font-lock-string-face
font-lock-comment-face
font-lock-warning-face))
- "*A list of the \(non-italic\) faces that should be printed in italic font.
+ "A list of the \(non-italic\) faces that should be printed in italic font.
This applies to generating PostScript."
:type '(repeat face)
:version "20"
'(font-lock-function-name-face
font-lock-constant-face
font-lock-warning-face))
- "*A list of the \(non-underlined\) faces that should be printed underlined.
+ "A list of the \(non-underlined\) faces that should be printed underlined.
This applies to generating PostScript."
:type '(repeat face)
:version "20"
:group 'ps-print-face)
(defcustom ps-use-face-background nil
- "*Specify if face background should be used.
+ "Specify if face background should be used.
Valid values are:
(defcustom ps-left-header
(list 'ps-get-buffer-name 'ps-header-dirpart)
- "*The items to display (each on a line) on the left part of the page header.
+ "The items to display (each on a line) on the left part of the page header.
This applies to generating PostScript.
The value should be a list of strings and symbols, each representing an entry
(defcustom ps-right-header
(list "/pagenumberstring load"
'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss)
- "*The items to display (each on a line) on the right part of the page header.
+ "The items to display (each on a line) on the right part of the page header.
This applies to generating PostScript.
See the variable `ps-left-header' for a description of the format of this
(defcustom ps-left-footer
(list 'ps-get-buffer-name 'ps-header-dirpart)
- "*The items to display (each on a line) on the left part of the page footer.
+ "The items to display (each on a line) on the left part of the page footer.
This applies to generating PostScript.
The value should be a list of strings and symbols, each representing an entry
(defcustom ps-right-footer
(list "/pagenumberstring load"
'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss)
- "*The items to display (each on a line) on the right part of the page footer.
+ "The items to display (each on a line) on the right part of the page footer.
This applies to generating PostScript.
See the variable `ps-left-footer' for a description of the format of this
:group 'ps-print-headers)
(defcustom ps-razzle-dazzle t
- "*Non-nil means report progress while formatting buffer."
+ "Non-nil means report progress while formatting buffer."
:type 'boolean
:version "20"
:group 'ps-print-miscellany)
(defcustom ps-adobe-tag "%!PS-Adobe-3.0\n"
- "*Contains the header line identifying the output as PostScript.
+ "Contains the header line identifying the output as PostScript.
By default, `ps-adobe-tag' contains the standard identifier. Some printers
require slightly different versions of this line."
:type 'string
:group 'ps-print-miscellany)
(defcustom ps-build-face-reference t
- "*Non-nil means build the reference face lists.
+ "Non-nil means build the reference face lists.
ps-print sets this value to nil after it builds its internal reference lists of
bold and italic faces. By setting its value back to t, you can force ps-print
:group 'ps-print-face)
(defcustom ps-always-build-face-reference nil
- "*Non-nil means always rebuild the reference face lists.
+ "Non-nil means always rebuild the reference face lists.
If this variable is non-nil, ps-print will rebuild its internal reference lists
of bold and italic faces *every* time one of the ...-with-faces commands is
:group 'ps-print-face)
(defcustom ps-banner-page-when-duplexing nil
- "*Non-nil means the very first page is skipped.
+ "Non-nil means the very first page is skipped.
It's like the very first character of buffer (or region) is ^L (\\014)."
:type 'boolean
:version "20"
:group 'ps-print-headers)
(defcustom ps-postscript-code-directory
- (or (if (featurep 'xemacs)
- (cond ((fboundp 'locate-data-directory) ; XEmacs
- (funcall 'locate-data-directory "ps-print"))
- ((boundp 'data-directory) ; XEmacs
- (symbol-value 'data-directory))
- (t ; don't know what to do
- nil))
- data-directory) ; Emacs
- (error "`ps-postscript-code-directory' isn't set properly"))
- "*Directory where it's located the PostScript prologue file used by ps-print.
+ (cond ((fboundp 'locate-data-directory) ; XEmacs
+ (locate-data-directory "ps-print"))
+ ((boundp 'data-directory) ; XEmacs and Emacs.
+ data-directory)
+ (t ; don't know what to do
+ (error "`ps-postscript-code-directory' isn't set properly")))
+ "Directory where it's located the PostScript prologue file used by ps-print.
By default, this directory is the same as in the variable `data-directory'."
:type 'directory
:version "20"
:group 'ps-print-miscellany)
(defcustom ps-line-spacing 0
- "*Specify line spacing, in points, for ordinary text.
+ "Specify line spacing, in points, for ordinary text.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE).
:group 'ps-print-miscellany)
(defcustom ps-paragraph-spacing 0
- "*Specify paragraph spacing, in points, for ordinary text.
+ "Specify paragraph spacing, in points, for ordinary text.
Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE).
:group 'ps-print-miscellany)
(defcustom ps-paragraph-regexp "[ \t]*$"
- "*Specify paragraph delimiter.
+ "Specify paragraph delimiter.
It should be a regexp or nil.
:group 'ps-print-miscellany)
(defcustom ps-begin-cut-regexp nil
- "*Specify regexp which is start of a region to cut out when printing.
+ "Specify regexp which is start of a region to cut out when printing.
As an example, variables `ps-begin-cut-regexp' and `ps-end-cut-regexp' may be
set to \"^Local Variables:\" and \"^End:\", respectively, in order to leave out
:group 'ps-print-miscellany)
(defcustom ps-end-cut-regexp nil
- "*Specify regexp which is end of the region to cut out when printing.
+ "Specify regexp which is end of the region to cut out when printing.
See `ps-begin-cut-regexp' for more information."
:type '(choice (const :tag "No Delimiter" nil)
;;;###autoload
(defun ps-spool-buffer-with-faces ()
"Generate and spool a PostScript image of the buffer.
-Like `ps-spool-buffer', but includes font, color, and underline information in
-the generated image. This command works only if you are using a window system,
-so it has a way to determine color values.
+Like the command `ps-spool-buffer', but includes font, color, and underline
+information in the generated image. This command works only if you are using
+a window system, so it has a way to determine color values.
Use the command `ps-despool' to send the spooled images to the printer."
(interactive)
") ps-print version " ps-print-version "\n")
";; internal vars"
(ps-comment-string "emacs-version " emacs-version)
- (ps-comment-string "ps-windows-system " ps-windows-system)
- (ps-comment-string "ps-lp-system " ps-lp-system)
+ (ps-comment-string "lpr-windows-system" lpr-windows-system)
nil
'(25 . ps-print-color-p)
'(25 . ps-lpr-command)
(ps-header-font-size-internal
(or ps-header-font-size-internal
(ps-get-font-size 'ps-header-font-size)))
+ (ps-footer-font-size-internal
+ (or ps-footer-font-size-internal
+ (ps-get-font-size 'ps-footer-font-size)))
(ps-header-title-font-size-internal
(or ps-header-title-font-size-internal
(ps-get-font-size 'ps-header-title-font-size)))
(buf (get-buffer-create "*Line-lengths*"))
(ifs ps-font-size-internal) ; initial font size
- (icw (ps-avg-char-width 'ps-font-for-text)) ; initial character width
(print-width (progn (ps-get-page-dimensions)
ps-print-width))
+ (icw (ps-avg-char-width 'ps-font-for-text)) ; initial character width
(ps-setup (ps-setup)) ; setup for the current buffer
(fs-min 5) ; minimum font size
cw-min ; minimum character width
(ps-header-font-size-internal
(or ps-header-font-size-internal
(ps-get-font-size 'ps-header-font-size)))
+ (ps-footer-font-size-internal
+ (or ps-footer-font-size-internal
+ (ps-get-font-size 'ps-footer-font-size)))
(ps-header-title-font-size-internal
(or ps-header-title-font-size-internal
(ps-get-font-size 'ps-header-title-font-size)))
(buf (get-buffer-create "*Nb-Pages*"))
(ils ps-line-spacing-internal) ; initial line spacing
(ifs ps-font-size-internal) ; initial font size
- (ilh (ps-line-height 'ps-font-for-text)) ; initial line height
(page-height (progn (ps-get-page-dimensions)
ps-print-height))
+ (ilh (ps-line-height 'ps-font-for-text)) ; initial line height
(ps-setup (ps-setup)) ; setup for the current buffer
(fs-min 4) ; minimum font size
lh-min ; minimum line height
ps-print-height))))))
-(defun ps-print-preprint-region (prefix-arg)
+(defun ps-print-preprint-region (prefix)
(or (ps-mark-active-p)
(error "The mark is not set now"))
- (list (point) (mark) (ps-print-preprint prefix-arg)))
+ (list (point) (mark) (ps-print-preprint prefix)))
-(defun ps-print-preprint (prefix-arg)
- (and prefix-arg
- (or (numberp prefix-arg)
- (listp prefix-arg))
+(defun ps-print-preprint (prefix)
+ (and prefix
+ (or (numberp prefix)
+ (listp prefix))
(let* ((name (concat (file-name-nondirectory (or (buffer-file-name)
(buffer-name)))
".ps"))
(ps-output 'prologue (if (stringp args) (list args) args)))
(defun ps-flush-output ()
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(while ps-output-head
(let ((it (car ps-output-head)))
(defun ps-insert-file (fname)
(ps-flush-output)
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(insert-file-contents fname)))
(defun ps-get-boundingbox ()
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-forward ps-boundingbox-re nil t)
(vector (string-to-number ; lower x
;; coordinate adjustment to center image
;; around x and y position
(let ((box (ps-get-boundingbox)))
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(save-excursion
(if (re-search-backward "^--back--" nil t)
(replace-match
(and the-list
(while (> ps-n-up-printing (caar the-list))
(setq the-list (cdr the-list))))
- (car the-list)))
+ (or (car the-list)
+ '(1 nil 1 1 0))))
(defconst ps-n-up-filling-database
(KIND XCOL YCOL XLIN YLIN REPEAT END XSTART YSTART)
Where:
-KIND is a valid value of `ps-n-up-filling'.
+KIND is a valid value of the variable `ps-n-up-filling'.
XCOL YCOL are the relative position for the next column.
XLIN YLIN are the relative position for the beginning of next line.
-REPEAT is the number of repetions for external loop.
-END is the number of repetions for internal loop and also the number of pages in
- a row.
+REPEAT is the number of repetitions for external loop.
+END is the number of repetitions for internal loop and also the number
+ of pages in a row.
XSTART YSTART are the relative position for the first page in a sheet.")
"%%Title: " (buffer-name) ; Take job name from name of
; first buffer printed
"\n%%Creator: ps-print v" ps-print-version
- "\n%%For: " (user-full-name)
- "\n%%CreationDate: " (format-time-string "%T %b %d %Y")
+ "\n%%For: " (user-full-name) ;FIXME: may need encoding!
+ "\n%%CreationDate: " (format-time-string "%T %b %d %Y") ;FIXME: encoding!
"\n%%Orientation: "
(if ps-landscape-mode "Landscape" "Portrait")
"\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font "
ps-line-number-step
ps-zebra-stripe-height))))
;; spooling buffer
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(goto-char (point-max))
(and (re-search-backward "^%%Trailer$" nil t)
(delete-region (match-beginning 0) (point-max))))
(ps-get-page-dimensions)
;; final check
(unless (listp ps-lpr-switches)
- (error "`ps-lpr-switches' value should be a list."))
+ (error "`ps-lpr-switches' value should be a list"))
(and ps-color-p
(equal ps-default-background ps-default-foreground)
(error
(ps-output " S\n")
wrappoint))
-(defun ps-basic-plot-string (from to &optional bg-color)
+(defun ps-basic-plot-string (from to &optional _bg-color)
(let* ((wrappoint (ps-find-wrappoint from to
(ps-avg-char-width 'ps-font-for-text)))
(to (car wrappoint))
(ps-output " S\n")
wrappoint))
-(defun ps-basic-plot-whitespace (from to &optional bg-color)
+(defun ps-basic-plot-whitespace (from to &optional _bg-color)
(let* ((wrappoint (ps-find-wrappoint from to
(ps-space-width 'ps-font-for-text)))
(to (car wrappoint)))
(memq attr '(foreground-color :foreground background-color :background)))
+(defun ps-face-extract-color (face-attrs)
+ (let ((color (cdr face-attrs)))
+ (if (listp color)
+ (car color)
+ color)))
+
+
(defun ps-face-attributes (face)
"Return face attribute vector.
return the attribute vector.
If FACE is not a valid face name, use default face."
+ (and (stringp face) (facep face) (setq face (intern face)))
(cond
(ps-black-white-faces-alist
(or (and (symbolp face)
(cons new-face ps-print-face-alist)))
new-face))))
((ps-face-foreground-color-p (car face))
- (vector 0 (cdr face) nil))
+ (vector 0 (ps-face-extract-color face) nil))
((ps-face-background-color-p (car face))
- (vector 0 nil (cdr face)))
+ (vector 0 nil (ps-face-extract-color face)))
(t
(vector 0 nil nil))))
(ps-face-attributes face-or-list))
;; only foreground color, not a `real' face
((ps-face-foreground-color-p (car face-or-list))
- (vector 0 (cdr face-or-list) nil))
+ (vector 0 (ps-face-extract-color face-or-list) nil))
;; only background color, not a `real' face
((ps-face-background-color-p (car face-or-list))
- (vector 0 nil (cdr face-or-list)))
+ (vector 0 nil (ps-face-extract-color face-or-list)))
;; list of faces
(t
(let ((effects 0)
(ps-face-background-name face))))
-;; to avoid compilation gripes
-(defalias 'ps-jitify 'jit-lock-fontify-now)
-(defalias 'ps-lazify 'lazy-lock-fontify-region)
-
+(declare-function jit-lock-fontify-now "jit-lock" (&optional start end))
+(declare-function lazy-lock-fontify-region "lazy-lock" (beg end))
;; to avoid compilation gripes
(defun ps-print-ensure-fontified (start end)
(cond ((and (boundp 'jit-lock-mode) (symbol-value 'jit-lock-mode))
- (ps-jitify start end))
+ (jit-lock-fontify-now start end))
((and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode))
- (ps-lazify start end))))
+ (lazy-lock-fontify-region start end))))
(defun ps-generate-postscript-with-faces (from to)
(write-region (point-min) (point-max) filename))
(and ps-razzle-dazzle (message "Wrote %s" filename)))
;; Else, spool to the printer
- (and ps-razzle-dazzle (message "Printing..."))
- (save-excursion
- (set-buffer ps-spool-buffer)
+ (with-current-buffer ps-spool-buffer
(let* ((coding-system-for-write 'raw-text-unix)
- (ps-printer-name (or ps-printer-name
- (and (boundp 'printer-name)
- (symbol-value 'printer-name))))
- (ps-lpr-switches
- (append ps-lpr-switches
- (and (stringp ps-printer-name)
- (string< "" ps-printer-name)
- (list (concat
- (and (stringp ps-printer-name-option)
- ps-printer-name-option)
- ps-printer-name))))))
- (or (stringp ps-printer-name)
- (setq ps-printer-name nil))
- (apply (or ps-print-region-function 'call-process-region)
- (point-min) (point-max) ps-lpr-command nil
- (and (fboundp 'start-process) 0)
- nil
- (ps-flatten-list ; dynamic evaluation
- (ps-string-list
- (mapcar 'ps-eval-switch ps-lpr-switches))))))
- (and ps-razzle-dazzle (message "Printing...done")))
+ (printer-name (or ps-printer-name printer-name))
+ (lpr-printer-switch ps-printer-name-option)
+ (print-region-function ps-print-region-function)
+ (lpr-command ps-lpr-command))
+ (lpr-print-region (point-min) (point-max) ps-lpr-switches nil))))
(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)
- ((functionp arg) (apply arg nil))
- ((symbolp arg) (symbol-value arg))
- ((consp arg) (apply (car arg) (cdr arg)))
- (t nil)))
-
-;; `ps-flatten-list' is defined here (copied from "message.el" and
-;; enhanced to handle dotted pairs as well) until we can get some
-;; sensible autoloads, or `flatten-list' gets put somewhere decent.
-
-;; (ps-flatten-list '((a . b) c (d . e) (f g h) i . j))
-;; => (a b c d e f g h i j)
-
-(defun ps-flatten-list (&rest list)
- (ps-flatten-list-1 list))
-
-(defun ps-flatten-list-1 (list)
- (cond ((null list) nil)
- ((consp list) (append (ps-flatten-list-1 (car list))
- (ps-flatten-list-1 (cdr list))))
- (t (list list))))
-
(defun ps-kill-emacs-check ()
- (let (ps-buffer)
- (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
- (buffer-name ps-buffer) ; check if it's not killed
+ (let ((ps-buffer (get-buffer ps-spool-buffer-name)))
+ (and (buffer-live-p ps-buffer)
(buffer-modified-p ps-buffer)
(y-or-n-p "Unprinted PostScript waiting; print now? ")
- (ps-despool))
- (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
- (buffer-name ps-buffer) ; check if it's not killed
+ (ps-despool)))
+ (let ((ps-buffer (get-buffer ps-spool-buffer-name)))
+ (and (buffer-live-p ps-buffer)
(buffer-modified-p ps-buffer)
(not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? "))
(error "Unprinted PostScript"))))
-(cond ((fboundp 'add-hook)
- (funcall 'add-hook 'kill-emacs-hook 'ps-kill-emacs-check))
- (kill-emacs-hook
- (message "Won't override existing `kill-emacs-hook'"))
- (t
- (setq kill-emacs-hook 'ps-kill-emacs-check)))
+(unless noninteractive
+ (add-hook 'kill-emacs-hook #'ps-kill-emacs-check))
\f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; To make this file smaller, some commands go in a separate file.
;; 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" "54fab899bd8999dd0aeca2c6357d24ca")
+;;;### (autoloads nil "ps-mule" "ps-mule.el" "a90e8414a27ac8fdf093251ac648d761")
;;; Generated autoloads from ps-mule.el
(defvar ps-multibyte-buffer nil "\
-*Specifies the multi-byte buffer handling.
+Specifies the multi-byte buffer handling.
Valid values are:
(provide 'ps-print)
-;; arch-tag: fb06a585-1112-4206-885d-a57d95d50579
;;; ps-print.el ends here