;;; 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
+;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
;; Free Software Foundation, Inc.
;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
;; 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
;; 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.
;;
(defconst ps-windows-system
- (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)))
+ (memq system-type '(ms-dos windows-nt)))
(defconst ps-lp-system
(memq system-type '(usg-unix-v hpux irix)))
;;; Interface to the command system
(defgroup postscript nil
- "PostScript Group."
+ "Support for printing and PostScript."
:tag "PostScript"
:version "20"
:group '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
(defcustom ps-printer-name (and (boundp 'printer-name)
(symbol-value 'printer-name))
- "*The name of a local printer for printing PostScript files.
+ "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.
"-d")
(t
"-P" ))
- "*Option for `ps-printer-name' variable (see it).
+ "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\".
: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:
:group 'ps-print-printer)
(defcustom ps-print-region-function nil
- "*Specify a function to print the region on a PostScript printer.
+ "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)
: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
: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."
+ "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:
: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
(if ps-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
: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
: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"
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.
+ "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)
(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
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
(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)
(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)
;; 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" "a17af1e83e9b0292c042c259cdccdde3")
+;;;;;; ps-multibyte-buffer) "ps-mule" "ps-mule.el" "9187df3473401876e0df4937c311fbaf")
;;; 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: