/[emacs]/emacs/lisp/printing.el
ViewVC logotype

Diff of /emacs/lisp/printing.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by viniciusjl, Fri Nov 12 02:14:03 2004 UTC revision 1.22 by viniciusjl, Sun Nov 14 00:47:34 2004 UTC
# Line 5  Line 5 
5    
6  ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>  ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7  ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>  ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8  ;; Time-stamp: <2004/11/11 23:54:13 vinicius>  ;; Time-stamp: <2004/11/13 21:36:38 vinicius>
9  ;; Keywords: wp, print, PostScript  ;; Keywords: wp, print, PostScript
10  ;; Version: 6.8.2  ;; Version: 6.8.3
11  ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/  ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
12    
13  (defconst pr-version "6.8.2"  (defconst pr-version "6.8.3"
14    "printing.el, v 6.8.2 <2004/11/11 vinicius>    "printing.el, v 6.8.3 <2004/11/13 vinicius>
15    
16  Please send all bug fixes and enhancements to  Please send all bug fixes and enhancements to
17          Vinicius Jose Latorre <viniciusjl@ig.com.br>          Vinicius Jose Latorre <viniciusjl@ig.com.br>
# Line 440  Please send all bug fixes and enhancemen Line 440  Please send all bug fixes and enhancemen
440  ;;  ;;
441  ;; Current global keyboard mapping for GNU Emacs is:  ;; Current global keyboard mapping for GNU Emacs is:
442  ;;  ;;
443  ;;    (global-set-key [print]   'pr-ps-fast-fire)  ;;    (global-set-key [print]     'pr-ps-fast-fire)
444  ;;    (global-set-key [M-print] 'pr-ps-mode-using-ghostscript)  ;;    (global-set-key [M-print]   'pr-ps-mode-using-ghostscript)
445  ;;    (global-set-key [C-print] 'pr-txt-fast-fire)  ;;    (global-set-key [S-print]   'pr-ps-mode-using-ghostscript)
446    ;;    (global-set-key [C-print]   'pr-txt-fast-fire)
447    ;;    (global-set-key [C-M-print] 'pr-txt-fast-fire)
448  ;;  ;;
449  ;; And for XEmacs is:  ;; And for XEmacs is:
450  ;;  ;;
451  ;;    (global-set-key 'f22           'pr-ps-fast-fire)  ;;    (global-set-key 'f22                'pr-ps-fast-fire)
452  ;;    (global-set-key '(meta f22)    'pr-ps-mode-using-ghostscript)  ;;    (global-set-key '(meta f22)         'pr-ps-mode-using-ghostscript)
453  ;;    (global-set-key '(control f22) 'pr-txt-fast-fire)  ;;    (global-set-key '(shift f22)        'pr-ps-mode-using-ghostscript)
454    ;;    (global-set-key '(control f22)      'pr-txt-fast-fire)
455    ;;    (global-set-key '(control meta f22) 'pr-txt-fast-fire)
456  ;;  ;;
457  ;; As a suggestion of global keyboard mapping for some `printing' commands:  ;; As a suggestion of global keyboard mapping for some `printing' commands:
458  ;;  ;;
# Line 486  Please send all bug fixes and enhancemen Line 490  Please send all bug fixes and enhancemen
490  ;;  ;;
491  ;; `pr-ps-temp-file'            Specify PostScript temporary file name.  ;; `pr-ps-temp-file'            Specify PostScript temporary file name.
492  ;;  ;;
493    ;; `pr-file-modes'              Specify the file permission bits for newly
494    ;;                              created files.
495    ;;
496  ;; `pr-gv-command'              Specify path and name of the gsview/gv  ;; `pr-gv-command'              Specify path and name of the gsview/gv
497  ;;                              utility.  ;;                              utility.
498  ;;  ;;
# Line 943  Please send all bug fixes and enhancemen Line 950  Please send all bug fixes and enhancemen
950  ;; Acknowledgments  ;; Acknowledgments
951  ;; ---------------  ;; ---------------
952  ;;  ;;
953    ;; Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for GNU Emacs and XEmacs
954    ;; printing menu (in `pr-menu-spec') merging suggestion.
955    ;;
956  ;; Thanks to Lennart Borgman <lennart.borgman.073@student.lu.se> for gsprint  ;; Thanks to Lennart Borgman <lennart.borgman.073@student.lu.se> for gsprint
957  ;; suggestion (see tip 5 in section Tips).  ;; suggestion (see tip 5 in section Tips).
958  ;;  ;;
# Line 1119  Valid values are: Line 1129  Valid values are:
1129    :type '(choice :tag "Path style"    :type '(choice :tag "Path style"
1130                   (const :tag "Windows 9x/NT Style (\\)" :value windows)                   (const :tag "Windows 9x/NT Style (\\)" :value windows)
1131                   (const :tag "Unix Style (/)" :value unix))                   (const :tag "Unix Style (/)" :value unix))
1132      :version "20"
1133    :group 'printing)    :group 'printing)
1134    
1135    
# Line 1230  Examples: Line 1241  Examples:
1241                                  :tag "Directory"                                  :tag "Directory"
1242                                  (string :value "")                                  (string :value "")
1243                                  (symbol :value symbol)))))                                  (symbol :value symbol)))))
1244      :version "20"
1245    :group 'printing)    :group 'printing)
1246    
1247    
# Line 1244  modified by other means (for example, a Line 1256  modified by other means (for example, a
1256  function (see it for documentation) to update text printer menu."  function (see it for documentation) to update text printer menu."
1257    :type 'symbol    :type 'symbol
1258    :set 'pr-txt-name-custom-set    :set 'pr-txt-name-custom-set
1259      :version "20"
1260    :group 'printing)    :group 'printing)
1261    
1262    
# Line 1356  Examples: Line 1369  Examples:
1369                          (const :tag "None" nil)                          (const :tag "None" nil)
1370                          string)))                          string)))
1371    :set 'pr-alist-custom-set    :set 'pr-alist-custom-set
1372      :version "20"
1373    :group 'printing)    :group 'printing)
1374    
1375    
# Line 1370  modified by other means (for example, a Line 1384  modified by other means (for example, a
1384  function (see it for documentation) to update PostScript printer menu."  function (see it for documentation) to update PostScript printer menu."
1385    :type 'symbol    :type 'symbol
1386    :set 'pr-ps-name-custom-set    :set 'pr-ps-name-custom-set
1387      :version "20"
1388    :group 'printing)    :group 'printing)
1389    
1390    
# Line 1564  Examples: Line 1579  Examples:
1579               (sexp :tag "Value")))               (sexp :tag "Value")))
1580             ))             ))
1581    :set 'pr-alist-custom-set    :set 'pr-alist-custom-set
1582      :version "20"
1583    :group 'printing)    :group 'printing)
1584    
1585    
# Line 1578  Examples: Line 1594  Examples:
1594                  ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:")                  ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:")
1595                  (t "/tmp")                  (t "/tmp")
1596                  )))))                  )))))
1597    "*Specify a directory for temporary files during printing."    "*Specify a directory for temporary files during printing.
1598    
1599    See also `pr-ps-temp-file' and `pr-file-modes'."
1600    :type '(directory :tag "Temporary Directory")    :type '(directory :tag "Temporary Directory")
1601      :version "20"
1602    :group 'printing)    :group 'printing)
1603    
1604    
1605  (defcustom pr-ps-temp-file "prspool.ps"  (defcustom pr-ps-temp-file "prspool.ps"
1606    "*Specify PostScript temporary file name."    "*Specify PostScript temporary file name.
1607    
1608    See also `pr-temp-dir' and `pr-file-modes'."
1609    :type '(file :tag "PostScript Temporary File Name")    :type '(file :tag "PostScript Temporary File Name")
1610      :version "20"
1611      :group 'printing)
1612    
1613    
1614    ;; It uses 0600 as default instead of (default-file-modes).
1615    ;; So, by default, only the session owner have permission to deal with files
1616    ;; generated by `printing'.
1617    (defcustom pr-file-modes ?\600
1618      "*Specify the file permission bits for newly created files.
1619    
1620    It should be an integer; only the low 9 bits are used.
1621    
1622    See also `pr-temp-dir' and `pr-ps-temp-file'."
1623      :type '(integer :tag "File Permission Bits")
1624      :version "21.3"
1625    :group 'printing)    :group 'printing)
1626    
1627    
# Line 1597  Examples: Line 1633  Examples:
1633    
1634  See also `pr-path-alist'."  See also `pr-path-alist'."
1635    :type '(string :tag "Ghostview Utility")    :type '(string :tag "Ghostview Utility")
1636      :version "20"
1637    :group 'printing)    :group 'printing)
1638    
1639    
# Line 1608  See also `pr-path-alist'." Line 1645  See also `pr-path-alist'."
1645    
1646  See also `pr-path-alist'."  See also `pr-path-alist'."
1647    :type '(string :tag "Ghostscript Utility")    :type '(string :tag "Ghostscript Utility")
1648      :version "20"
1649    :group 'printing)    :group 'printing)
1650    
1651    
# Line 1638  To see ghostscript documentation for mor Line 1676  To see ghostscript documentation for mor
1676       located in the same directory as gswin32.exe.       located in the same directory as gswin32.exe.
1677     - for brief documentation, type: gswin32.exe -h"     - for brief documentation, type: gswin32.exe -h"
1678    :type '(repeat (string :tag "Ghostscript Switch"))    :type '(repeat (string :tag "Ghostscript Switch"))
1679      :version "20"
1680    :group 'printing)    :group 'printing)
1681    
1682    
# Line 1654  A note on the gs switches: Line 1693  A note on the gs switches:
1693  See `pr-gs-switches' for documentation.  See `pr-gs-switches' for documentation.
1694  See also `pr-ps-printer-alist'."  See also `pr-ps-printer-alist'."
1695    :type '(string :tag "Ghostscript Device")    :type '(string :tag "Ghostscript Device")
1696      :version "20"
1697    :group 'printing)    :group 'printing)
1698    
1699    
# Line 1667  A note on the gs switches: Line 1707  A note on the gs switches:
1707  See `pr-gs-switches' for documentation.  See `pr-gs-switches' for documentation.
1708  See also `pr-ps-printer-alist'."  See also `pr-ps-printer-alist'."
1709    :type '(integer :tag "Ghostscript Resolution")    :type '(integer :tag "Ghostscript Resolution")
1710      :version "20"
1711    :group 'printing)    :group 'printing)
1712    
1713    
# Line 1679  ghostscript to print a PostScript file. Line 1720  ghostscript to print a PostScript file.
1720  In GNU or Unix system, if ghostscript is set as a PostScript filter, this  In GNU or Unix system, if ghostscript is set as a PostScript filter, this
1721  variable should be nil."  variable should be nil."
1722    :type 'boolean    :type 'boolean
1723      :version "20"
1724    :group 'printing)    :group 'printing)
1725    
1726    
1727  (defcustom pr-faces-p nil  (defcustom pr-faces-p nil
1728    "*Non-nil means print with face attributes."    "*Non-nil means print with face attributes."
1729    :type 'boolean    :type 'boolean
1730      :version "20"
1731    :group 'printing)    :group 'printing)
1732    
1733    
1734  (defcustom pr-spool-p nil  (defcustom pr-spool-p nil
1735    "*Non-nil means spool printing in a buffer."    "*Non-nil means spool printing in a buffer."
1736    :type 'boolean    :type 'boolean
1737      :version "20"
1738    :group 'printing)    :group 'printing)
1739    
1740    
1741  (defcustom pr-file-landscape nil  (defcustom pr-file-landscape nil
1742    "*Non-nil means print PostScript file in landscape orientation."    "*Non-nil means print PostScript file in landscape orientation."
1743    :type 'boolean    :type 'boolean
1744      :version "20"
1745    :group 'printing)    :group 'printing)
1746    
1747    
1748  (defcustom pr-file-duplex nil  (defcustom pr-file-duplex nil
1749    "*Non-nil means print PostScript file in duplex mode."    "*Non-nil means print PostScript file in duplex mode."
1750    :type 'boolean    :type 'boolean
1751      :version "20"
1752    :group 'printing)    :group 'printing)
1753    
1754    
# Line 1714  right. Line 1760  right.
1760  If tumble is on, produces a printing suitable for binding at the top or  If tumble is on, produces a printing suitable for binding at the top or
1761  bottom."  bottom."
1762    :type 'boolean    :type 'boolean
1763      :version "20"
1764    :group 'printing)    :group 'printing)
1765    
1766    
# Line 1726  When this variable is non-nil, the `*-bu Line 1773  When this variable is non-nil, the `*-bu
1773  `*-region*' commands, that is, `*-buffer*' commands will print only the region  `*-region*' commands, that is, `*-buffer*' commands will print only the region
1774  marked instead of all buffer."  marked instead of all buffer."
1775    :type 'boolean    :type 'boolean
1776      :version "20"
1777    :group 'printing)    :group 'printing)
1778    
1779    
# Line 1737  and `*-region*' commands will behave lik Line 1785  and `*-region*' commands will behave lik
1785  `*-buffer*' commands will print the current buffer and `*-region*' commands  `*-buffer*' commands will print the current buffer and `*-region*' commands
1786  will print the current region."  will print the current region."
1787    :type 'boolean    :type 'boolean
1788      :version "20"
1789    :group 'printing)    :group 'printing)
1790    
1791    
# Line 1937  DEFAULT                It's a way to set default value Line 1986  DEFAULT                It's a way to set default value
1986                (variable :tag "Other"))                (variable :tag "Other"))
1987               (sexp :tag "Value")))               (sexp :tag "Value")))
1988             ))             ))
1989      :version "20"
1990    :group 'printing)    :group 'printing)
1991    
1992    
# Line 1954  NOTE: Don't forget to download and insta Line 2004  NOTE: Don't forget to download and insta
2004        `pr-ps-utility-alist'."        `pr-ps-utility-alist'."
2005    :type '(symbol :tag "PS File Utility")    :type '(symbol :tag "PS File Utility")
2006    :set 'pr-ps-utility-custom-set    :set 'pr-ps-utility-custom-set
2007      :version "20"
2008    :group 'printing)    :group 'printing)
2009    
2010    
# Line 2138  Examples: Line 2189  Examples:
2189                    (sexp :tag "Value")))                    (sexp :tag "Value")))
2190                  ))                  ))
2191    :set 'pr-alist-custom-set    :set 'pr-alist-custom-set
2192      :version "20"
2193    :group 'printing)    :group 'printing)
2194    
2195    
# Line 2146  Examples: Line 2198  Examples:
2198    
2199  See also `pr-menu-char-height' and `pr-menu-char-width'."  See also `pr-menu-char-height' and `pr-menu-char-width'."
2200    :type 'boolean    :type 'boolean
2201      :version "20"
2202    :group 'printing)    :group 'printing)
2203    
2204    
# Line 2161  menu, so don't forget to adjust it if me Line 2214  menu, so don't forget to adjust it if me
2214    
2215  See also `pr-menu-lock' and `pr-menu-char-width'."  See also `pr-menu-lock' and `pr-menu-char-width'."
2216    :type 'integer    :type 'integer
2217      :version "20"
2218    :group 'printing)    :group 'printing)
2219    
2220    
# Line 2176  menu, so don't forget to adjust it if me Line 2230  menu, so don't forget to adjust it if me
2230    
2231  See also `pr-menu-lock' and `pr-menu-char-height'."  See also `pr-menu-lock' and `pr-menu-char-height'."
2232    :type 'integer    :type 'integer
2233      :version "20"
2234    :group 'printing)    :group 'printing)
2235    
2236    
# Line 2292  SETTING                It's a cons like: Line 2347  SETTING                It's a cons like:
2347                (variable :tag "Other"))                (variable :tag "Other"))
2348               (sexp :tag "Value")))               (sexp :tag "Value")))
2349             ))             ))
2350      :version "20"
2351    :group 'printing)    :group 'printing)
2352    
2353    
# Line 2345  Any other value is ignored." Line 2401  Any other value is ignored."
2401                           (const postscript-process)                           (const postscript-process)
2402                           (const printing)                           (const printing)
2403                           (const help)))                           (const help)))
2404      :version "20"
2405    :group 'printing)    :group 'printing)
2406    
2407    
# Line 2356  happens when printing: Line 2413  happens when printing:
2413    
2414     Error: could not open \"c:\\temp\\prspool.ps\" for reading."     Error: could not open \"c:\\temp\\prspool.ps\" for reading."
2415    :type 'boolean    :type 'boolean
2416      :version "20"
2417    :group 'printing)    :group 'printing)
2418    
2419    
# Line 2369  It's used by `pr-ps-directory-preview', Line 2427  It's used by `pr-ps-directory-preview',
2427  `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory'  `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory'
2428  and `pr-txt-directory'."  and `pr-txt-directory'."
2429    :type 'boolean    :type 'boolean
2430      :version "20"
2431    :group 'printing)    :group 'printing)
2432    
2433    
# Line 2377  and `pr-txt-directory'." Line 2436  and `pr-txt-directory'."
2436    
2437  It's used by `pr-interface'."  It's used by `pr-interface'."
2438    :type 'string    :type 'string
2439      :version "20"
2440    :group 'printing)    :group 'printing)
2441    
2442    
# Line 2390  NOTE: Case is important for matching, th Line 2450  NOTE: Case is important for matching, th
2450    
2451  It's used by `pr-interface'."  It's used by `pr-interface'."
2452    :type '(repeat (regexp :tag "Buffer Name Regexp"))    :type '(repeat (regexp :tag "Buffer Name Regexp"))
2453      :version "20"
2454    :group 'printing)    :group 'printing)
2455    
2456    
# Line 2398  It's used by `pr-interface'." Line 2459  It's used by `pr-interface'."
2459    
2460  It's used by `pr-interface'."  It's used by `pr-interface'."
2461    :type 'boolean    :type 'boolean
2462      :version "20"
2463    :group 'printing)    :group 'printing)
2464    
2465    
# Line 2445  See `pr-ps-printer-alist'.") Line 2507  See `pr-ps-printer-alist'.")
2507    
2508    
2509  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2510    ;; Macros
2511    
2512    
2513    (defvar pr-interactive-p nil
2514      "Save the `interactive-p' result value.
2515    
2516    It's used by `pr-save-interactive' (which see).")
2517    
2518    
2519    (defmacro pr-save-interactive (&rest body)
2520      "Save the `interactive-p' result value using `let'.
2521    
2522    It uses `pr-interactive-p' var (which see)."
2523      `(let ((pr-interactive-p (or pr-interactive-p (interactive-p))))
2524         ,@body))
2525    
2526    
2527    (defmacro pr-save-file-modes (&rest body)
2528      "Set temporally file modes to `pr-file-modes'."
2529      `(let ((pr--default-file-modes (default-file-modes))) ; save default
2530         (set-default-file-modes pr-file-modes)
2531         ,@body
2532         (set-default-file-modes pr--default-file-modes))) ; restore default
2533    
2534    
2535    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2536  ;; Keys & Menus  ;; Keys & Menus
2537    
2538    
# Line 2489  See `pr-ps-printer-alist'.") Line 2577  See `pr-ps-printer-alist'.")
2577    
2578    
2579    (defconst pr-menu-spec    (defconst pr-menu-spec
2580      (cond      ;; Menu mapping:
2581       ((eq ps-print-emacs-type 'emacs)   ; GNU Emacs      ;;   unfortunately XEmacs doesn't support :active or :visible
2582        '(      ;;   for submenus, only for items.
2583        ;;   It uses :included instead of :active or :visible.
2584        ;;   Also, XEmacs doesn't support :help tag.
2585        (let ((pr-:active  (if (eq ps-print-emacs-type 'emacs)
2586                               :active      ; GNU Emacs
2587                             :included))    ; XEmacs
2588              (pr-:visible (if (eq ps-print-emacs-type 'emacs)
2589                               :visible     ; GNU Emacs
2590                             :included))    ; XEmacs
2591              pr-:help)
2592          (if (eq ps-print-emacs-type 'emacs)
2593              (defalias 'pr-:help #'(lambda (text) (list :help text))) ; GNU Emacs
2594            (defalias 'pr-:help 'ignore))                              ; XEmacs
2595          `(
2596          ["Printing Interface" pr-interface          ["Printing Interface" pr-interface
2597           :help "Use buffer interface instead of menu interface"]           ,@(pr-:help "Use buffer interface instead of menu interface")]
2598          "--"          "--"
2599          ("PostScript Preview" :visible (pr-visible-p 'postscript)          ("PostScript Preview" ,pr-:visible (pr-visible-p 'postscript)
2600           :help "Preview PostScript instead of sending to printer"           ,@(pr-:help "Preview PostScript instead of sending to printer")
2601           ("Directory" :active (not pr-spool-p)           ("Directory" ,pr-:active (not pr-spool-p)
2602            ["1-up"     (pr-ps-directory-preview 1   nil nil t) t]            ["1-up"     (pr-ps-directory-preview 1   nil nil t) t]
2603            ["2-up"     (pr-ps-directory-preview 2   nil nil t) t]            ["2-up"     (pr-ps-directory-preview 2   nil nil t) t]
2604            ["4-up"     (pr-ps-directory-preview 4   nil nil t) t]            ["4-up"     (pr-ps-directory-preview 4   nil nil t) t]
2605            ["Other..." (pr-ps-directory-preview nil nil nil t)            ["Other..." (pr-ps-directory-preview nil nil nil t)
2606             :keys "\\[pr-ps-buffer-preview]"])             :keys "\\[pr-ps-buffer-preview]"])
2607           ("Buffer" :active (not pr-spool-p)           ("Buffer" ,pr-:active (not pr-spool-p)
2608            ["1-up"     (pr-ps-buffer-preview 1   t) t]            ["1-up"     (pr-ps-buffer-preview 1   t) t]
2609            ["2-up"     (pr-ps-buffer-preview 2   t) t]            ["2-up"     (pr-ps-buffer-preview 2   t) t]
2610            ["4-up"     (pr-ps-buffer-preview 4   t) t]            ["4-up"     (pr-ps-buffer-preview 4   t) t]
2611            ["Other..." (pr-ps-buffer-preview nil t)            ["Other..." (pr-ps-buffer-preview nil t)
2612             :keys "\\[pr-ps-buffer-preview]"])             :keys "\\[pr-ps-buffer-preview]"])
2613           ("Region" :active (and (not pr-spool-p) (ps-mark-active-p))           ("Region" ,pr-:active (and (not pr-spool-p) (ps-mark-active-p))
2614            ["1-up"     (pr-ps-region-preview 1   t) t]            ["1-up"     (pr-ps-region-preview 1   t) t]
2615            ["2-up"     (pr-ps-region-preview 2   t) t]            ["2-up"     (pr-ps-region-preview 2   t) t]
2616            ["4-up"     (pr-ps-region-preview 4   t) t]            ["4-up"     (pr-ps-region-preview 4   t) t]
2617            ["Other..." (pr-ps-region-preview nil t)            ["Other..." (pr-ps-region-preview nil t)
2618             :keys "\\[pr-ps-region-preview]"])             :keys "\\[pr-ps-region-preview]"])
2619           ("Mode" :active (and (not pr-spool-p) (pr-mode-alist-p))           ("Mode" ,pr-:active (and (not pr-spool-p) (pr-mode-alist-p))
2620            ["1-up"     (pr-ps-mode-preview 1   t) t]            ["1-up"     (pr-ps-mode-preview 1   t) t]
2621            ["2-up"     (pr-ps-mode-preview 2   t) t]            ["2-up"     (pr-ps-mode-preview 2   t) t]
2622            ["4-up"     (pr-ps-mode-preview 4   t) t]            ["4-up"     (pr-ps-mode-preview 4   t) t]
# Line 2524  See `pr-ps-printer-alist'.") Line 2625  See `pr-ps-printer-alist'.")
2625           ("File"           ("File"
2626            ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)            ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)
2627             :keys "\\[pr-ps-file-preview]"             :keys "\\[pr-ps-file-preview]"
2628             :help "Preview PostScript file"]             ,@(pr-:help "Preview PostScript file")]
2629            "--"            "--"
2630            ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist            ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
2631             :help "Select PostScript utility"]             ,@(pr-:help "Select PostScript utility")]
2632            "--"            "--"
2633            ["1-up..."   (pr-ps-file-up-preview 1   t t) pr-ps-utility-alist]            ["1-up..."   (pr-ps-file-up-preview 1   t t) pr-ps-utility-alist]
2634            ["2-up..."   (pr-ps-file-up-preview 2   t t) pr-ps-utility-alist]            ["2-up..."   (pr-ps-file-up-preview 2   t t) pr-ps-utility-alist]
# Line 2537  See `pr-ps-printer-alist'.") Line 2638  See `pr-ps-printer-alist'.")
2638            "--"            "--"
2639            ["Landscape" pr-toggle-file-landscape            ["Landscape" pr-toggle-file-landscape
2640             :style toggle :selected pr-file-landscape             :style toggle :selected pr-file-landscape
2641             :help "Toggle landscape for PostScript file"             ,@(pr-:help "Toggle landscape for PostScript file")
2642             :active pr-ps-utility-alist]             :active pr-ps-utility-alist]
2643            ["Duplex"    pr-toggle-file-duplex            ["Duplex"    pr-toggle-file-duplex
2644             :style toggle :selected pr-file-duplex             :style toggle :selected pr-file-duplex
2645             :help "Toggle duplex for PostScript file"             ,@(pr-:help "Toggle duplex for PostScript file")
2646             :active pr-ps-utility-alist]             :active pr-ps-utility-alist]
2647            ["Tumble"    pr-toggle-file-tumble            ["Tumble"    pr-toggle-file-tumble
2648             :style toggle :selected pr-file-tumble             :style toggle :selected pr-file-tumble
2649             :help "Toggle tumble for PostScript file"             ,@(pr-:help "Toggle tumble for PostScript file")
2650             :active (and pr-file-duplex pr-ps-utility-alist)])             :active (and pr-file-duplex pr-ps-utility-alist)])
2651           ["Despool..." (call-interactively 'pr-despool-preview)           ["Despool..." (call-interactively 'pr-despool-preview)
2652            :active pr-spool-p :keys "\\[pr-despool-preview]"            :active pr-spool-p :keys "\\[pr-despool-preview]"
2653            :help "Despool PostScript buffer to printer or file (C-u)"])            ,@(pr-:help "Despool PostScript buffer to printer or file (C-u)")])
2654          ("PostScript Print" :visible (pr-visible-p 'postscript)          ("PostScript Print" ,pr-:visible (pr-visible-p 'postscript)
2655           :help "Send PostScript to printer or file (C-u)"           ,@(pr-:help "Send PostScript to printer or file (C-u)")
2656           ("Directory"           ("Directory"
2657            ["1-up"     (pr-ps-directory-ps-print 1   nil nil t) t]            ["1-up"     (pr-ps-directory-ps-print 1   nil nil t) t]
2658            ["2-up"     (pr-ps-directory-ps-print 2   nil nil t) t]            ["2-up"     (pr-ps-directory-ps-print 2   nil nil t) t]
# Line 2564  See `pr-ps-printer-alist'.") Line 2665  See `pr-ps-printer-alist'.")
2665            ["4-up"     (pr-ps-buffer-ps-print 4   t) t]            ["4-up"     (pr-ps-buffer-ps-print 4   t) t]
2666            ["Other..." (pr-ps-buffer-ps-print nil t)            ["Other..." (pr-ps-buffer-ps-print nil t)
2667             :keys "\\[pr-ps-buffer-ps-print]"])             :keys "\\[pr-ps-buffer-ps-print]"])
2668           ("Region" :active (ps-mark-active-p)           ("Region" ,pr-:active (ps-mark-active-p)
2669            ["1-up"     (pr-ps-region-ps-print 1   t) t]            ["1-up"     (pr-ps-region-ps-print 1   t) t]
2670            ["2-up"     (pr-ps-region-ps-print 2   t) t]            ["2-up"     (pr-ps-region-ps-print 2   t) t]
2671            ["4-up"     (pr-ps-region-ps-print 4   t) t]            ["4-up"     (pr-ps-region-ps-print 4   t) t]
2672            ["Other..." (pr-ps-region-ps-print nil t)            ["Other..." (pr-ps-region-ps-print nil t)
2673             :keys "\\[pr-ps-region-ps-print]"])             :keys "\\[pr-ps-region-ps-print]"])
2674           ("Mode" :active (pr-mode-alist-p)           ("Mode" ,pr-:active (pr-mode-alist-p)
2675            ["1-up"     (pr-ps-mode-ps-print 1   t) t]            ["1-up"     (pr-ps-mode-ps-print 1   t) t]
2676            ["2-up"     (pr-ps-mode-ps-print 2   t) t]            ["2-up"     (pr-ps-mode-ps-print 2   t) t]
2677            ["4-up"     (pr-ps-mode-ps-print 4   t) t]            ["4-up"     (pr-ps-mode-ps-print 4   t) t]
# Line 2579  See `pr-ps-printer-alist'.") Line 2680  See `pr-ps-printer-alist'.")
2680           ("File"           ("File"
2681            ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)            ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)
2682             :keys "\\[pr-ps-file-ps-print]"             :keys "\\[pr-ps-file-ps-print]"
2683             :help "Send PostScript file to printer"]             ,@(pr-:help "Send PostScript file to printer")]
2684            "--"            "--"
2685            ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist            ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
2686             :help "Select PostScript utility"]             ,@(pr-:help "Select PostScript utility")]
2687            "--"            "--"
2688            ["1-up..."   (pr-ps-file-up-ps-print 1   t t) pr-ps-utility-alist]            ["1-up..."   (pr-ps-file-up-ps-print 1   t t) pr-ps-utility-alist]
2689            ["2-up..."   (pr-ps-file-up-ps-print 2   t t) pr-ps-utility-alist]            ["2-up..."   (pr-ps-file-up-ps-print 2   t t) pr-ps-utility-alist]
# Line 2592  See `pr-ps-printer-alist'.") Line 2693  See `pr-ps-printer-alist'.")
2693            "--"            "--"
2694            ["Landscape" pr-toggle-file-landscape            ["Landscape" pr-toggle-file-landscape
2695             :style toggle :selected pr-file-landscape             :style toggle :selected pr-file-landscape
2696             :help "Toggle landscape for PostScript file"             ,@(pr-:help "Toggle landscape for PostScript file")
2697             :active pr-ps-utility-alist]             :active pr-ps-utility-alist]
2698            ["Duplex"    pr-toggle-file-duplex            ["Duplex"    pr-toggle-file-duplex
2699             :style toggle :selected pr-file-duplex             :style toggle :selected pr-file-duplex
2700             :help "Toggle duplex for PostScript file"             ,@(pr-:help "Toggle duplex for PostScript file")
2701             :active pr-ps-utility-alist]             :active pr-ps-utility-alist]
2702            ["Tumble"    pr-toggle-file-tumble            ["Tumble"    pr-toggle-file-tumble
2703             :style toggle :selected pr-file-tumble             :style toggle :selected pr-file-tumble
2704             :help "Toggle tumble for PostScript file"             ,@(pr-:help "Toggle tumble for PostScript file")
2705             :active (and pr-file-duplex pr-ps-utility-alist)])             :active (and pr-file-duplex pr-ps-utility-alist)])
2706           ["Despool..." (call-interactively 'pr-despool-ps-print)           ["Despool..." (call-interactively 'pr-despool-ps-print)
2707            :active pr-spool-p :keys "\\[pr-despool-ps-print]"            :active pr-spool-p :keys "\\[pr-despool-ps-print]"
2708            :help "Despool PostScript buffer to printer or file (C-u)"])            ,@(pr-:help "Despool PostScript buffer to printer or file (C-u)")])
2709          ["PostScript Printers" pr-update-menus          ["PostScript Printers" pr-update-menus
2710           :active pr-ps-printer-alist :included (pr-visible-p 'postscript)           :active pr-ps-printer-alist :included (pr-visible-p 'postscript)
2711           :help "Select PostScript printer"]           ,@(pr-:help "Select PostScript printer")]
2712          "--"          "--"
2713          ("Printify" :visible (pr-visible-p 'text)          ("Printify" ,pr-:visible (pr-visible-p 'text)
2714           :help "Replace non-printing chars with printable representations."           ,@(pr-:help
2715                "Replace non-printing chars with printable representations.")
2716           ["Directory" pr-printify-directory t]           ["Directory" pr-printify-directory t]
2717           ["Buffer"    pr-printify-buffer    t]           ["Buffer"    pr-printify-buffer    t]
2718           ["Region"    pr-printify-region    (ps-mark-active-p)])           ["Region"    pr-printify-region    (ps-mark-active-p)])
2719          ("Print" :visible (pr-visible-p 'text)          ("Print" ,pr-:visible (pr-visible-p 'text)
2720           :help "Send text to printer"           ,@(pr-:help "Send text to printer")
2721           ["Directory" pr-txt-directory t]           ["Directory" pr-txt-directory t]
2722           ["Buffer"    pr-txt-buffer    t]           ["Buffer"    pr-txt-buffer    t]
2723           ["Region"    pr-txt-region    (ps-mark-active-p)]           ["Region"    pr-txt-region    (ps-mark-active-p)]
2724           ["Mode"      pr-txt-mode      (pr-mode-alist-p)])           ["Mode"      pr-txt-mode      (pr-mode-alist-p)])
2725          ["Text Printers" pr-update-menus          ["Text Printers" pr-update-menus
2726           :active pr-txt-printer-alist :included (pr-visible-p 'text)           :active pr-txt-printer-alist :included (pr-visible-p 'text)
2727           :help "Select text printer"]           ,@(pr-:help "Select text printer")]
2728          "--"          "--"
2729          ["Landscape"               pr-toggle-landscape          ["Landscape"               pr-toggle-landscape
2730           :style toggle :selected ps-landscape-mode           :style toggle :selected ps-landscape-mode
# Line 2648  See `pr-ps-printer-alist'.") Line 2750  See `pr-ps-printer-alist'.")
2750          ["Upside-Down"             pr-toggle-upside-down          ["Upside-Down"             pr-toggle-upside-down
2751           :style toggle :selected ps-print-upside-down           :style toggle :selected ps-print-upside-down
2752           :included (pr-visible-p 'postscript-options)]           :included (pr-visible-p 'postscript-options)]
2753          ("Print All Pages" :visible (pr-visible-p 'postscript-options)          ("Print All Pages" ,pr-:visible (pr-visible-p 'postscript-options)
2754           :help "Select odd/even pages/sheets to print"           ,@(pr-:help "Select odd/even pages/sheets to print")
2755           ["All Pages"   (pr-even-or-odd-pages nil)           ["All Pages"   (pr-even-or-odd-pages nil)
2756            :style radio :selected (eq ps-even-or-odd-pages nil)]            :style radio :selected (eq ps-even-or-odd-pages nil)]
2757           ["Even Pages"  (pr-even-or-odd-pages 'even-page)           ["Even Pages"  (pr-even-or-odd-pages 'even-page)
# Line 2664  See `pr-ps-printer-alist'.") Line 2766  See `pr-ps-printer-alist'.")
2766          ["Spool Buffer"            pr-toggle-spool          ["Spool Buffer"            pr-toggle-spool
2767           :style toggle :selected pr-spool-p           :style toggle :selected pr-spool-p
2768           :included (pr-visible-p 'postscript-process)           :included (pr-visible-p 'postscript-process)
2769           :help "Toggle PostScript spooling"]           ,@(pr-:help "Toggle PostScript spooling")]
2770          ["Print with faces"        pr-toggle-faces          ["Print with faces"        pr-toggle-faces
2771           :style toggle :selected pr-faces-p           :style toggle :selected pr-faces-p
2772           :included (pr-visible-p 'postscript-process)           :included (pr-visible-p 'postscript-process)
2773           :help "Toggle PostScript printing with faces"]           ,@(pr-:help "Toggle PostScript printing with faces")]
2774          ["Print via Ghostscript" pr-toggle-ghostscript          ["Print via Ghostscript" pr-toggle-ghostscript
2775           :style toggle :selected pr-print-using-ghostscript           :style toggle :selected pr-print-using-ghostscript
2776           :included (pr-visible-p 'postscript-process)           :included (pr-visible-p 'postscript-process)
2777           :help "Toggle PostScript generation using ghostscript"]           ,@(pr-:help "Toggle PostScript generation using ghostscript")]
2778          "--"          "--"
2779          ["Auto Region" pr-toggle-region          ["Auto Region" pr-toggle-region
2780           :style toggle :selected pr-auto-region           :style toggle :selected pr-auto-region
# Line 2684  See `pr-ps-printer-alist'.") Line 2786  See `pr-ps-printer-alist'.")
2786           :style toggle :selected pr-menu-lock           :style toggle :selected pr-menu-lock
2787           :included (pr-visible-p 'printing)]           :included (pr-visible-p 'printing)]
2788          "--"          "--"
2789          ("Customize" :visible (pr-visible-p 'help)          ("Customize" ,pr-:visible (pr-visible-p 'help)
2790           ["printing" pr-customize       t]           ["printing" pr-customize       t]
2791           ["ps-print" ps-print-customize t]           ["ps-print" ps-print-customize t]
2792           ["lpr"      lpr-customize      t])           ["lpr"      lpr-customize      t])
2793          ("Show Settings" :visible (pr-visible-p 'help)          ("Show Settings" ,pr-:visible (pr-visible-p 'help)
2794           ["printing" pr-show-pr-setup  t]           ["printing" pr-show-pr-setup  t]
2795           ["ps-print" pr-show-ps-setup  t]           ["ps-print" pr-show-ps-setup  t]
2796           ["lpr"      pr-show-lpr-setup t])           ["lpr"      pr-show-lpr-setup t])
2797          ["Help" pr-help :active t :included (pr-visible-p 'help)]          ["Help" pr-help :active t :included (pr-visible-p 'help)]
2798          ))          )))
   
   
      ((eq ps-print-emacs-type 'xemacs)  ; XEmacs  
       ;; Menu mapping:  
       ;;   unfortunately XEmacs doesn't support :active or :visible  
       ;;   for submenus, only for items.  
       ;;   It uses :included instead of :active or :visible.  
       ;;   Also, XEmacs doesn't support :help tag.  
       '(  
         ["Printing Interface" pr-interface]  
         "--"  
         ("PostScript Preview" :included (pr-visible-p 'postscript)  
          ("Directory" :included (not pr-spool-p)  
           ["1-up"     (pr-ps-directory-preview 1   nil nil t) t]  
           ["2-up"     (pr-ps-directory-preview 2   nil nil t) t]  
           ["4-up"     (pr-ps-directory-preview 4   nil nil t) t]  
           ["Other..." (pr-ps-directory-preview nil nil nil t)  
            :keys "\\[pr-ps-buffer-preview]"])  
          ("Buffer" :included (not pr-spool-p)  
           ["1-up"     (pr-ps-buffer-preview 1   t) t]  
           ["2-up"     (pr-ps-buffer-preview 2   t) t]  
           ["4-up"     (pr-ps-buffer-preview 4   t) t]  
           ["Other..." (pr-ps-buffer-preview nil t)  
            :keys "\\[pr-ps-buffer-preview]"])  
          ("Region" :included (and (not pr-spool-p) (ps-mark-active-p))  
           ["1-up"     (pr-ps-region-preview 1   t) t]  
           ["2-up"     (pr-ps-region-preview 2   t) t]  
           ["4-up"     (pr-ps-region-preview 4   t) t]  
           ["Other..." (pr-ps-region-preview nil t)  
            :keys "\\[pr-ps-region-preview]"])  
          ("Mode" :included (and (not pr-spool-p) (pr-mode-alist-p))  
           ["1-up"     (pr-ps-mode-preview 1   t) t]  
           ["2-up"     (pr-ps-mode-preview 2   t) t]  
           ["4-up"     (pr-ps-mode-preview 4   t) t]  
           ["Other..." (pr-ps-mode-preview nil t)  
            :keys "\\[pr-ps-mode-preview]"])  
          ("File"  
           ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)  
            :keys "\\[pr-ps-file-preview]"]  
           "--"  
           ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist]  
           "--"  
           ["1-up..."   (pr-ps-file-up-preview 1   t t) pr-ps-utility-alist]  
           ["2-up..."   (pr-ps-file-up-preview 2   t t) pr-ps-utility-alist]  
           ["4-up..."   (pr-ps-file-up-preview 4   t t) pr-ps-utility-alist]  
           ["Other..."  (pr-ps-file-up-preview nil t t)  
            :keys "\\[pr-ps-file-up-preview]" :active pr-ps-utility-alist]  
           "--"  
           ["Landscape" pr-toggle-file-landscape  
            :style toggle :selected pr-file-landscape  
            :active pr-ps-utility-alist]  
           ["Duplex"    pr-toggle-file-duplex  
            :style toggle :selected pr-file-duplex  
            :active pr-ps-utility-alist]  
           ["Tumble"    pr-toggle-file-tumble  
            :style toggle :selected pr-file-tumble  
            :active (and pr-file-duplex pr-ps-utility-alist)])  
          ["Despool..." (call-interactively 'pr-despool-preview)  
           :active pr-spool-p :keys "\\[pr-despool-preview]"])  
         ("PostScript Print" :included (pr-visible-p 'postscript)  
          ("Directory"  
           ["1-up"     (pr-ps-directory-ps-print 1   nil nil t) t]  
           ["2-up"     (pr-ps-directory-ps-print 2   nil nil t) t]  
           ["4-up"     (pr-ps-directory-ps-print 4   nil nil t) t]  
           ["Other..." (pr-ps-directory-ps-print nil nil nil t)  
            :keys "\\[pr-ps-buffer-ps-print]"])  
          ("Buffer"  
           ["1-up"     (pr-ps-buffer-ps-print 1   t) t]  
           ["2-up"     (pr-ps-buffer-ps-print 2   t) t]  
           ["4-up"     (pr-ps-buffer-ps-print 4   t) t]  
           ["Other..." (pr-ps-buffer-ps-print nil t)  
            :keys "\\[pr-ps-buffer-ps-print]"])  
          ("Region" :included (ps-mark-active-p)  
           ["1-up"     (pr-ps-region-ps-print 1   t) t]  
           ["2-up"     (pr-ps-region-ps-print 2   t) t]  
           ["4-up"     (pr-ps-region-ps-print 4   t) t]  
           ["Other..." (pr-ps-region-ps-print nil t)  
            :keys "\\[pr-ps-region-ps-print]"])  
          ("Mode" :included (pr-mode-alist-p)  
           ["1-up"     (pr-ps-mode-ps-print 1   t) t]  
           ["2-up"     (pr-ps-mode-ps-print 2   t) t]  
           ["4-up"     (pr-ps-mode-ps-print 4   t) t]  
           ["Other..." (pr-ps-mode-ps-print nil t)  
            :keys "\\[pr-ps-mode-ps-print]"])  
          ("File"  
           ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)  
            :keys "\\[pr-ps-file-ps-print]"]  
           "--"  
           ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist]  
           "--"  
           ["1-up..."   (pr-ps-file-up-ps-print 1   t t) pr-ps-utility-alist]  
           ["2-up..."   (pr-ps-file-up-ps-print 2   t t) pr-ps-utility-alist]  
           ["4-up..."   (pr-ps-file-up-ps-print 4   t t) pr-ps-utility-alist]  
           ["Other..."  (pr-ps-file-up-ps-print nil t t)  
            :keys "\\[pr-ps-file-up-ps-print]" :active pr-ps-utility-alist]  
           "--"  
           ["Landscape" pr-toggle-file-landscape  
            :style toggle :selected pr-file-landscape  
            :active pr-ps-utility-alist]  
           ["Duplex"    pr-toggle-file-duplex  
            :style toggle :selected pr-file-duplex  
            :active pr-ps-utility-alist]  
           ["Tumble"    pr-toggle-file-tumble  
            :style toggle :selected pr-file-tumble  
            :active (and pr-file-duplex pr-ps-utility-alist)])  
          ["Despool..." (call-interactively 'pr-despool-ps-print)  
           :active pr-spool-p :keys "\\[pr-despool-ps-print]"])  
         ["PostScript Printers" pr-update-menus  
          :active pr-ps-printer-alist :included (pr-visible-p 'postscript)]  
         "--"  
         ("Printify" :included (pr-visible-p 'text)  
          ["Directory" pr-printify-directory t]  
          ["Buffer"    pr-printify-buffer    t]  
          ["Region"    pr-printify-region    (ps-mark-active-p)])  
         ("Print" :included (pr-visible-p 'text)  
          ["Directory" pr-txt-directory t]  
          ["Buffer"    pr-txt-buffer    t]  
          ["Region"    pr-txt-region    (ps-mark-active-p)]  
          ["Mode"      pr-txt-mode      (pr-mode-alist-p)])  
         ["Text Printers" pr-update-menus  
          :active pr-txt-printer-alist :included (pr-visible-p 'text)]  
         "--"  
         ["Landscape"               pr-toggle-landscape  
          :style toggle :selected ps-landscape-mode  
          :included (pr-visible-p 'postscript-options)]  
         ["Print Header"            pr-toggle-header  
          :style toggle :selected ps-print-header  
          :included (pr-visible-p 'postscript-options)]  
         ["Print Header Frame"      pr-toggle-header-frame  
          :style toggle :selected ps-print-header-frame :active ps-print-header  
          :included (pr-visible-p 'postscript-options)]  
         ["Line Number"             pr-toggle-line  
          :style toggle :selected ps-line-number  
          :included (pr-visible-p 'postscript-options)]  
         ["Zebra Stripes"           pr-toggle-zebra  
          :style toggle :selected ps-zebra-stripes  
          :included (pr-visible-p 'postscript-options)]  
         ["Duplex"                  pr-toggle-duplex  
          :style toggle :selected ps-spool-duplex  
          :included (pr-visible-p 'postscript-options)]  
         ["Tumble"                  pr-toggle-tumble  
          :style toggle :selected ps-spool-tumble :active ps-spool-duplex  
          :included (pr-visible-p 'postscript-options)]  
         ["Upside-Down"             pr-toggle-upside-down  
          :style toggle :selected ps-print-upside-down  
          :included (pr-visible-p 'postscript-options)]  
         ("Print All Pages" :included (pr-visible-p 'postscript-options)  
          ["All Pages"   (pr-even-or-odd-pages nil)  
           :style radio :selected (eq ps-even-or-odd-pages nil)]  
          ["Even Pages"  (pr-even-or-odd-pages 'even-page)  
           :style radio :selected (eq ps-even-or-odd-pages 'even-page)]  
          ["Odd Pages"   (pr-even-or-odd-pages 'odd-page)  
           :style radio :selected (eq ps-even-or-odd-pages 'odd-page)]  
          ["Even Sheets" (pr-even-or-odd-pages 'even-sheet)  
           :style radio :selected (eq ps-even-or-odd-pages 'even-sheet)]  
          ["Odd Sheets"  (pr-even-or-odd-pages 'odd-sheet)  
           :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)])  
         "--"  
         ["Spool Buffer"            pr-toggle-spool  
          :style toggle :selected pr-spool-p  
          :included (pr-visible-p 'postscript-process)]  
         ["Print with faces"        pr-toggle-faces  
          :style toggle :selected pr-faces-p  
          :included (pr-visible-p 'postscript-process)]  
         ["Print via Ghostscript" pr-toggle-ghostscript  
          :style toggle :selected pr-print-using-ghostscript  
          :included (pr-visible-p 'postscript-process)]  
         "--"  
         ["Auto Region" pr-toggle-region  
          :style toggle :selected pr-auto-region  
          :included (pr-visible-p 'printing)]  
         ["Auto Mode"   pr-toggle-mode  
          :style toggle :selected pr-auto-mode  
          :included (pr-visible-p 'printing)]  
         ["Menu Lock"   pr-toggle-lock  
          :style toggle :selected pr-menu-lock  
          :included (pr-visible-p 'printing)]  
         "--"  
         ("Customize" :included (pr-visible-p 'help)  
          ["printing" pr-customize       t]  
          ["ps-print" ps-print-customize t]  
          ["lpr"      lpr-customize      t])  
         ("Show Settings" :included (pr-visible-p 'help)  
          ["printing" pr-show-pr-setup  t]  
          ["ps-print" pr-show-ps-setup  t]  
          ["lpr"      pr-show-lpr-setup t])  
         ["Help" pr-help :active t :included (pr-visible-p 'help)]  
         ))  
      ))  
2799    
2800    
2801    (cond    (cond
# Line 2915  See `pr-ps-printer-alist'.") Line 2828  See `pr-ps-printer-alist'.")
2828                pr-menu-bar (vector 'menu-bar 'file                pr-menu-bar (vector 'menu-bar 'file
2829                                    (pr-get-symbol "Print")))))                                    (pr-get-symbol "Print")))))
2830       (t       (t
2831        (easy-menu-change '("file") "Print" pr-menu-spec)))        (easy-menu-change '("file") "Print" pr-menu-spec))))
   
     ;; Key binding  
     (global-set-key [print]   'pr-ps-fast-fire)  
     (global-set-key [M-print] 'pr-ps-mode-using-ghostscript)  
     (global-set-key [C-print] 'pr-txt-fast-fire))  
2832    
2833    
2834     ((eq ps-print-emacs-type 'xemacs)    ; XEmacs     ((eq ps-print-emacs-type 'xemacs)    ; XEmacs
2835      ;; Menu binding      ;; Menu binding
2836      (pr-xemacs-global-menubar      (pr-xemacs-global-menubar
2837       (pr-x-add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))       (pr-x-add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))))
2838    
2839      ;; Key binding  
2840      (global-set-key 'f22           'pr-ps-fast-fire)    ;; Key binding
2841      (global-set-key '(meta f22)    'pr-ps-mode-using-ghostscript)    (let ((pr-print-key (if (eq ps-print-emacs-type 'emacs)
2842      (global-set-key '(control f22) 'pr-txt-fast-fire))))                            'print        ; GNU Emacs
2843                            'f22)))         ; XEmacs
2844        (global-set-key `[,pr-print-key]                'pr-ps-fast-fire)
2845        ;; Well, M-print and S-print are used because in my keyboard S-print works
2846        ;; and M-print doesn't.  But M-print can work in other keyboard.
2847        (global-set-key `[(meta ,pr-print-key)]         'pr-ps-mode-using-ghostscript)
2848        (global-set-key `[(shift ,pr-print-key)]        'pr-ps-mode-using-ghostscript)
2849        ;; Well, C-print and C-M-print are used because in my keyboard C-M-print works
2850        ;; and C-print doesn't.  But C-print can work in other keyboard.
2851        (global-set-key `[(control ,pr-print-key)]      'pr-txt-fast-fire)
2852        (global-set-key `[(control meta ,pr-print-key)] 'pr-txt-fast-fire)
2853        ))
2854    
2855    
2856  ;;; You can also use something like:  ;;; You can also use something like:
# Line 3407  If BUFFER is nil, the current buffer is Line 3326  If BUFFER is nil, the current buffer is
3326    
3327  For more information, type \\[pr-interface-help]."  For more information, type \\[pr-interface-help]."
3328    (interactive)    (interactive)
3329    (save-excursion    (pr-save-interactive
3330      (set-buffer (or buffer (current-buffer)))     (save-excursion
3331      (pr-create-interface)))       (set-buffer (or buffer (current-buffer)))
3332         (pr-create-interface))))
3333    
3334    
3335  ;;;###autoload  ;;;###autoload
# Line 3430  file name. Line 3350  file name.
3350    
3351  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3352    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS preview dir")))    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS preview dir")))
3353    (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename    (pr-save-interactive
3354                        (pr-prompt "PS preview dir"))     (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3355    (setq filename (pr-ps-file filename))                         (pr-prompt "PS preview dir"))
3356    (pr-ps-file-list n-up dir file-regexp filename)     (setq filename (pr-ps-file filename))
3357    (or pr-spool-p     (pr-ps-file-list n-up dir file-regexp filename)
3358        (pr-ps-file-preview filename)))     (or pr-spool-p
3359           (pr-ps-file-preview filename))))
3360    
3361    
3362  ;;;###autoload  ;;;###autoload
# Line 3456  file name. Line 3377  file name.
3377    
3378  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3379    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir GS")))    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir GS")))
3380    (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename    (pr-save-interactive
3381                        (pr-prompt "PS print dir GS"))     (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3382    (let ((file (pr-ps-file filename)))                         (pr-prompt "PS print dir GS"))
3383      (pr-ps-file-list n-up dir file-regexp file)     (let ((file (pr-ps-file filename)))
3384      (pr-ps-file-using-ghostscript file)       (pr-ps-file-list n-up dir file-regexp file)
3385      (or filename (pr-delete-file file))))       (pr-ps-file-using-ghostscript file)
3386         (or filename (pr-delete-file file)))))
3387    
3388    
3389  ;;;###autoload  ;;;###autoload
# Line 3482  file name. Line 3404  file name.
3404    
3405  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3406    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir")))    (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir")))
3407    (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename    (pr-save-interactive
3408                        (pr-prompt "PS print dir"))     (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3409    (let ((file (pr-ps-file filename)))                         (pr-prompt "PS print dir"))
3410      (pr-ps-file-list n-up dir file-regexp file)     (let ((file (pr-ps-file filename)))
3411      (pr-ps-file-print file)       (pr-ps-file-list n-up dir file-regexp file)
3412      (or filename (pr-delete-file file))))       (pr-ps-file-print file)
3413         (or filename (pr-delete-file file)))))
3414    
3415    
3416  ;;;###autoload  ;;;###autoload
# Line 3511  file name. Line 3434  file name.
3434  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3435    (interactive (pr-interactive-ps-dir-args    (interactive (pr-interactive-ps-dir-args
3436                  (pr-prompt (pr-prompt-gs "PS print dir"))))                  (pr-prompt (pr-prompt-gs "PS print dir"))))
3437    (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename    (pr-save-interactive
3438                        (pr-prompt (pr-prompt-gs "PS print dir")))     (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3439    (if (pr-using-ghostscript-p)                         (pr-prompt (pr-prompt-gs "PS print dir")))
3440        (pr-ps-directory-using-ghostscript n-up dir file-regexp filename)     (if (pr-using-ghostscript-p)
3441      (pr-ps-directory-print n-up dir file-regexp filename)))         (pr-ps-directory-using-ghostscript n-up dir file-regexp filename)
3442         (pr-ps-directory-print n-up dir file-regexp filename))))
3443    
3444    
3445  ;;;###autoload  ;;;###autoload
# Line 3531  argument FILENAME is treated as follows: Line 3455  argument FILENAME is treated as follows:
3455  temporary file.  If FILENAME is a string, save the PostScript image in a file  temporary file.  If FILENAME is a string, save the PostScript image in a file
3456  with that name.  If FILENAME is t, prompts for a file name."  with that name.  If FILENAME is t, prompts for a file name."
3457    (interactive (pr-interactive-n-up-file (pr-prompt "PS preview")))    (interactive (pr-interactive-n-up-file (pr-prompt "PS preview")))
3458    (if (pr-auto-mode-p)    (pr-save-interactive
3459        (pr-ps-mode-preview n-up filename)     (if (pr-auto-mode-p)
3460      (pr-ps-preview (pr-region-active-symbol) n-up filename         (pr-ps-mode-preview n-up filename)
3461                     (pr-region-active-string "PS preview"))))       (pr-ps-preview (pr-region-active-symbol) n-up filename
3462                        (pr-region-active-string "PS preview")))))
3463    
3464    
3465  ;;;###autoload  ;;;###autoload
# Line 3550  argument FILENAME is treated as follows: Line 3475  argument FILENAME is treated as follows:
3475  printer.  If FILENAME is a string, save the PostScript image in a file with  printer.  If FILENAME is a string, save the PostScript image in a file with
3476  that name.  If FILENAME is t, prompts for a file name."  that name.  If FILENAME is t, prompts for a file name."
3477    (interactive (pr-interactive-n-up-file (pr-prompt "PS print GS")))    (interactive (pr-interactive-n-up-file (pr-prompt "PS print GS")))
3478    (if (pr-auto-mode-p)    (pr-save-interactive
3479        (pr-ps-mode-using-ghostscript n-up filename)     (if (pr-auto-mode-p)
3480      (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename         (pr-ps-mode-using-ghostscript n-up filename)
3481                               (pr-region-active-string "PS print GS"))))       (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
3482                                  (pr-region-active-string "PS print GS")))))
3483    
3484    
3485  ;;;###autoload  ;;;###autoload
# Line 3569  argument FILENAME is treated as follows: Line 3495  argument FILENAME is treated as follows:
3495  printer.  If FILENAME is a string, save the PostScript image in a file with  printer.  If FILENAME is a string, save the PostScript image in a file with
3496  that name.  If FILENAME is t, prompts for a file name."  that name.  If FILENAME is t, prompts for a file name."
3497    (interactive (pr-interactive-n-up-file (pr-prompt "PS print")))    (interactive (pr-interactive-n-up-file (pr-prompt "PS print")))
3498    (if (pr-auto-mode-p)    (pr-save-interactive
3499        (pr-ps-mode-print n-up filename)     (if (pr-auto-mode-p)
3500      (pr-ps-print (pr-region-active-symbol) n-up filename         (pr-ps-mode-print n-up filename)
3501                   (pr-region-active-string "PS print"))))       (pr-ps-print (pr-region-active-symbol) n-up filename
3502                      (pr-region-active-string "PS print")))))
3503    
3504    
3505  ;;;###autoload  ;;;###autoload
# Line 3591  printer.  If FILENAME is a string, save Line 3518  printer.  If FILENAME is a string, save
3518  that name.  If FILENAME is t, prompts for a file name."  that name.  If FILENAME is t, prompts for a file name."
3519    (interactive (pr-interactive-n-up-file    (interactive (pr-interactive-n-up-file
3520                  (pr-prompt (pr-prompt-gs "PS print"))))                  (pr-prompt (pr-prompt-gs "PS print"))))
3521    (cond ((pr-auto-mode-p)    (pr-save-interactive
3522           (pr-ps-mode-ps-print n-up filename))     (cond ((pr-auto-mode-p)
3523          ((pr-using-ghostscript-p)            (pr-ps-mode-ps-print n-up filename))
3524           (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename           ((pr-using-ghostscript-p)
3525                                    (pr-region-active-string "PS print GS")))            (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
3526          (t                                     (pr-region-active-string "PS print GS")))
3527           (pr-ps-print (pr-region-active-symbol) n-up filename           (t
3528                        (pr-region-active-string "PS print")))))            (pr-ps-print (pr-region-active-symbol) n-up filename
3529                           (pr-region-active-string "PS print"))))))
3530    
3531    
3532  ;;;###autoload  ;;;###autoload
# Line 3607  that name.  If FILENAME is t, prompts fo Line 3535  that name.  If FILENAME is t, prompts fo
3535    
3536  See also `pr-ps-buffer-preview'."  See also `pr-ps-buffer-preview'."
3537    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS preview")))    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS preview")))
3538    (if (pr-auto-mode-p)    (pr-save-interactive
3539        (let ((pr-auto-region t))     (if (pr-auto-mode-p)
3540          (pr-ps-mode-preview n-up filename))         (let ((pr-auto-region t))
3541      (pr-ps-preview 'region n-up filename "PS preview region")))           (pr-ps-mode-preview n-up filename))
3542         (pr-ps-preview 'region n-up filename "PS preview region"))))
3543    
3544    
3545  ;;;###autoload  ;;;###autoload
# Line 3619  See also `pr-ps-buffer-preview'." Line 3548  See also `pr-ps-buffer-preview'."
3548    
3549  See also `pr-ps-buffer-using-ghostscript'."  See also `pr-ps-buffer-using-ghostscript'."
3550    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print GS")))    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print GS")))
3551    (if (pr-auto-mode-p)    (pr-save-interactive
3552        (let ((pr-auto-region t))     (if (pr-auto-mode-p)
3553          (pr-ps-mode-using-ghostscript n-up filename))         (let ((pr-auto-region t))
3554      (pr-ps-using-ghostscript 'region n-up filename "PS print GS region")))           (pr-ps-mode-using-ghostscript n-up filename))
3555         (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))))
3556    
3557    
3558  ;;;###autoload  ;;;###autoload
# Line 3631  See also `pr-ps-buffer-using-ghostscript Line 3561  See also `pr-ps-buffer-using-ghostscript
3561    
3562  See also `pr-ps-buffer-print'."  See also `pr-ps-buffer-print'."
3563    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print")))    (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print")))
3564    (if (pr-auto-mode-p)    (pr-save-interactive
3565        (let ((pr-auto-region t))     (if (pr-auto-mode-p)
3566          (pr-ps-mode-print n-up filename))         (let ((pr-auto-region t))
3567      (pr-ps-print 'region n-up filename "PS print region")))           (pr-ps-mode-print n-up filename))
3568         (pr-ps-print 'region n-up filename "PS print region"))))
3569    
3570    
3571  ;;;###autoload  ;;;###autoload
# Line 3644  See also `pr-ps-buffer-print'." Line 3575  See also `pr-ps-buffer-print'."
3575  See also `pr-ps-buffer-ps-print'."  See also `pr-ps-buffer-ps-print'."
3576    (interactive (pr-interactive-n-up-file    (interactive (pr-interactive-n-up-file
3577                  (pr-prompt-region (pr-prompt-gs "PS print"))))                  (pr-prompt-region (pr-prompt-gs "PS print"))))
3578    (cond ((pr-auto-mode-p)    (pr-save-interactive
3579           (let ((pr-auto-region t))     (cond ((pr-auto-mode-p)
3580             (pr-ps-mode-ps-print n-up filename)))            (let ((pr-auto-region t))
3581          ((pr-using-ghostscript-p)              (pr-ps-mode-ps-print n-up filename)))
3582           (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))           ((pr-using-ghostscript-p)
3583          (t            (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))
3584           (pr-ps-print 'region n-up filename "PS print region"))))           (t
3585              (pr-ps-print 'region n-up filename "PS print region")))))
3586    
3587    
3588  ;;;###autoload  ;;;###autoload
# Line 3659  See also `pr-ps-buffer-ps-print'." Line 3591  See also `pr-ps-buffer-ps-print'."
3591    
3592  See also `pr-ps-buffer-preview'."  See also `pr-ps-buffer-preview'."
3593    (interactive (pr-interactive-n-up-file "PS preview mode"))    (interactive (pr-interactive-n-up-file "PS preview mode"))
3594    (pr-set-n-up-and-filename 'n-up 'filename "PS preview mode")    (pr-save-interactive
3595    (let ((file (pr-ps-file filename)))     (pr-set-n-up-and-filename 'n-up 'filename "PS preview mode")
3596      (and (pr-ps-mode n-up file)     (let ((file (pr-ps-file filename)))
3597           (not pr-spool-p)       (and (pr-ps-mode n-up file)
3598           (pr-ps-file-preview file))))            (not pr-spool-p)
3599              (pr-ps-file-preview file)))))
3600    
3601    
3602  ;;;###autoload  ;;;###autoload
# Line 3672  See also `pr-ps-buffer-preview'." Line 3605  See also `pr-ps-buffer-preview'."
3605    
3606  See also `pr-ps-buffer-using-ghostscript'."  See also `pr-ps-buffer-using-ghostscript'."
3607    (interactive (pr-interactive-n-up-file "PS print GS mode"))    (interactive (pr-interactive-n-up-file "PS print GS mode"))
3608    (pr-set-n-up-and-filename 'n-up 'filename "PS print GS mode")    (pr-save-interactive
3609    (let ((file (pr-ps-file filename)))     (pr-set-n-up-and-filename 'n-up 'filename "PS print GS mode")
3610      (when (and (pr-ps-mode n-up file)     (let ((file (pr-ps-file filename)))
3611                 (not pr-spool-p))       (when (and (pr-ps-mode n-up file)
3612        (pr-ps-file-using-ghostscript file)                  (not pr-spool-p))
3613        (or filename (pr-delete-file file)))))         (pr-ps-file-using-ghostscript file)
3614           (or filename (pr-delete-file file))))))
3615    
3616    
3617  ;;;###autoload  ;;;###autoload
# Line 3686  See also `pr-ps-buffer-using-ghostscript Line 3620  See also `pr-ps-buffer-using-ghostscript
3620    
3621  See also `pr-ps-buffer-print'."  See also `pr-ps-buffer-print'."
3622    (interactive (pr-interactive-n-up-file "PS print mode"))    (interactive (pr-interactive-n-up-file "PS print mode"))
3623    (pr-set-n-up-and-filename 'n-up 'filename "PS print mode")    (pr-save-interactive
3624    (pr-ps-mode n-up filename))     (pr-set-n-up-and-filename 'n-up 'filename "PS print mode")
3625       (pr-ps-mode n-up filename)))
3626    
3627    
3628  ;;;###autoload  ;;;###autoload
# Line 3696  See also `pr-ps-buffer-print'." Line 3631  See also `pr-ps-buffer-print'."
3631    
3632  See also `pr-ps-buffer-ps-print'."  See also `pr-ps-buffer-ps-print'."
3633    (interactive (pr-interactive-n-up-file (pr-prompt-gs "PS print mode")))    (interactive (pr-interactive-n-up-file (pr-prompt-gs "PS print mode")))
3634    (if (pr-using-ghostscript-p)    (pr-save-interactive
3635        (pr-ps-mode-using-ghostscript n-up filename)     (if (pr-using-ghostscript-p)
3636      (pr-ps-mode-print n-up filename)))         (pr-ps-mode-using-ghostscript n-up filename)
3637         (pr-ps-mode-print n-up filename))))
3638    
3639    
3640  ;;;###autoload  ;;;###autoload
# Line 3715  prompts for FILE(name)-REGEXP. Line 3651  prompts for FILE(name)-REGEXP.
3651    
3652  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3653    (interactive (pr-interactive-dir-args "Printify dir"))    (interactive (pr-interactive-dir-args "Printify dir"))
3654    (pr-set-dir-args 'dir 'file-regexp "Printify dir")    (pr-save-interactive
3655    (pr-file-list dir file-regexp 'pr-printify-buffer))     (pr-set-dir-args 'dir 'file-regexp "Printify dir")
3656       (pr-file-list dir file-regexp 'pr-printify-buffer)))
3657    
3658    
3659  ;;;###autoload  ;;;###autoload
# Line 3751  prompts for FILE(name)-REGEXP. Line 3688  prompts for FILE(name)-REGEXP.
3688    
3689  See also documentation for `pr-list-directory'."  See also documentation for `pr-list-directory'."
3690    (interactive (pr-interactive-dir-args "Print dir"))    (interactive (pr-interactive-dir-args "Print dir"))
3691    (pr-set-dir-args 'dir 'file-regexp "Print dir")    (pr-save-interactive
3692    (pr-file-list dir file-regexp 'pr-txt-buffer))     (pr-set-dir-args 'dir 'file-regexp "Print dir")
3693       (pr-file-list dir file-regexp 'pr-txt-buffer)))
3694    
3695    
3696  ;;;###autoload  ;;;###autoload
# Line 3800  Noninteractively, the argument FILENAME Line 3738  Noninteractively, the argument FILENAME
3738  save the image in a temporary file.  If FILENAME is a string, save the  save the image in a temporary file.  If FILENAME is a string, save the
3739  PostScript image in a file with that name."  PostScript image in a file with that name."
3740    (interactive (list (ps-print-preprint current-prefix-arg)))    (interactive (list (ps-print-preprint current-prefix-arg)))
3741    (let ((file (pr-ps-file filename)))    (pr-save-interactive
3742      (when (stringp file)     (let ((file (pr-ps-file filename)))
3743        (pr-despool-print file)       (when (stringp file)
3744        (pr-ps-file-preview file))))         (pr-despool-print file)
3745           (pr-ps-file-preview file)))))
3746    
3747    
3748  ;;;###autoload  ;;;###autoload
# Line 3818  Noninteractively, the argument FILENAME Line 3757  Noninteractively, the argument FILENAME
3757  send the image to the printer.  If FILENAME is a string, save the PostScript  send the image to the printer.  If FILENAME is a string, save the PostScript
3758  image in a file with that name."  image in a file with that name."
3759    (interactive (list (ps-print-preprint current-prefix-arg)))    (interactive (list (ps-print-preprint current-prefix-arg)))
3760    (let ((file (pr-ps-file filename)))    (pr-save-interactive
3761      (when (stringp file)     (let ((file (pr-ps-file filename)))
3762        (pr-despool-print file)       (when (stringp file)
3763        (pr-ps-file-using-ghostscript file)         (pr-despool-print file)
3764        (or filename (pr-delete-file file)))))         (pr-ps-file-using-ghostscript file)
3765           (or filename (pr-delete-file file))))))
3766    
3767    
3768  ;;;###autoload  ;;;###autoload
# Line 3837  Noninteractively, the argument FILENAME Line 3777  Noninteractively, the argument FILENAME
3777  send the image to the printer.  If FILENAME is a string, save the PostScript  send the image to the printer.  If FILENAME is a string, save the PostScript
3778  image in a file with that name."  image in a file with that name."
3779    (interactive (list (ps-print-preprint current-prefix-arg)))    (interactive (list (ps-print-preprint current-prefix-arg)))
3780    (let ((ps-lpr-command         (pr-command pr-ps-command))    (pr-save-interactive
3781          (ps-lpr-switches        pr-ps-switches)     (pr-save-file-modes
3782          (ps-printer-name-option pr-ps-printer-switch)      (let ((ps-lpr-command         (pr-command pr-ps-command))
3783          (ps-printer-name        pr-ps-printer))            (ps-lpr-switches        pr-ps-switches)
3784      (ps-despool filename)))            (ps-printer-name-option pr-ps-printer-switch)
3785              (ps-printer-name        pr-ps-printer))
3786          (ps-despool filename)))))
3787    
3788    
3789  ;;;###autoload  ;;;###autoload
# Line 3856  Noninteractively, the argument FILENAME Line 3798  Noninteractively, the argument FILENAME
3798  send the image to the printer.  If FILENAME is a string, save the PostScript  send the image to the printer.  If FILENAME is a string, save the PostScript
3799  image in a file with that name."  image in a file with that name."
3800    (interactive (list (ps-print-preprint current-prefix-arg)))    (interactive (list (ps-print-preprint current-prefix-arg)))
3801    (if pr-print-using-ghostscript    (pr-save-interactive
3802        (pr-despool-using-ghostscript filename)     (if pr-print-using-ghostscript
3803      (pr-despool-print filename)))         (pr-despool-using-ghostscript filename)
3804         (pr-despool-print filename))))
3805    
3806    
3807  ;;;###autoload  ;;;###autoload
# Line 3873  image in a file with that name." Line 3816  image in a file with that name."
3816  (defun pr-ps-file-up-preview (n-up ifilename &optional ofilename)  (defun pr-ps-file-up-preview (n-up ifilename &optional ofilename)
3817    "Preview PostScript file FILENAME."    "Preview PostScript file FILENAME."
3818    (interactive (pr-interactive-n-up-inout "PS preview"))    (interactive (pr-interactive-n-up-inout "PS preview"))
3819    (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename    (pr-save-interactive
3820                                       "PS preview ")))     (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
3821      (pr-ps-utility-process n-up ifilename outfile)                                        "PS preview ")))
3822      (pr-ps-file-preview outfile)))       (pr-ps-utility-process n-up ifilename outfile)
3823         (pr-ps-file-preview outfile))))
3824    
3825    
3826  ;;;###autoload  ;;;###autoload
# Line 3884  image in a file with that name." Line 3828  image in a file with that name."
3828    "Print PostScript file FILENAME using ghostscript."    "Print PostScript file FILENAME using ghostscript."
3829    (interactive (list (pr-ps-infile-preprint "Print preview ")))    (interactive (list (pr-ps-infile-preprint "Print preview ")))
3830    (and (stringp filename) (file-exists-p filename)    (and (stringp filename) (file-exists-p filename)
3831         (let* ((file (pr-expand-file-name filename))         (pr-save-interactive
3832                (tempfile (pr-dosify-file-name (make-temp-file file))))          (let* ((file (pr-expand-file-name filename))
3833           ;; gs use                 (tempfile (pr-dosify-file-name (make-temp-file file))))
3834           (pr-call-process pr-gs-command            ;; gs use
3835                            (format "-sDEVICE=%s" pr-gs-device)            (pr-call-process pr-gs-command
3836                            (format "-r%d" pr-gs-resolution)                             (format "-sDEVICE=%s" pr-gs-device)
3837                            (pr-switches-string pr-gs-switches "pr-gs-switches")                             (format "-r%d" pr-gs-resolution)
3838                            (format "-sOutputFile=\"%s\"" tempfile)                             (pr-switches-string pr-gs-switches "pr-gs-switches")
3839                            file                             (format "-sOutputFile=\"%s\"" tempfile)
3840                            "-c quit")                             file
3841           ;; printing                             "-c quit")
3842           (pr-ps-file-print tempfile)            ;; printing
3843           ;; deleting            (pr-ps-file-print tempfile)
3844           (pr-delete-file tempfile))))            ;; deleting
3845              (pr-delete-file tempfile)))))
3846    
3847    
3848  ;;;###autoload  ;;;###autoload
# Line 3908  image in a file with that name." Line 3853  image in a file with that name."
3853         ;; printing         ;; printing
3854         (let ((file (pr-expand-file-name filename)))         (let ((file (pr-expand-file-name filename)))
3855           (if (string= pr-ps-command "")           (if (string= pr-ps-command "")
3856                 ;; default action
3857               (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))               (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
3858                 (save-excursion                 (save-excursion
3859                   (set-buffer ps-spool-buffer)                   (set-buffer ps-spool-buffer)
3860                   (erase-buffer)                   (erase-buffer)
3861                   (insert-file-contents-literally file))                   (insert-file-contents-literally file))
3862                 (pr-despool-print))                 (pr-despool-print))
3863               ;; use `pr-ps-command' to print
3864             (apply 'pr-call-process             (apply 'pr-call-process
3865                    pr-ps-command                    pr-ps-command
3866                    (pr-switches-string pr-ps-switches "pr-gs-switches")                    (pr-switches-string pr-ps-switches "pr-gs-switches")
# Line 3958  file name." Line 3905  file name."
3905                  (if pr-print-using-ghostscript                  (if pr-print-using-ghostscript
3906                      "PS print GS"                      "PS print GS"
3907                    "PS print")))                    "PS print")))
3908    (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename    (pr-save-interactive
3909                                       (if pr-print-using-ghostscript     (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
3910                                           "PS print GS "                                        (if pr-print-using-ghostscript
3911                                         "PS print "))))                                            "PS print GS "
3912      (pr-ps-utility-process n-up ifilename outfile)                                          "PS print "))))
3913      (unless ofilename       (pr-ps-utility-process n-up ifilename outfile)
3914        (pr-ps-file-ps-print outfile)       (unless ofilename
3915        (pr-delete-file outfile))))         (pr-ps-file-ps-print outfile)
3916           (pr-delete-file outfile)))))
3917    
3918    
3919  ;;;###autoload  ;;;###autoload
3920  (defun pr-toggle-file-duplex ()  (defun pr-toggle-file-duplex ()
3921    "Toggle duplex for PostScript file."    "Toggle duplex for PostScript file."
3922    (interactive)    (interactive)
3923    (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil    (pr-save-interactive
3924               '("PostScript Print" "File")))     (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil
3925                  '("PostScript Print" "File"))))
3926    
3927    
3928  ;;;###autoload  ;;;###autoload
# Line 3985  right. Line 3934  right.
3934  If tumble is on, produces a printing suitable for binding at the top or  If tumble is on, produces a printing suitable for binding at the top or
3935  bottom."  bottom."
3936    (interactive)    (interactive)
3937    (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil    (pr-save-interactive
3938               '("PostScript Print" "File")))     (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil
3939                  '("PostScript Print" "File"))))
3940    
3941    
3942  ;;;###autoload  ;;;###autoload
3943  (defun pr-toggle-file-landscape ()  (defun pr-toggle-file-landscape ()
3944    "Toggle landscape for PostScript file."    "Toggle landscape for PostScript file."
3945    (interactive)    (interactive)
3946    (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil    (pr-save-interactive
3947               '("PostScript Print" "File")))     (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil
3948                  '("PostScript Print" "File"))))
3949    
3950    
3951  ;;;###autoload  ;;;###autoload
3952  (defun pr-toggle-ghostscript ()  (defun pr-toggle-ghostscript ()
3953    "Toggle printing using ghostscript."    "Toggle printing using ghostscript."
3954    (interactive)    (interactive)
3955    (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript"    (pr-save-interactive
3956               'postscript-process 2 12 'toggle))     (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript"
3957                  'postscript-process 2 12 'toggle)))
3958    
3959    
3960  ;;;###autoload  ;;;###autoload
3961  (defun pr-toggle-faces ()  (defun pr-toggle-faces ()
3962    "Toggle printing with faces."    "Toggle printing with faces."
3963    (interactive)    (interactive)
3964    (pr-toggle 'pr-faces-p "Printing with faces"    (pr-save-interactive
3965               'postscript-process 1 12 'toggle))     (pr-toggle 'pr-faces-p "Printing with faces"
3966                  'postscript-process 1 12 'toggle)))
3967    
3968    
3969  ;;;###autoload  ;;;###autoload
3970  (defun pr-toggle-spool ()  (defun pr-toggle-spool ()
3971    "Toggle spooling."    "Toggle spooling."
3972    (interactive)    (interactive)
3973    (pr-toggle 'pr-spool-p "Spooling printing"    (pr-save-interactive
3974               'postscript-process 0 12 'toggle))     (pr-toggle 'pr-spool-p "Spooling printing"
3975                  'postscript-process 0 12 'toggle)))
3976    
3977    
3978  ;;;###autoload  ;;;###autoload
3979  (defun pr-toggle-duplex ()  (defun pr-toggle-duplex ()
3980    "Toggle duplex."    "Toggle duplex."
3981    (interactive)    (interactive)
3982    (pr-toggle 'ps-spool-duplex "Printing duplex"    (pr-save-interactive
3983               'postcsript-options 5 12 'toggle))     (pr-toggle 'ps-spool-duplex "Printing duplex"
3984                  'postcsript-options 5 12 'toggle)))
3985    
3986    
3987  ;;;###autoload  ;;;###autoload
# Line 4038  right. Line 3993  right.
3993  If tumble is on, produces a printing suitable for binding at the top or  If tumble is on, produces a printing suitable for binding at the top or
3994  bottom."  bottom."
3995    (interactive)    (interactive)
3996    (pr-toggle 'ps-spool-tumble "Tumble"    (pr-save-interactive
3997               'postscript-options 6 12 'toggle))     (pr-toggle 'ps-spool-tumble "Tumble"
3998                  'postscript-options 6 12 'toggle)))
3999    
4000    
4001  ;;;###autoload  ;;;###autoload
4002  (defun pr-toggle-landscape ()  (defun pr-toggle-landscape ()
4003    "Toggle landscape."    "Toggle landscape."
4004    (interactive)    (interactive)
4005    (pr-toggle 'ps-landscape-mode "Landscape"    (pr-save-interactive
4006               'postscript-options 0 12 'toggle))     (pr-toggle 'ps-landscape-mode "Landscape"
4007                  'postscript-options 0 12 'toggle)))
4008    
4009    
4010  ;;;###autoload  ;;;###autoload
4011  (defun pr-toggle-upside-down ()  (defun pr-toggle-upside-down ()
4012    "Toggle upside-down."    "Toggle upside-down."
4013    (interactive)    (interactive)
4014    (pr-toggle 'ps-print-upside-down "Upside-Down"    (pr-save-interactive
4015               'postscript-options 7 12 'toggle))     (pr-toggle 'ps-print-upside-down "Upside-Down"
4016                  'postscript-options 7 12 'toggle)))
4017    
4018    
4019  ;;;###autoload  ;;;###autoload
4020  (defun pr-toggle-line ()  (defun pr-toggle-line ()
4021    "Toggle line number."    "Toggle line number."
4022    (interactive)    (interactive)
4023    (pr-toggle 'ps-line-number "Line number"    (pr-save-interactive
4024               'postscript-options 3 12 'toggle))     (pr-toggle 'ps-line-number "Line number"
4025                  'postscript-options 3 12 'toggle)))
4026    
4027    
4028  ;;;###autoload  ;;;###autoload
4029  (defun pr-toggle-zebra ()  (defun pr-toggle-zebra ()
4030    "Toggle zebra stripes."    "Toggle zebra stripes."
4031    (interactive)    (interactive)
4032    (pr-toggle 'ps-zebra-stripes "Zebra stripe"    (pr-save-interactive
4033               'postscript-options 4 12 'toggle))     (pr-toggle 'ps-zebra-stripes "Zebra stripe"
4034                  'postscript-options 4 12 'toggle)))
4035    
4036    
4037  ;;;###autoload  ;;;###autoload
4038  (defun pr-toggle-header ()  (defun pr-toggle-header ()
4039    "Toggle printing header."    "Toggle printing header."
4040    (interactive)    (interactive)
4041    (pr-toggle 'ps-print-header "Print header"    (pr-save-interactive
4042               'postscript-options 1 12 'toggle))     (pr-toggle 'ps-print-header "Print header"
4043                  'postscript-options 1 12 'toggle)))
4044    
4045    
4046  ;;;###autoload  ;;;###autoload
4047  (defun pr-toggle-header-frame ()  (defun pr-toggle-header-frame ()
4048    "Toggle printing header frame."    "Toggle printing header frame."
4049    (interactive)    (interactive)
4050    (pr-toggle 'ps-print-header-frame "Print header frame"    (pr-save-interactive
4051               'postscript-options 2 12 'toggle))     (pr-toggle 'ps-print-header-frame "Print header frame"
4052                  'postscript-options 2 12 'toggle)))
4053    
4054    
4055  ;;;###autoload  ;;;###autoload
4056  (defun pr-toggle-lock ()  (defun pr-toggle-lock ()
4057    "Toggle menu lock."    "Toggle menu lock."
4058    (interactive)    (interactive)
4059    (pr-toggle 'pr-menu-lock "Menu lock"    (pr-save-interactive
4060               'printing 2 12 'toggle))     (pr-toggle 'pr-menu-lock "Menu lock"
4061                  'printing 2 12 'toggle)))
4062    
4063    
4064  ;;;###autoload  ;;;###autoload
4065  (defun pr-toggle-region ()  (defun pr-toggle-region ()
4066    "Toggle auto region."    "Toggle auto region."
4067    (interactive)    (interactive)
4068    (pr-toggle 'pr-auto-region "Auto region"    (pr-save-interactive
4069               'printing 0 12 'toggle))     (pr-toggle 'pr-auto-region "Auto region"
4070                  'printing 0 12 'toggle)))
4071    
4072    
4073  ;;;###autoload  ;;;###autoload
4074  (defun pr-toggle-mode ()  (defun pr-toggle-mode ()
4075    "Toggle auto mode."    "Toggle auto mode."
4076    (interactive)    (interactive)
4077    (pr-toggle 'pr-auto-mode "Auto mode"    (pr-save-interactive
4078               'printing 1 12 'toggle))     (pr-toggle 'pr-auto-mode "Auto mode"
4079                  'printing 1 12 'toggle)))
4080    
4081    
4082  ;;;###autoload  ;;;###autoload
# Line 4139  bottom." Line 4104  bottom."
4104  (defun pr-ps-name ()  (defun pr-ps-name ()
4105    "Interactively select a PostScript printer."    "Interactively select a PostScript printer."
4106    (interactive)    (interactive)
4107    (pr-menu-set-ps-title    (pr-save-interactive
4108     (pr-complete-alist "PostScript printer" pr-ps-printer-alist pr-ps-name)))     (pr-menu-set-ps-title
4109        (pr-complete-alist "PostScript printer"
4110                           pr-ps-printer-alist pr-ps-name))))
4111    
4112    
4113  ;;;###autoload  ;;;###autoload
4114  (defun pr-txt-name ()  (defun pr-txt-name ()
4115    "Interactively select a text printer."    "Interactively select a text printer."
4116    (interactive)    (interactive)
4117    (pr-menu-set-txt-title    (pr-save-interactive
4118     (pr-complete-alist "Text printer" pr-txt-printer-alist pr-txt-name)))     (pr-menu-set-txt-title
4119        (pr-complete-alist "Text printer"
4120                           pr-txt-printer-alist pr-txt-name))))
4121    
4122    
4123  ;;;###autoload  ;;;###autoload
4124  (defun pr-ps-utility ()  (defun pr-ps-utility ()
4125    "Interactively select a PostScript utility."    "Interactively select a PostScript utility."
4126    (interactive)    (interactive)
4127    (pr-menu-set-utility-title    (pr-save-interactive
4128     (pr-complete-alist "Postscript utility" pr-ps-utility-alist pr-ps-utility)))     (pr-menu-set-utility-title
4129        (pr-complete-alist "Postscript utility"
4130                           pr-ps-utility-alist pr-ps-utility))))
4131    
4132    
4133  ;;;###autoload  ;;;###autoload
# Line 4247  Note that this command always behaves as Line 4218  Note that this command always behaves as
4218  are both set to t."  are both set to t."
4219    (interactive (list (pr-interactive-n-up (pr-prompt-gs "PS print fast"))    (interactive (list (pr-interactive-n-up (pr-prompt-gs "PS print fast"))
4220                       current-prefix-arg))                       current-prefix-arg))
4221    (let ((pr-auto-region t)    (pr-save-interactive
4222          (pr-auto-mode   t)     (let ((pr-auto-region t)
4223          filename)           (pr-auto-mode   t)
4224      (cond ((null select))           filename)
4225            ((listp select)       (cond ((null select))
4226             (pr-ps-name))             ((listp select)
4227            ((and (symbolp select)              (pr-ps-name))
4228                  (assq select pr-ps-printer-alist))             ((and (symbolp select)
4229             (pr-menu-set-ps-title select))                   (assq select pr-ps-printer-alist))
4230            ((integerp select)              (pr-menu-set-ps-title select))
4231             (and (/= select 1)             ((integerp select)
4232                  (pr-ps-name))              (and (/= select 1)
4233             (and (>= select 1) (not pr-spool-p)                   (pr-ps-name))
4234                  (setq filename (pr-ps-outfile-preprint              (and (>= select 1) (not pr-spool-p)
4235                                  (if pr-print-using-ghostscript                   (setq filename (pr-ps-outfile-preprint
4236                                      "Fast GS "                                   (if pr-print-using-ghostscript
4237                                    "Fast "))))))                                       "Fast GS "
4238      (pr-ps-buffer-ps-print                                     "Fast "))))))
4239       (if (integerp n-up)       (pr-ps-buffer-ps-print
4240           (min (max n-up 1) 100)        (if (integerp n-up)
4241         (error "n-up must be an integer greater than zero"))            (min (max n-up 1) 100)
4242       filename)))          (error "n-up must be an integer greater than zero"))
4243          filename))))
4244    
4245    
4246  ;;;###autoload  ;;;###autoload
# Line 4296  Noninteractively, the argument SELECT-PR Line 4268  Noninteractively, the argument SELECT-PR
4268  Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode'  Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode'
4269  are both set to t."  are both set to t."
4270    (interactive (list current-prefix-arg))    (interactive (list current-prefix-arg))
4271    (cond ((null select-printer))    (pr-save-interactive
4272          ((and (symbolp select-printer)     (cond ((null select-printer))
4273                (assq select-printer pr-txt-printer-alist))           ((and (symbolp select-printer)
4274           (pr-menu-set-txt-title select-printer))                 (assq select-printer pr-txt-printer-alist))
4275          (t            (pr-menu-set-txt-title select-printer))
4276           (pr-txt-name)))           (t
4277    (let ((pr-auto-region t)            (pr-txt-name)))
4278          (pr-auto-mode   t))     (let ((pr-auto-region t)
4279      (pr-txt-buffer)))           (pr-auto-mode   t))
4280         (pr-txt-buffer))))
4281    
4282    
4283  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
# Line 4350  Or choose the menu option Printing/Show Line 4323  Or choose the menu option Printing/Show
4323        nil        nil
4324        '(20 . pr-temp-dir)        '(20 . pr-temp-dir)
4325        '(20 . pr-ps-temp-file)        '(20 . pr-ps-temp-file)
4326          '(20 . pr-file-modes)
4327        '(20 . pr-delete-temp-file)        '(20 . pr-delete-temp-file)
4328        '(20 . pr-list-directory)        '(20 . pr-list-directory)
4329        nil        nil
# Line 4704  See `pr-visible-entry-alist'.") Line 4678  See `pr-visible-entry-alist'.")
4678    
4679      ;; GNU Emacs      ;; GNU Emacs
4680      (defun pr-menu-lock (entry index horizontal state path)      (defun pr-menu-lock (entry index horizontal state path)
4681        (when (and (not (interactive-p)) pr-menu-lock)        (when (and (not pr-interactive-p) pr-menu-lock)
4682          (or (and pr-menu-position (eq state pr-menu-state))          (or (and pr-menu-position (eq state pr-menu-state))
4683              (setq pr-menu-position (pr-menu-position entry index horizontal)              (setq pr-menu-position (pr-menu-position entry index horizontal)
4684                    pr-menu-state    state))                    pr-menu-state    state))
# Line 4726  See `pr-visible-entry-alist'.") Line 4700  See `pr-visible-entry-alist'.")
4700    
4701      ;; XEmacs      ;; XEmacs
4702      (defun pr-menu-lock (entry index horizontal state path)      (defun pr-menu-lock (entry index horizontal state path)
4703        (when (and (not (interactive-p)) pr-menu-lock)        (when (and (not pr-interactive-p) pr-menu-lock)
4704          (or (and pr-menu-position (eq state pr-menu-state))          (or (and pr-menu-position (eq state pr-menu-state))
4705              (setq pr-menu-position (pr-menu-position entry index horizontal)              (setq pr-menu-position (pr-menu-position entry index horizontal)
4706                    pr-menu-state    state))                    pr-menu-state    state))
# Line 4757  non-nil, update text printer menu iff `p Line 4731  non-nil, update text printer menu iff `p
4731  non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is  non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
4732  non-nil."  non-nil."
4733    (interactive "P")    (interactive "P")
4734    (pr-update-var 'pr-ps-name pr-ps-printer-alist)    (pr-save-interactive
4735    (pr-update-var 'pr-txt-name pr-txt-printer-alist)     (pr-update-var 'pr-ps-name pr-ps-printer-alist)
4736    (pr-update-var 'pr-ps-utility pr-ps-utility-alist)     (pr-update-var 'pr-txt-name pr-txt-printer-alist)
4737    (pr-do-update-menus force))     (pr-update-var 'pr-ps-utility pr-ps-utility-alist)
4738       (pr-do-update-menus force)))
4739    
4740    
4741  (defvar pr-ps-printer-menu-modified  t  (defvar pr-ps-printer-menu-modified  t
# Line 5280  non-nil." Line 5255  non-nil."
5255    (or (symbol-value n-up-sym)    (or (symbol-value n-up-sym)
5256        (set n-up-sym (pr-interactive-n-up prompt)))        (set n-up-sym (pr-interactive-n-up prompt)))
5257    (and (eq (symbol-value infile-sym) t)    (and (eq (symbol-value infile-sym) t)
5258         (set infile-sym (and (not (interactive-p))         (set infile-sym (and (not pr-interactive-p)
5259                              (pr-ps-infile-preprint prompt))))                              (pr-ps-infile-preprint prompt))))
5260    ;; input file    ;; input file
5261    (or (symbol-value infile-sym)    (or (symbol-value infile-sym)
# Line 5288  non-nil." Line 5263  non-nil."
5263    (set infile-sym (pr-dosify-file-name (symbol-value infile-sym)))    (set infile-sym (pr-dosify-file-name (symbol-value infile-sym)))
5264    ;; output file    ;; output file
5265    (and (eq (symbol-value outfile-sym) t)    (and (eq (symbol-value outfile-sym) t)
5266         (set outfile-sym (and (not (interactive-p))         (set outfile-sym (and (not pr-interactive-p)
5267                               current-prefix-arg                               current-prefix-arg
5268                               (pr-ps-outfile-preprint prompt))))                               (pr-ps-outfile-preprint prompt))))
5269    (and (symbol-value outfile-sym)    (and (symbol-value outfile-sym)
# Line 5331  non-nil." Line 5306  non-nil."
5306    
5307    
5308  (defun pr-call-process (command &rest args)  (defun pr-call-process (command &rest args)
5309    (let ((buffer (get-buffer-create "*Printing Command Output*"))    (pr-save-file-modes
5310          (cmd    (pr-command command))     (let ((buffer (get-buffer-create "*Printing Command Output*"))
5311          status)           (cmd    (pr-command command))
5312      (setq args (pr-remove-nil-from-list args))           status)
5313      (save-excursion       (setq args (pr-remove-nil-from-list args))
5314        (set-buffer buffer)       (save-excursion
5315        (goto-char (point-max))         (set-buffer buffer)
5316        (insert (format "%s %S\n" cmd args)))         (goto-char (point-max))
5317      (setq status         (insert (format "%s %S\n" cmd args)))
5318            (condition-case data       (setq status
5319                (apply 'call-process cmd nil buffer nil args)             (condition-case data
5320              ((quit error)                 (apply 'call-process cmd nil buffer nil args)
5321               (error-message-string data))))               ((quit error)
5322      (save-excursion                (error-message-string data))))
5323        (set-buffer buffer)       (save-excursion
5324        (goto-char (point-max))         (set-buffer buffer)
5325        (insert (format "Exit status: %s\n" status)))))         (goto-char (point-max))
5326           (insert (format "Exit status: %s\n" status))))))
5327    
5328    
5329  (defun pr-txt-print (from to)  (defun pr-txt-print (from to)
# Line 5485  non-nil." Line 5461  non-nil."
5461  (defun pr-set-outfilename (filename-sym)  (defun pr-set-outfilename (filename-sym)
5462    (and (not pr-spool-p)    (and (not pr-spool-p)
5463         (eq (symbol-value filename-sym) t)         (eq (symbol-value filename-sym) t)
5464         (set filename-sym (and (not (interactive-p))         (set filename-sym (and (not pr-interactive-p)
5465                                current-prefix-arg                                current-prefix-arg
5466                                (ps-print-preprint current-prefix-arg))))                                (ps-print-preprint current-prefix-arg))))
5467    (and (symbol-value filename-sym)    (and (symbol-value filename-sym)
# Line 5580  non-nil." Line 5556  non-nil."
5556    
5557    
5558  (defun pr-text2ps (kind n-up filename &optional from to)  (defun pr-text2ps (kind n-up filename &optional from to)
5559    (let ((ps-n-up-printing n-up)    (pr-save-file-modes
5560          (ps-spool-config (and (eq ps-spool-config 'setpagedevice)     (let ((ps-n-up-printing n-up)
5561                                'setpagedevice)))           (ps-spool-config (and (eq ps-spool-config 'setpagedevice)
5562      (pr-delete-file-if-exists filename)                                 'setpagedevice)))
5563      (cond (pr-faces-p       (pr-delete-file-if-exists filename)
5564             (cond (pr-spool-p       (cond (pr-faces-p
5565                    ;; pr-faces-p and pr-spool-p              (cond (pr-spool-p
5566                    ;; here FILENAME arg is ignored                     ;; pr-faces-p and pr-spool-p
5567                    (cond ((eq kind 'buffer)                     ;; here FILENAME arg is ignored
5568                           (ps-spool-buffer-with-faces))                     (cond ((eq kind 'buffer)
5569                          ((eq kind 'region)                            (ps-spool-buffer-with-faces))
5570                           (ps-spool-region-with-faces (or from (point))                           ((eq kind 'region)
5571                                                       (or to (mark))))                            (ps-spool-region-with-faces (or from (point))
5572                          ))                                                        (or to (mark))))
5573                             ))
5574                    ;; pr-faces-p and not pr-spool-p                    ;; pr-faces-p and not pr-spool-p
5575                   ((eq kind 'buffer)                    ((eq kind 'buffer)
5576                    (ps-print-buffer-with-faces filename))                     (ps-print-buffer-with-faces filename))
5577                   ((eq kind 'region)                    ((eq kind 'region)
5578                    (ps-print-region-with-faces (or from (point))                     (ps-print-region-with-faces (or from (point))
5579                                                (or to (mark)) filename))                                                 (or to (mark)) filename))
5580                   ))                    ))
5581            (pr-spool-p             (pr-spool-p
5582             ;; not pr-faces-p and pr-spool-p              ;; not pr-faces-p and pr-spool-p
5583             ;; here FILENAME arg is ignored              ;; here FILENAME arg is ignored
5584             (cond ((eq kind 'buffer)              (cond ((eq kind 'buffer)
5585                    (ps-spool-buffer))                     (ps-spool-buffer))
5586                   ((eq kind 'region)                    ((eq kind 'region)
5587                    (ps-spool-region (or from (point)) (or to (mark))))                     (ps-spool-region (or from (point)) (or to (mark))))
5588                   ))                    ))
5589            ;; not pr-faces-p and not pr-spool-p             ;; not pr-faces-p and not pr-spool-p
5590            ((eq kind 'buffer)             ((eq kind 'buffer)
5591             (ps-print-buffer filename))              (ps-print-buffer filename))
5592            ((eq kind 'region)             ((eq kind 'region)
5593             (ps-print-region (or from (point)) (or to (mark)) filename))              (ps-print-region (or from (point)) (or to (mark)) filename))
5594            )))             ))))
5595    
5596    
5597  (defun pr-command (command)  (defun pr-command (command)
# Line 6154  COMMAND.exe, COMMAND.bat and COMMAND.com Line 6131  COMMAND.exe, COMMAND.bat and COMMAND.com
6131  (defun pr-interface-ps-print (&rest ignore)  (defun pr-interface-ps-print (&rest ignore)
6132    "Print using ps-print package."    "Print using ps-print package."
6133    (interactive)    (interactive)
6134    (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print    (pr-save-interactive
6135                     'pr-ps-file-ps-print 'pr-ps-file-up-ps-print     (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print
6136                     'pr-ps-region-ps-print 'pr-ps-mode-ps-print                      'pr-ps-file-ps-print 'pr-ps-file-up-ps-print
6137                     'pr-ps-buffer-ps-print))                      'pr-ps-region-ps-print 'pr-ps-mode-ps-print
6138                        'pr-ps-buffer-ps-print)))
6139    
6140    
6141  (defun pr-interface-preview (&rest ignore)  (defun pr-interface-preview (&rest ignore)
6142    "Preview a PostScript file."    "Preview a PostScript file."
6143    (interactive)    (interactive)
6144    (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview    (pr-save-interactive
6145                     'pr-ps-file-preview 'pr-ps-file-up-preview     (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview
6146                     'pr-ps-region-preview 'pr-ps-mode-preview                      'pr-ps-file-preview 'pr-ps-file-up-preview
6147                     'pr-ps-buffer-preview))                      'pr-ps-region-preview 'pr-ps-mode-preview
6148                        'pr-ps-buffer-preview)))
6149    
6150    
6151  (defun pr-interface-ps (ps-despool ps-directory ps-file ps-file-up ps-region  (defun pr-interface-ps (ps-despool ps-directory ps-file ps-file-up ps-region

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26