• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +refs:ps +refs:printing +refs:region

0 ;;; printing.el --- printing utilities
13 "printing.el, v 6.8.4 <2005/06/11 vinicius>
42 ;; With `printing' you can preview or print a PostScript file. You can also
51 ;; The `printing' menu replaces the usual print options in the menu bar.
59 ;; `printing' is prepared to run on GNU, Unix and NT systems.
60 ;; On GNU or Unix system, `printing' depends on gs and gv utilities.
61 ;; On NT system, `printing' depends on gstools (gswin32.exe and gsview32.exe).
65 ;; `printing' depends on ps-print package to generate PostScript files, to
66 ;; spool and to despool PostScript buffer. So, `printing' provides an
67 ;; interface to ps-print package and it also provides some extra stuff.
69 ;; To download the latest ps-print package see
71 ;; Please, see README file for ps-print installation instructions.
73 ;; `printing' was inspired on:
76 ;; Special printing functions for Windows NT
81 ;; win32-ps-print.el Matthew O. Persico <mpersico@erols.com>
82 ;; PostScript printing with ghostscript
84 ;; ps-print-interface.el Volker Franz <volker.franz@tuebingen.mpg.de>
85 ;; Graphical front end for ps-print and previewing
91 ;; The buffer *Printing Command Output* is where the `printing' log messages
92 ;; are inserted. All program called by `printing' has a log entry in the
100 ;; PROGRAM is the program activated by `printing',
109 ;; /usr/X11R6/bin/gv ("/home/user/example/file.ps")
116 ;; /usr/X11R6/bin/gv ("/home/user/example/file.ps")
127 ;; First of all, see printing documentation only to get an idea of what
128 ;; `printing' is capable.
130 ;; Then try to set the variables: `pr-ps-name', `pr-ps-printer-alist',
132 ;; are the main variables for printing processing.
135 ;; typing C-h v pr-ps-name RET (for example) if you already loaded printing
136 ;; package, or by browsing printing.el source file.
139 ;; documentation, please, send an email to maintainer. All printing users
151 ;; (require 'printing) ; load printing package
164 ;; (setq pr-ps-name 'lps_06b)
165 ;; (setq pr-ps-printer-alist
178 ;; (require 'printing) ; load printing package
189 ;; (setq pr-ps-name 'lps_06b)
190 ;; (setq pr-ps-printer-alist
201 ;; NOTE 2: The `printer-name' and `ps-printer-name' variables don't need to be
202 ;; set, as they are implicit set by `pr-ps-printer-alist' and
227 ;; computer before printing.
231 ;; to nil. Probably `printing' is deleting the temporary file before your
235 ;; modifying while `printing' tries to print. Eventually you got an error
275 ;; (setq pr-ps-printer-alist
296 ;; See also documentation for `pr-ps-printer-alist'.
299 ;; Using `printing'
302 ;; To use `printing' insert in your ~/.emacs file (or c:/_emacs, if you're
305 ;; (require 'printing)
316 ;; To use `printing' utilities you can use the Printing menu options, type M-x
320 ;; `printing' has the following commands:
323 ;; pr-ps-directory-preview
324 ;; pr-ps-directory-using-ghostscript
325 ;; pr-ps-directory-print
326 ;; pr-ps-directory-ps-print
327 ;; pr-ps-buffer-preview
328 ;; pr-ps-buffer-using-ghostscript
329 ;; pr-ps-buffer-print
330 ;; pr-ps-buffer-ps-print
331 ;; pr-ps-region-preview
332 ;; pr-ps-region-using-ghostscript
333 ;; pr-ps-region-print
334 ;; pr-ps-region-ps-print
335 ;; pr-ps-mode-preview
336 ;; pr-ps-mode-using-ghostscript
337 ;; pr-ps-mode-print
338 ;; pr-ps-mode-ps-print
339 ;; pr-ps-file-preview
340 ;; pr-ps-file-up-preview
341 ;; pr-ps-file-using-ghostscript
342 ;; pr-ps-file-print
343 ;; pr-ps-file-ps-print
344 ;; pr-ps-file-up-ps-print
345 ;; pr-ps-fast-fire
349 ;; pr-despool-ps-print
352 ;; pr-printify-region
355 ;; pr-txt-region
372 ;; pr-toggle-region
377 ;; pr-ps-name
379 ;; pr-ps-utility
380 ;; pr-show-ps-setup
387 ;; `pr-interface' buffer interface for printing package.
388 ;; `pr-help' help for printing package.
389 ;; `pr-ps-name' interactively select a PostScript printer.
391 ;; `pr-ps-utility' interactively select a PostScript utility.
393 ;; `pr-ps-*' deal with PostScript code generation.
406 ;; `*-ps-print' send PostScript directly to printer or use
413 ;; `*-region*' process a region.
420 ;; `pr-ps-buffer-using-ghostscript'
423 ;; `pr-ps-file-print'
431 ;; generated by `ps-print' package.
433 ;; Besides operating one buffer or region each time, you also can postpone
434 ;; previewing or printing by saving the PostScript code generated in a
436 ;; successive printing. You can toggle on/off spooling by invoking
441 ;; C-u M-x pr-ps-buffer-print RET
443 ;; The `pr-ps-buffer-print' command prompts you for a n-up printing number and
448 ;; generation, that is, with `pr-ps-*' and `pr-despool-*' commands. If
457 ;; `printing' has also a special way to handle some major mode through
458 ;; `*-mode*' commands. So it's possible to customize a major mode printing,
463 ;; buffer before printing, you'll get a nicely formatted list of article
464 ;; subjects shows up at the printer. With major mode printing you don't need
469 ;; (global-set-key [print] 'pr-ps-fast-fire)
470 ;; (global-set-key [M-print] 'pr-ps-mode-using-ghostscript)
471 ;; (global-set-key [S-print] 'pr-ps-mode-using-ghostscript)
477 ;; (global-set-key 'f22 'pr-ps-fast-fire)
478 ;; (global-set-key '(meta f22) 'pr-ps-mode-using-ghostscript)
479 ;; (global-set-key '(shift f22) 'pr-ps-mode-using-ghostscript)
483 ;; As a suggestion of global keyboard mapping for some `printing' commands:
486 ;; (global-set-key "\C-cbp" 'pr-ps-buffer-print)
487 ;; (global-set-key "\C-cbx" 'pr-ps-buffer-preview)
488 ;; (global-set-key "\C-cbb" 'pr-ps-buffer-using-ghostscript)
489 ;; (global-set-key "\C-crp" 'pr-ps-region-print)
490 ;; (global-set-key "\C-crx" 'pr-ps-region-preview)
491 ;; (global-set-key "\C-crr" 'pr-ps-region-using-ghostscript)
497 ;; Below it's shown a brief description of `printing' options, please, see the
505 ;; `pr-txt-name' Specify a printer for printing a text file.
509 ;; `pr-ps-name' Specify a printer for printing a PostScript
512 ;; `pr-ps-printer-alist' Specify an alist for all PostScript printers.
515 ;; printing.
517 ;; `pr-ps-temp-file' Specify PostScript temporary file name prefix.
538 ;; `pr-spool-p' Non-nil means spool printing in a buffer.
549 ;; `pr-auto-region' Non-nil means region is automagically detected.
551 ;; `pr-auto-mode' Non-nil means major-mode specific printing is
552 ;; prefered over normal printing.
554 ;; `pr-mode-alist' Specify an alist for a major-mode and printing
557 ;; `pr-ps-utility' Specify PostScript utility processing.
559 ;; `pr-ps-utility-alist' Specify an alist for PostScript utility
580 ;; printing package.
609 ;; and then customize `printing' options.
625 ;; and then customize `printing' options.
633 ;; then click on *printing*
634 ;; and then customize `printing' options.
642 ;; The `printing' menu (Tools/Printing or File/Print) has the following layout:
674 ;; 23 | Show Settings >|-------|printing| |( )Odd Pages |
675 ;; 24 | Help | |ps-print| |( )Even Sheets|
689 ;; I. PostScript printing:
692 ;; menu) or PostScript temporary file for a directory, a buffer, a region
693 ;; or a major mode, choosing 1-up, 2-up, 4-up or any other n-up printing;
697 ;; Instead of previewing each buffer, region or major mode at once, you
707 ;; NOTE 1: It's possible to customize a major mode printing, just declare
712 ;; forget to switch to the *Article* buffer before printing,
714 ;; up at the printer. With major mode printing you don't need to
722 ;; See `pr-ps-utility-alist' and `pr-setting-database' for
724 ;; Ic. Do n-up processing before printing.
730 ;; `pr-ps-utility-alist'.
737 ;; temporarily in a buffer instead of printing it or saving it in a file.
739 ;; of printing each buffer, region or major mode at once, you can save
750 ;; in `pr-ps-printer-alist' variable (see it for documentation).
753 ;; II. Text printing:
757 ;; option. All control characters in your buffer or region will be
764 ;; 5. If you want to print a directory, buffer, region or major mode in a
774 ;; 7. If you want a PostScript landscape printing, turn on this option.
788 ;; 12. If you want a duplex printing and your PostScript printer has this
791 ;; 13. If you turned on duplex printing, you can choose if you want to have
792 ;; a printing suitable for binding on the left or right (tumble off), or
793 ;; to have a printing suitable for binding at top or bottom (tumble on).
796 ;; 14. If you want a PostScript upside-down printing, turn on this option.
800 ;; See also `ps-even-or-odd-pages'.
820 ;; 19. If you want that region is automagically detected, turn on this
823 ;; like `*-region*' commands, that is, `*-buffer*' commands will print
824 ;; only the region marked instead of all buffer.
827 ;; declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
839 ;; more PostScript options in `ps-print' option. Or you can customize
840 ;; some `lpr' options for text printing. Or customize `printing'
843 ;; 23. Show current settings for `printing', `ps-print' or `lpr'.
845 ;; 24. Quick help for printing menu layout.
851 ;; Below it's shown only the main options that affect all `printing' package.
852 ;; Check all the settings below *BEFORE* running `printing' commands.
856 ;; (require 'printing)
867 ;; (setq pr-ps-name 'lps_06b)
868 ;; (setq pr-ps-printer-alist
879 ;; (setq pr-ps-utility 'mpage)
880 ;; (setq pr-ps-utility-alist
895 ;; (require 'printing)
908 ;; (setq pr-ps-name 'lps_06b)
909 ;; (setq pr-ps-printer-alist
925 ;; (setq pr-ps-utility 'psnup)
926 ;; (setq pr-ps-utility-alist
939 ;; `pr-ps-utility-alist'.
945 ;; `printing' package has the following utilities:
947 ;; `pr-setup' Return the current `printing' setup.
953 ;; `pr-menu-bind' Install `printing' menu in the menubar.
958 ;; * For `printing' package:
960 ;; printing `http://www.emacswiki.org/cgi-bin/emacs/download/printing.el'
961 ;; ps-print `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'
984 ;; printing menu (in `pr-menu-spec') merging suggestion.
999 ;; - even/odd pages printing.
1000 ;; - ghostscript parameters for `pr-ps-printer-alist'.
1003 ;; - automagic region detection.
1005 ;; - fast fire PostScript printing command.
1013 ;; - extra parameters for `pr-ps-printer-alist'.
1018 ;; Matthew O. Persico <mpersico@erols.com> win32-ps-print.el
1019 ;; Volker Franz <volker.franz@tuebingen.mpg.de> ps-print-interface.el
1029 (require 'ps-print)
1032 (and (string< ps-print-version "6.6.4")
1033 (error "`printing' requires `ps-print' package version 6.6.4 or later"))
1037 (and ps-windows-system (getenv "OSTYPE")
1063 You can then use `write-region' to write new data into the file.
1085 (write-region "" nil file nil 'silent nil 'excl))
1089 ;; `make-temp-name' and `write-region', let's try again.
1118 (defvar zmacs-region-stays nil)
1126 (defun pr-keep-region-active ()
1127 (setq zmacs-region-stays t)))
1134 (defun pr-keep-region-active ()
1145 (and (featurep 'printing) ; update only after printing is loaded
1149 (defun pr-ps-utility-custom-set (symbol value)
1152 (and (featurep 'printing) ; update only after printing is loaded
1156 (defun pr-ps-name-custom-set (symbol value)
1159 (and (featurep 'printing) ; update only after printing is loaded
1160 (pr-menu-set-ps-title value)))
1166 (and (featurep 'printing) ; update only after printing is loaded
1174 (defgroup printing nil
1177 :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
1186 ps-windows-system)
1200 :group 'printing)
1227 (if (or pr-cygwin-system ps-windows-system)
1242 It's used to find commands used for printing package, like gv, gs, gsview.exe,
1312 :group 'printing)
1316 "*Specify a printer for printing a text file.
1327 :group 'printing)
1333 (ps-windows-system "PRN")
1361 COMMAND Name of the program for printing a text file. On MS-DOS and
1373 If COMMAND is nil, it's used the default printing program:
1460 :group 'printing)
1463 (defcustom pr-ps-name 'default
1464 "*Specify a printer for printing a PostScript file.
1466 This printer name symbol should be defined on `pr-ps-printer-alist' (see it for
1473 :set 'pr-ps-name-custom-set
1475 :group 'printing)
1478 (defcustom pr-ps-printer-alist
1480 (cond (ps-windows-system nil)
1481 (ps-lp-system "-d")
1483 (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name)))
1509 `pr-ps-name' variable setting and for menu selection.
1514 COMMAND Name of the program for printing a PostScript file. On MS-DOS
1526 If COMMAND is nil, it's used the default printing program:
1607 '(ps-landscape-mode . nil)
1608 '(ps-spool-duplex . t)
1651 (setq pr-ps-printer-alist
1727 (const :tag "Landscape" ps-landscape-mode)
1728 (const :tag "Print Header" ps-print-header)
1729 (const :tag "Print Header Frame" ps-print-header-frame)
1730 (const :tag "Line Number" ps-line-number)
1731 (const :tag "Zebra Stripes" ps-zebra-stripes)
1732 (const :tag "Duplex" ps-spool-duplex)
1733 (const :tag "Tumble" ps-spool-tumble)
1734 (const :tag "Upside-Down" ps-print-upside-down)
1738 (const :tag "Auto Region" pr-auto-region)
1748 :group 'printing)
1758 (cond (ps-windows-system "c:/temp")
1762 "*Specify a directory for temporary files during printing.
1764 See also `pr-ps-temp-file' and `pr-file-modes'."
1767 :group 'printing)
1770 (defcustom pr-ps-temp-file "prspool-"
1776 :group 'printing)
1781 ;; generated by `printing'.
1787 See also `pr-temp-dir' and `pr-ps-temp-file'."
1790 :group 'printing)
1794 (if ps-windows-system
1832 :group 'printing)
1836 (if ps-windows-system
1859 :group 'printing)
1863 (if ps-windows-system
1902 :group 'printing)
1906 (if ps-windows-system
1916 See also `pr-ps-printer-alist'."
1919 :group 'printing)
1930 See also `pr-ps-printer-alist'."
1933 :group 'printing)
1946 :group 'printing)
1953 :group 'printing)
1957 "*Non-nil means spool printing in a buffer."
1960 :group 'printing)
1967 :group 'printing)
1974 :group 'printing)
1980 If tumble is off, produces a printing suitable for binding on the left or
1982 If tumble is on, produces a printing suitable for binding at the top or
1986 :group 'printing)
1989 (defcustom pr-auto-region t
1990 "*Non-nil means region is automagically detected.
1995 `*-region*' commands, that is, `*-buffer*' commands will print only the region
1999 :group 'printing)
2003 "*Non-nil means major-mode specific printing is prefered over normal printing.
2006 and `*-region*' commands will behave like `*-mode*' commands; otherwise,
2007 `*-buffer*' commands will print the current buffer and `*-region*' commands
2008 will print the current region."
2011 :group 'printing)
2018 (ps-article-author ps-article-subject)
2025 (ps-article-author ps-article-subject)
2032 (ps-article-subject ps-article-author buffer-name)
2039 (ps-article-subject ps-article-author buffer-name)
2046 (ps-article-subject ps-article-author gnus-newsgroup-name)
2053 (ps-article-subject ps-article-author gnus-newsgroup-name)
2060 (ps-info-node ps-info-file)
2067 (ps-article-subject ps-article-author buffer-name)
2072 "*Specify an alist for a major-mode and printing functions.
2074 To customize a major mode printing, just declare the customization in
2078 printing, you'll get a nicely formatted list of article subjects shows up at
2079 the printer. With major mode printing you don't need to switch from gnus
2096 LPR-PRINT It's a symbol function for text printing. It's invoked with
2110 for a region. If FROM is nil, it's used (point-min); if TO is
2113 PS-PRINT It's a symbol function for PostScript printing. It's invoked
2114 with 3 arguments: n-up printing, file name and the list:
2127 markers, respectively, for a region. If TO is nil, it's used
2131 `ps-header-lines' value.
2135 uses `ps-left-header' value.
2139 uses `ps-right-header' value.
2162 '(ps-landscape-mode . nil)
2163 '(ps-spool-duplex . t)
2192 (const :tag "Landscape" ps-landscape-mode)
2193 (const :tag "Print Header" ps-print-header)
2194 (const :tag "Print Header Frame" ps-print-header-frame)
2195 (const :tag "Line Number" ps-line-number)
2196 (const :tag "Zebra Stripes" ps-zebra-stripes)
2197 (const :tag "Duplex" ps-spool-duplex)
2198 (const :tag "Tumble" ps-spool-tumble)
2199 (const :tag "Upside-Down" ps-print-upside-down)
2203 (const :tag "Auto Region" pr-auto-region)
2212 :group 'printing)
2215 (defcustom pr-ps-utility 'mpage
2218 This utility symbol should be defined on `pr-ps-utility-alist' (see it for
2226 `pr-ps-utility-alist'."
2228 :set 'pr-ps-utility-custom-set
2230 :group 'printing)
2233 (defcustom pr-ps-utility-alist
2258 `pr-ps-utility' variable setting and for menu selection.
2351 `pr-ps-utility-alist'.
2443 :group 'printing)
2452 :group 'printing)
2468 :group 'printing)
2484 :group 'printing)
2525 through `inherits-from:' (see `pr-ps-utility', `pr-mode-alist'
2526 and `pr-ps-printer-alist'), the variables pr-file-duplex and
2561 '(ps-landscape-mode . nil)
2562 '(ps-spool-duplex . t)
2582 (const :tag "Landscape" ps-landscape-mode)
2583 (const :tag "Print Header" ps-print-header)
2584 (const :tag "Print Header Frame" ps-print-header-frame)
2585 (const :tag "Line Number" ps-line-number)
2586 (const :tag "Zebra Stripes" ps-zebra-stripes)
2587 (const :tag "Duplex" ps-spool-duplex)
2588 (const :tag "Tumble" ps-spool-tumble)
2589 (const :tag "Upside-Down" ps-print-upside-down)
2593 (const :tag "Auto Region" pr-auto-region)
2601 :group 'printing)
2605 '(postscript text postscript-options postscript-process printing help)
2635 `printing' |[ ] Auto Region |
2652 (const printing)
2655 :group 'printing)
2662 happens when printing:
2664 Error: could not open \"c:\\temp\\prspool.ps\" for reading."
2667 :group 'printing)
2676 It's used by `pr-ps-directory-preview', `pr-ps-directory-using-ghostscript',
2677 `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory'
2681 :group 'printing)
2685 "*Specify the name of the buffer interface for printing package.
2690 :group 'printing)
2694 (list (regexp-quote pr-buffer-name) ; ignore printing interface buffer
2704 :group 'printing)
2713 :group 'printing)
2721 "Name of program for printing a text file.
2735 (defvar pr-ps-command nil
2736 "Name of program for printing a PostScript file.
2737 See `pr-ps-printer-alist'.")
2740 (defvar pr-ps-switches nil
2742 See `pr-ps-printer-alist'.")
2745 (defvar pr-ps-printer-switch nil
2747 See `pr-ps-printer-alist'.")
2750 (defvar pr-ps-printer nil
2752 See `pr-ps-printer-alist'.")
2807 (defvar zmacs-region-stays nil) ; to avoid compilation gripes
2808 (defun pr-region-active-p ()
2809 (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))
2812 (defun pr-region-active-p ()
2813 (and pr-auto-region transient-mark-mode mark-active))))
2837 ["1-up" (pr-ps-directory-preview 1 nil nil t) t]
2838 ["2-up" (pr-ps-directory-preview 2 nil nil t) t]
2839 ["4-up" (pr-ps-directory-preview 4 nil nil t) t]
2840 ["Other..." (pr-ps-directory-preview nil nil nil t)
2841 :keys "\\[pr-ps-buffer-preview]"])
2843 ["1-up" (pr-ps-buffer-preview 1 t) t]
2844 ["2-up" (pr-ps-buffer-preview 2 t) t]
2845 ["4-up" (pr-ps-buffer-preview 4 t) t]
2846 ["Other..." (pr-ps-buffer-preview nil t)
2847 :keys "\\[pr-ps-buffer-preview]"])
2848 ("Region" ,pr-:active (and (not pr-spool-p) (ps-mark-active-p))
2849 ["1-up" (pr-ps-region-preview 1 t) t]
2850 ["2-up" (pr-ps-region-preview 2 t) t]
2851 ["4-up" (pr-ps-region-preview 4 t) t]
2852 ["Other..." (pr-ps-region-preview nil t)
2853 :keys "\\[pr-ps-region-preview]"])
2855 ["1-up" (pr-ps-mode-preview 1 t) t]
2856 ["2-up" (pr-ps-mode-preview 2 t) t]
2857 ["4-up" (pr-ps-mode-preview 4 t) t]
2858 ["Other..." (pr-ps-mode-preview nil t)
2859 :keys "\\[pr-ps-mode-preview]"])
2861 ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)
2862 :keys "\\[pr-ps-file-preview]"
2866 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
2870 ["1-up..." (pr-ps-file-up-preview 1 t t) pr-ps-utility-alist]
2871 ["2-up..." (pr-ps-file-up-preview 2 t t) pr-ps-utility-alist]
2872 ["4-up..." (pr-ps-file-up-preview 4 t t) pr-ps-utility-alist]
2873 ["Other..." (pr-ps-file-up-preview nil t t)
2874 :keys "\\[pr-ps-file-up-preview]" :active pr-ps-utility-alist]
2880 :active pr-ps-utility-alist]
2885 :active pr-ps-utility-alist]
2890 :active (and pr-file-duplex pr-ps-utility-alist)])
2899 ["1-up" (pr-ps-directory-ps-print 1 nil nil t) t]
2900 ["2-up" (pr-ps-directory-ps-print 2 nil nil t) t]
2901 ["4-up" (pr-ps-directory-ps-print 4 nil nil t) t]
2902 ["Other..." (pr-ps-directory-ps-print nil nil nil t)
2903 :keys "\\[pr-ps-buffer-ps-print]"])
2905 ["1-up" (pr-ps-buffer-ps-print 1 t) t]
2906 ["2-up" (pr-ps-buffer-ps-print 2 t) t]
2907 ["4-up" (pr-ps-buffer-ps-print 4 t) t]
2908 ["Other..." (pr-ps-buffer-ps-print nil t)
2909 :keys "\\[pr-ps-buffer-ps-print]"])
2910 ("Region" ,pr-:active (ps-mark-active-p)
2911 ["1-up" (pr-ps-region-ps-print 1 t) t]
2912 ["2-up" (pr-ps-region-ps-print 2 t) t]
2913 ["4-up" (pr-ps-region-ps-print 4 t) t]
2914 ["Other..." (pr-ps-region-ps-print nil t)
2915 :keys "\\[pr-ps-region-ps-print]"])
2917 ["1-up" (pr-ps-mode-ps-print 1 t) t]
2918 ["2-up" (pr-ps-mode-ps-print 2 t) t]
2919 ["4-up" (pr-ps-mode-ps-print 4 t) t]
2920 ["Other..." (pr-ps-mode-ps-print nil t)
2921 :keys "\\[pr-ps-mode-ps-print]"])
2923 ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)
2924 :keys "\\[pr-ps-file-ps-print]"
2928 ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
2932 ["1-up..." (pr-ps-file-up-ps-print 1 t t) pr-ps-utility-alist]
2933 ["2-up..." (pr-ps-file-up-ps-print 2 t t) pr-ps-utility-alist]
2934 ["4-up..." (pr-ps-file-up-ps-print 4 t t) pr-ps-utility-alist]
2935 ["Other..." (pr-ps-file-up-ps-print nil t t)
2936 :keys "\\[pr-ps-file-up-ps-print]" :active pr-ps-utility-alist]
2942 :active pr-ps-utility-alist]
2947 :active pr-ps-utility-alist]
2952 :active (and pr-file-duplex pr-ps-utility-alist)])
2953 ["Despool..." (call-interactively 'pr-despool-ps-print)
2954 :active pr-spool-p :keys "\\[pr-despool-ps-print]"
2958 :active pr-ps-printer-alist :included (pr-visible-p 'postscript)
2965 "Replace non-printing chars with printable representations.")
2968 ["Region" pr-printify-region (ps-mark-active-p)])
2974 ["Region" pr-txt-region (ps-mark-active-p)]
2982 :style toggle :selected ps-landscape-mode
2985 :style toggle :selected ps-print-header
2988 :style toggle :selected ps-print-header-frame :active ps-print-header
2991 :style toggle :selected ps-line-number
2994 :style toggle :selected ps-zebra-stripes
2997 :style toggle :selected ps-spool-duplex
3000 :style toggle :selected ps-spool-tumble :active ps-spool-duplex
3003 :style toggle :selected ps-print-upside-down
3009 :style radio :selected (eq ps-even-or-odd-pages nil)]
3011 :style radio :selected (eq ps-even-or-odd-pages 'even-page)]
3013 :style radio :selected (eq ps-even-or-odd-pages 'odd-page)]
3015 :style radio :selected (eq ps-even-or-odd-pages 'even-sheet)]
3017 :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)])
3028 pr-:help "Toggle PostScript printing with faces")]
3035 ["Auto Region" pr-toggle-region-menu
3036 :style toggle :selected pr-auto-region
3037 :included (pr-visible-p 'printing)]
3040 :included (pr-visible-p 'printing)]
3043 :included (pr-visible-p 'printing)]
3046 ["printing" pr-customize t]
3047 ["ps-print" ps-print-customize t]
3050 ["printing" pr-show-pr-setup t]
3051 ["ps-print" pr-show-ps-setup t]
3064 "Install `printing' menu in the menubar.
3106 (dolist (item '("print-buffer" "print-region"
3107 "ps-print-buffer-faces" "ps-print-region-faces"
3108 "ps-print-buffer" "ps-print-region"))
3125 (global-set-key `[,pr-print-key] 'pr-ps-fast-fire)
3128 (global-set-key `[(meta ,pr-print-key)] 'pr-ps-mode-using-ghostscript)
3129 (global-set-key `[(shift ,pr-print-key)] 'pr-ps-mode-using-ghostscript)
3138 ;;;(global-set-key "\C-cbp" 'pr-ps-buffer-print)
3139 ;;;(global-set-key "\C-cbx" 'pr-ps-buffer-preview)
3140 ;;;(global-set-key "\C-cbb" 'pr-ps-buffer-using-ghostscript)
3141 ;;;(global-set-key "\C-crp" 'pr-ps-region-print)
3142 ;;;(global-set-key "\C-crx" 'pr-ps-region-preview)
3143 ;;;(global-set-key "\C-crr" 'pr-ps-region-using-ghostscript)
3151 (concat "printing.el version " pr-version
3152 " ps-print.el version " ps-print-version
3157 The `printing' menu (Tools/Printing or File/Print) has the following layout:
3189 23 | Show Settings >|-------|printing| |( )Odd Pages |
3190 24 | Help | |ps-print| |( )Even Sheets|
3204 I. PostScript printing:
3207 menu) or PostScript temporary file for a directory, a buffer, a region
3208 or a major mode, choosing 1-up, 2-up, 4-up or any other n-up printing;
3212 Instead of previewing each buffer, region or major mode at once, you
3221 NOTE 1: It's possible to customize a major mode printing, just declare
3226 forget to switch to the *Article* buffer before printing,
3228 up at the printer. With major mode printing you don't need to
3235 See `pr-ps-utility-alist' and `pr-setting-database' for
3237 Ic. Do n-up processing before printing.
3243 `pr-ps-utility-alist'.
3250 temporarily in a buffer instead of printing it or saving it in a file.
3252 Instead of printing each buffer, region or major mode at once, you can
3263 in `pr-ps-printer-alist' variable (see it for documentation).
3266 II. Text printing:
3270 option. All control characters in your buffer or region will be
3277 5. If you want to print a directory, buffer, region or major mode in a
3287 7. If you want a PostScript landscape printing, turn on this option.
3301 12. If you want a duplex printing and your PostScript printer has this
3304 13. If you turned on duplex printing, you can choose if you want to have a
3305 printing suitable for binding on the left or right (tumble off), or to
3306 have a printing suitable for binding at top or bottom (tumble on).
3309 14. If you want a PostScript upside-down printing, turn on this option.
3313 See also `ps-even-or-odd-pages'.
3333 19. If you want that region is automagically detected, turn on this
3336 like `*-region*' commands, that is, `*-buffer*' commands will print
3337 only the region marked instead of all buffer.
3340 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
3352 more PostScript options in `ps-print' option. Or you can customize
3353 some `lpr' options for text printing. Or customize `printing'
3356 23. Show current settings for `printing', `ps-print' or `lpr'.
3358 24. Quick help for printing menu layout.
3364 (concat "printing.el version " pr-version
3365 " ps-print.el version " ps-print-version
3367 The printing interface buffer has the same functionality as the printing menu.
3369 file, n-up printing, etc.) are set and saved between priting buffer
3371 PostScript file and directory/buffer/region/mode processing; using menu, there
3372 are different value sets for PostScript file and directory/buffer/region/mode
3375 The printing interface buffer has the following sections:
3388 If it's on, this means that the selected buffer has an active region,
3391 buffer has no active region, so it'll not be possible to turn it on.
3392 If you want to process the region, let this option on.
3404 NOTE 1: It's possible to customize a major mode printing, just declare
3409 forget to switch to the *Article* buffer before printing,
3411 up at the printer. With major mode printing you don't need to
3434 See `pr-ps-utility-alist' and `pr-setting-database' for documentation.
3437 `pr-ps-utility-alist'.
3441 PostScript file before printing/previewing.
3448 in `pr-ps-printer-alist' variable (see it for documentation).
3456 printing/previewing.
3465 Quit from printing interface buffer.
3475 Specify n-up printing.
3487 option. All control characters in your buffer or region will be
3495 To print a directory, buffer, region or major mode in a
3499 Quit from printing interface buffer.
3508 PostScript landscape printing.
3523 Duplex printing (if your PostScript printer has this feature).
3526 If duplex printing is on, you can choose if you want to have a
3527 printing suitable for binding on the left or right (tumble off), or to
3528 have a printing suitable for binding at top or bottom (tumble on).
3531 PostScript upside-down printing.
3536 If you want that region is automagically detected, turn on this
3539 like `*-region*' commands, that is, `*-buffer*' commands will print
3540 only the region marked instead of all buffer.
3544 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
3572 See also `ps-even-or-odd-pages'.
3582 options in `ps-print' option. Or you can customize some `lpr' options for
3583 text printing. Or customize `printing' options.
3587 Show current settings for `printing', `ps-print' or `lpr'.
3591 Quick help for printing interface buffer and printing menu layout. You can
3592 also quit the printing interface buffer or kill all printing help buffer.
3603 "Activate the printing interface buffer.
3605 If BUFFER is nil, the current buffer is used for printing.
3615 (defun pr-ps-directory-preview (n-up dir file-regexp &optional filename)
3618 Interactively, the command prompts for N-UP printing number, a directory, a
3623 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is
3631 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS preview dir")))
3632 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3634 (setq filename (pr-ps-file filename))
3635 (pr-ps-file-list n-up dir file-regexp filename)
3637 (pr-ps-file-preview filename)))
3641 (defun pr-ps-directory-using-ghostscript (n-up dir file-regexp &optional filename)
3644 Interactively, the command prompts for N-UP printing number, a directory, a
3649 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is
3657 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir GS")))
3658 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3660 (let ((file (pr-ps-file filename)))
3661 (pr-ps-file-list n-up dir file-regexp file)
3662 (pr-ps-file-using-ghostscript file)
3667 (defun pr-ps-directory-print (n-up dir file-regexp &optional filename)
3670 Interactively, the command prompts for N-UP printing number, a directory, a
3675 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is
3683 (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir")))
3684 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3686 (let ((file (pr-ps-file filename)))
3687 (pr-ps-file-list n-up dir file-regexp file)
3688 (pr-ps-file-print file)
3693 (defun pr-ps-directory-ps-print (n-up dir file-regexp &optional filename)
3698 Interactively, the command prompts for N-UP printing number, a directory, a
3703 Noninteractively, if N-UP is nil, prompts for N-UP printing number. If DIR is
3711 (interactive (pr-interactive-ps-dir-args
3713 (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
3716 (pr-ps-directory-using-ghostscript n-up dir file-regexp filename)
3717 (pr-ps-directory-print n-up dir file-regexp filename)))
3721 (defun pr-ps-buffer-preview (n-up &optional filename)
3724 Interactively, the command prompts for N-UP printing number and, when you use a
3728 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The
3734 (pr-ps-mode-preview n-up filename)
3735 (pr-ps-preview (pr-region-active-symbol) n-up filename
3736 (pr-region-active-string "PS preview"))))
3740 (defun pr-ps-buffer-using-ghostscript (n-up &optional filename)
3743 Interactively, the command prompts for N-UP printing number and, when you use a
3747 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The
3753 (pr-ps-mode-using-ghostscript n-up filename)
3754 (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
3755 (pr-region-active-string "PS print GS"))))
3759 (defun pr-ps-buffer-print (n-up &optional filename)
3762 Interactively, the command prompts for N-UP printing number and, when you use a
3766 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The
3772 (pr-ps-mode-print n-up filename)
3773 (pr-ps-print (pr-region-active-symbol) n-up filename
3774 (pr-region-active-string "PS print"))))
3778 (defun pr-ps-buffer-ps-print (n-up &optional filename)
3783 Interactively, the command prompts for N-UP printing number and, when you use a
3787 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The
3794 (pr-ps-mode-ps-print n-up filename))
3796 (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
3797 (pr-region-active-string "PS print GS")))
3799 (pr-ps-print (pr-region-active-symbol) n-up filename
3800 (pr-region-active-string "PS print")))))
3804 (defun pr-ps-region-preview (n-up &optional filename)
3805 "Preview region using ghostview.
3807 See also `pr-ps-buffer-preview'."
3808 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS preview")))
3810 (let ((pr-auto-region t))
3811 (pr-ps-mode-preview n-up filename))
3812 (pr-ps-preview 'region n-up filename "PS preview region")))
3816 (defun pr-ps-region-using-ghostscript (n-up &optional filename)
3817 "Print region using PostScript through ghostscript.
3819 See also `pr-ps-buffer-using-ghostscript'."
3820 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print GS")))
3822 (let ((pr-auto-region t))
3823 (pr-ps-mode-using-ghostscript n-up filename))
3824 (pr-ps-using-ghostscript 'region n-up filename "PS print GS region")))
3828 (defun pr-ps-region-print (n-up &optional filename)
3829 "Print region using PostScript printer.
3831 See also `pr-ps-buffer-print'."
3832 (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print")))
3834 (let ((pr-auto-region t))
3835 (pr-ps-mode-print n-up filename))
3836 (pr-ps-print 'region n-up filename "PS print region")))
3840 (defun pr-ps-region-ps-print (n-up &optional filename)
3841 "Print region using PostScript printer or through ghostscript.
3843 See also `pr-ps-buffer-ps-print'."
3845 (pr-prompt-region (pr-prompt-gs "PS print"))))
3847 (let ((pr-auto-region t))
3848 (pr-ps-mode-ps-print n-up filename)))
3850 (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))
3852 (pr-ps-print 'region n-up filename "PS print region"))))
3856 (defun pr-ps-mode-preview (n-up &optional filename)
3859 See also `pr-ps-buffer-preview'."
3862 (let ((file (pr-ps-file filename)))
3863 (and (pr-ps-mode n-up file)
3865 (pr-ps-file-preview file))))
3869 (defun pr-ps-mode-using-ghostscript (n-up &optional filename)
3872 See also `pr-ps-buffer-using-ghostscript'."
3875 (let ((file (pr-ps-file filename)))
3876 (when (and (pr-ps-mode n-up file)
3878 (pr-ps-file-using-ghostscript file)
3883 (defun pr-ps-mode-print (n-up &optional filename)
3886 See also `pr-ps-buffer-print'."
3889 (pr-ps-mode n-up filename))
3893 (defun pr-ps-mode-ps-print (n-up &optional filename)
3896 See also `pr-ps-buffer-ps-print'."
3899 (pr-ps-mode-using-ghostscript n-up filename)
3900 (pr-ps-mode-print n-up filename)))
3927 (if (pr-region-active-p)
3928 (pr-printify-region)
3929 (printify-region (point-min) (point-max))))
3933 (defun pr-printify-region ()
3934 "Replace nonprinting characters in region with printable representations.
3938 (printify-region (point) (mark)))
3963 ((pr-region-active-p)
3964 (pr-txt-region))
3970 (defun pr-txt-region ()
3971 "Print region using text printer."
3974 (let ((pr-auto-region t))
4001 (interactive (list (ps-print-preprint current-prefix-arg)))
4002 (let ((file (pr-ps-file filename)))
4005 (pr-ps-file-preview file))))
4019 (interactive (list (ps-print-preprint current-prefix-arg)))
4020 (let ((file (pr-ps-file filename)))
4023 (pr-ps-file-using-ghostscript file)
4038 (interactive (list (ps-print-preprint current-prefix-arg)))
4040 (let ((ps-lpr-command (pr-command pr-ps-command))
4041 (ps-lpr-switches pr-ps-switches)
4042 (ps-printer-name-option pr-ps-printer-switch)
4043 (ps-printer-name pr-ps-printer))
4044 (ps-despool filename))))
4048 (defun pr-despool-ps-print (&optional filename)
4058 (interactive (list (ps-print-preprint current-prefix-arg)))
4065 (defun pr-ps-file-preview (filename)
4067 (interactive (list (pr-ps-infile-preprint "Preview ")))
4073 (defun pr-ps-file-up-preview (n-up ifilename &optional ofilename)
4076 (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
4078 (pr-ps-utility-process n-up ifilename outfile)
4079 (pr-ps-file-preview outfile)))
4083 (defun pr-ps-file-using-ghostscript (filename)
4085 (interactive (list (pr-ps-infile-preprint "Print preview ")))
4097 ;; printing
4098 (pr-ps-file-print tempfile)
4104 (defun pr-ps-file-print (filename)
4106 (interactive (list (pr-ps-infile-preprint "Print ")))
4108 ;; printing
4110 (if (string= pr-ps-command "")
4112 (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
4114 (set-buffer ps-spool-buffer)
4118 ;; use `pr-ps-command' to print
4120 pr-ps-command
4121 (pr-switches-string pr-ps-switches "pr-ps-switches")
4122 (if (string-match "cp" pr-ps-command)
4125 (concat pr-ps-printer-switch pr-ps-printer))
4127 (list (concat pr-ps-printer-switch pr-ps-printer)
4132 (defun pr-ps-file-ps-print (filename)
4134 (interactive (list (pr-ps-infile-preprint
4139 (pr-ps-file-using-ghostscript filename)
4140 (pr-ps-file-print filename)))
4144 (defun pr-ps-file-up-ps-print (n-up ifilename &optional ofilename)
4147 Interactively, the command prompts for N-UP printing number, for an input
4152 Noninteractively, if N-UP is nil, prompts for N-UP printing number. The
4163 (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
4167 (pr-ps-utility-process n-up ifilename outfile)
4169 (pr-ps-file-ps-print outfile)
4184 If tumble is off, produces a printing suitable for binding on the left or
4186 If tumble is on, produces a printing suitable for binding at the top or
4201 "Toggle printing using ghostscript."
4208 "Toggle printing with faces."
4231 If tumble is off, produces a printing suitable for binding on the left or
4233 If tumble is on, produces a printing suitable for binding at the top or
4269 "Toggle printing header."
4276 "Toggle printing header frame."
4289 (defun pr-toggle-region ()
4290 "Toggle auto region."
4292 (pr-toggle-region-menu t))
4304 "Customization of the `printing' group."
4306 (customize-group 'printing))
4318 "Help for the printing package."
4324 (defun pr-ps-name ()
4327 (pr-menu-set-ps-title
4329 pr-ps-printer-alist pr-ps-name)))
4342 (defun pr-ps-utility ()
4347 pr-ps-utility-alist pr-ps-utility)))
4351 (defun pr-show-ps-setup (&rest ignore)
4352 "Show current ps-print settings."
4354 (pr-show-setup (ps-setup) "*PS Setup*"))
4359 "Show current printing settings."
4376 (defun pr-ps-fast-fire (n-up &optional select)
4377 "Fast fire function for PostScript printing.
4379 If a region is active, the region will be printed instead of the whole buffer.
4381 `pr-mode-alist' will be used, that is, the current buffer or region will be
4382 printed using `pr-ps-mode-ps-print'.
4387 M-x pr-ps-fast-fire RET
4388 The command prompts the user for a N-UP value and printing will
4391 C-u M-x pr-ps-fast-fire RET
4392 C-u 0 M-x pr-ps-fast-fire RET
4394 PostScript printer, then printing will immediatelly be done using the new
4397 C-u 1 M-x pr-ps-fast-fire RET
4402 C-u 2 M-x pr-ps-fast-fire RET
4415 the user for a current PostScript printer, then printing will immediatelly
4427 If it's a symbol which it's defined in `pr-ps-printer-alist', it's the new
4428 active printer and printing will immediatelly be done using the new active
4434 Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode'
4438 (let ((pr-auto-region t)
4443 (pr-ps-name))
4445 (assq select pr-ps-printer-alist))
4446 (pr-menu-set-ps-title select))
4449 (pr-ps-name))
4451 (setq filename (pr-ps-outfile-preprint
4455 (pr-ps-buffer-ps-print
4464 "Fast fire function for text printing.
4466 If a region is active, the region will be printed instead of the whole buffer.
4468 `pr-mode-alist' will be used, that is, the current buffer or region will be
4476 If it's nil, the printing is sent to the current active text printer.
4479 active printer and printing will immediatelly be done using the new active
4484 Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode'
4493 (let ((pr-auto-region t)
4503 "Return the current `printing' setup.
4506 One way to see `printing' setup is to switch to a *Scratch* buffer and type:
4510 Or choose the menu option Printing/Show Settings/printing."
4511 (let (ps-prefix-quote)
4513 #'ps-print-quote
4515 (concat "\n;;; printing.el version " pr-version "\n")
4517 (ps-comment-string "emacs-version " emacs-version)
4518 (ps-comment-string "pr-txt-command " pr-txt-command)
4519 (ps-comment-string "pr-txt-switches "
4521 (ps-comment-string "pr-txt-printer " pr-txt-printer)
4522 (ps-comment-string "pr-ps-command " pr-ps-command)
4523 (ps-comment-string "pr-ps-switches "
4524 (pr-switches-string pr-ps-switches "pr-ps-switches"))
4525 (ps-comment-string "pr-ps-printer-switch" pr-ps-printer-switch)
4526 (ps-comment-string "pr-ps-printer " pr-ps-printer)
4527 (ps-comment-string "pr-cygwin-system " pr-cygwin-system)
4528 (ps-comment-string "ps-windows-system " ps-windows-system)
4529 (ps-comment-string "ps-lp-system " ps-lp-system)
4537 '(20 . pr-ps-name)
4538 '(20 . pr-ps-printer-alist)
4541 '(20 . pr-ps-temp-file)
4558 '(27 . pr-auto-region)
4561 '(20 . pr-ps-utility)
4562 '(20 . pr-ps-utility-alist)
4577 ")\n\n;;; printing.el - end of settings\n")
4590 (let (ps-prefix-quote)
4592 #'ps-print-quote
4595 (ps-comment-string "emacs-version" emacs-version)
4602 '(25 . print-region-function)
4663 ;; rmail (hacked from ps-print.el)
4674 (pr-ps-message-from-summary n-up filename header-list
4678 (defun pr-ps-message-from-summary (n-up filename header-list
4702 ;; gnus (hacked from ps-print.el)
4710 (pr-ps-message-from-summary n-up filename header-list
4721 ;; vm (hacked from ps-print.el)
4729 (pr-ps-message-from-summary n-up filename header-list
4743 (defun pr-ps-mode (n-up filename)
4757 (let ((ps-header-lines (or (nth 0 ,header-list) ps-header-lines))
4758 (ps-left-header (or (nth 1 ,header-list) ps-left-header))
4759 (ps-right-header (or (nth 2 ,header-list) ps-right-header))
4760 ps-razzle-dazzle)
4771 (let ((file (pr-ps-file filename))
4773 ((pr-region-active-p) (region-beginning))
4776 (pr-text2ps (pr-region-active-symbol start) n-up file start
4778 ((pr-region-active-p) (region-end))
4782 (pr-ps-file-print file)
4791 ((pr-region-active-p) (region-beginning))
4794 ((pr-region-active-p) (region-end))
4807 (printing . 3)
4829 ((eq entry 'printing)
4861 (ps-windows-system
4944 If FORCE is non-nil, update menus doesn't matter if `pr-ps-printer-alist',
4945 `pr-txt-printer-alist' or `pr-ps-utility-alist' were modified or not;
4946 otherwise, update PostScript printer menu iff `pr-ps-printer-menu-modified' is
4948 non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
4955 ;; This is a hack to be compatible with old versions of printing.
4956 ;; So, user does not need to change printing calling in init files.
4959 (pr-update-var 'pr-ps-name pr-ps-printer-alist)
4961 (pr-update-var 'pr-ps-utility pr-ps-utility-alist)
4965 (defvar pr-ps-printer-menu-modified t
4966 "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.")
4969 (defvar pr-ps-utility-menu-modified t
4970 "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.")
5000 (defvar pr-ps-name-old "PostScript Printers")
5002 (defvar pr-ps-utility-old "PostScript Utility")
5007 (pr-menu-alist pr-ps-printer-alist
5008 'pr-ps-name
5009 'pr-menu-set-ps-title
5011 'pr-ps-printer-menu-modified
5013 pr-ps-name-old
5023 (let ((save-var pr-ps-utility-menu-modified))
5024 (pr-menu-alist pr-ps-utility-alist
5025 'pr-ps-utility
5030 pr-ps-utility-old
5032 (pr-menu-alist pr-ps-utility-alist
5033 'pr-ps-utility
5036 'pr-ps-utility-menu-modified
5038 pr-ps-utility-old
5040 (pr-even-or-odd-pages ps-even-or-odd-pages force))
5062 (defun pr-menu-set-ps-title (value &optional item entry index)
5064 'pr-ps-name-old)
5065 (pr-ps-set-printer value)
5082 (list "Printing" "PostScript Print" "File" pr-ps-utility-old)
5085 (list "Printing" "PostScript Preview" "File" pr-ps-utility-old)
5087 (setq pr-ps-utility-old newname)))
5088 (pr-ps-set-utility value)
5096 (setq ps-even-or-odd-pages value)
5107 (pr-menu-alist pr-ps-printer-alist
5108 'pr-ps-name
5109 'pr-menu-set-ps-title
5111 'pr-ps-printer-menu-modified
5123 (let ((save-var pr-ps-utility-menu-modified))
5124 (pr-menu-alist pr-ps-utility-alist
5125 'pr-ps-utility
5132 (pr-menu-alist pr-ps-utility-alist
5133 'pr-ps-utility
5136 'pr-ps-utility-menu-modified
5140 (pr-even-or-odd-pages ps-even-or-odd-pages force))
5182 (defun pr-menu-set-ps-title (value &optional item entry index)
5186 (pr-ps-set-printer value)
5212 (pr-ps-set-utility value)
5220 (setq ps-even-or-odd-pages value)
5225 (defun pr-ps-set-utility (value)
5226 (let ((item (cdr (assq value pr-ps-utility-alist))))
5229 "Invalid PostScript utility name `%s' for variable `pr-ps-utility'"
5231 (setq pr-ps-utility value)
5236 (defun pr-ps-set-printer (value)
5237 (let ((ps (cdr (assq value pr-ps-printer-alist))))
5238 (or ps
5240 "Invalid PostScript printer name `%s' for variable `pr-ps-name'"
5242 (setq pr-ps-name value
5243 pr-ps-command (pr-dosify-file-name (nth 0 ps))
5244 pr-ps-switches (nth 1 ps)
5245 pr-ps-printer-switch (nth 2 ps)
5246 pr-ps-printer (nth 3 ps))
5247 (or (stringp pr-ps-command)
5248 (setq pr-ps-command
5249 (cond (ps-windows-system "print")
5250 (ps-lp-system "lp")
5253 (or (stringp pr-ps-printer-switch)
5254 (setq pr-ps-printer-switch
5255 (cond (ps-windows-system "/D:")
5256 (ps-lp-system "-d")
5259 (pr-eval-alist (nthcdr 4 ps)))
5274 (cond (ps-windows-system "print")
5275 (ps-lp-system "lp")
5394 (pr-toggle 'pr-spool-p "Spooling printing"
5400 (pr-toggle 'ps-spool-duplex "Printing duplex"
5406 (pr-toggle 'ps-spool-tumble "Tumble"
5412 (pr-toggle 'ps-landscape-mode "Landscape"
5418 (pr-toggle 'ps-print-upside-down "Upside-Down"
5424 (pr-toggle 'ps-line-number "Line number"
5430 (pr-toggle 'ps-zebra-stripes "Zebra stripe"
5436 (pr-toggle 'ps-print-header "Print header"
5442 (pr-toggle 'ps-print-header-frame "Print header frame"
5449 'printing 2 12 'toggle nil no-menu))
5452 (defun pr-toggle-region-menu (&optional no-menu)
5454 (pr-toggle 'pr-auto-region "Auto region"
5455 'printing 0 12 'toggle nil no-menu))
5461 'printing 1 12 'toggle nil no-menu))
5467 (pr-region-active-string str)))
5470 (defun pr-prompt-region (str)
5473 " region")))
5482 (defun pr-region-active-symbol (&optional region-p)
5483 (if (or region-p (pr-region-active-p))
5484 'region
5488 (defun pr-region-active-string (prefix)
5490 (if (pr-region-active-p)
5491 " region"
5522 (defun pr-ps-outfile-preprint (&optional mess)
5544 (defun pr-ps-infile-preprint (&optional mess)
5564 (defun pr-ps-utility-args (n-up-sym infile-sym outfile-sym prompt)
5571 (set infile-sym (pr-ps-infile-preprint prompt)))
5578 (pr-ps-outfile-preprint prompt))))
5581 (pr-ps-file (symbol-value outfile-sym)))
5584 (defun pr-ps-utility-process (n-up infile outfile)
5588 (setq item (cdr (assq pr-ps-utility pr-ps-utility-alist)))
5591 "pr-ps-utility-alist entry")
5593 "pr-ps-utility-alist entry")
5595 (format (nth 2 item) ps-paper-type))
5653 (lpr-region from to)))
5666 (ps-flatten-list ; dynamic evaluation
5667 (mapcar 'ps-eval-switch switches)))
5670 (defun pr-ps-preview (kind n-up filename mess)
5672 (let ((file (pr-ps-file filename)))
5674 (or pr-spool-p (pr-ps-file-preview file))))
5677 (defun pr-ps-using-ghostscript (kind n-up filename mess)
5679 (let ((file (pr-ps-file filename)))
5682 (pr-ps-file-using-ghostscript file)
5686 (defun pr-ps-print (kind n-up filename mess)
5688 (let ((file (pr-ps-file filename)))
5691 (pr-ps-file-print file)
5695 (defun pr-ps-file (&optional filename)
5699 (expand-file-name pr-ps-temp-file pr-temp-dir))
5700 nil ".ps"))))
5706 (let* ((fmt-prompt "%s[%s] N-up printing (default 1): ")
5754 (defun pr-interactive-ps-dir-args (mess)
5764 (ps-print-preprint current-prefix-arg))))
5773 (ps-print-preprint current-prefix-arg))))
5781 (pr-ps-infile-preprint (concat mess " "))
5783 (ps-print-preprint current-prefix-arg)))
5790 (ps-print-preprint current-prefix-arg))))
5812 (defun pr-set-ps-dir-args (n-up-sym dir-sym regexp-sym filename-sym mess)
5824 (find-buffer-visiting (if ps-windows-system
5870 (defun pr-ps-file-list (n-up dir file-regexp filename)
5876 (pr-ps-mode n-up filename)
5884 (let ((ps-n-up-printing n-up)
5885 (ps-spool-config (and (eq ps-spool-config 'setpagedevice)
5893 (ps-spool-buffer-with-faces))
5894 ((eq kind 'region)
5895 (ps-spool-region-with-faces (or from (point))
5900 (ps-print-buffer-with-faces filename))
5901 ((eq kind 'region)
5902 (ps-print-region-with-faces (or from (point))
5909 (ps-spool-buffer))
5910 ((eq kind 'region)
5911 (ps-spool-region (or from (point)) (or to (mark))))
5915 (ps-print-buffer filename))
5916 ((eq kind 'region)
5917 (ps-print-region (or from (point)) (or to (mark)) filename))
5940 (ps-windows-system 'windows)
5977 (if ps-windows-system
5997 ;; Printing Interface (inspired on ps-print-interface.el)
6008 (defvar pr-i-region nil)
6011 (defvar pr-i-ps-as-is t)
6015 (defvar pr-i-ps-file "")
6019 (defvar pr-i-ps-send 'printer)
6043 "Create the front end for printing package."
6045 pr-i-region (ps-mark-active-p)
6050 (put 'pr-i-ps-send 'pr-widget-list nil)
6057 (let ((versions (concat "printing v" pr-version
6058 " ps-print v" ps-print-version)))
6081 (and pr-i-region ; let region activated
6082 (pr-keep-region-active)))
6114 (setq pr-i-region (ps-mark-active-p)
6116 (pr-update-checkbox 'pr-i-region)
6119 (put 'pr-i-region 'pr-widget
6122 'pr-i-region
6124 (let ((region-p (pr-interface-save
6125 (ps-mark-active-p))))
6127 (setq pr-i-region nil))
6128 (region-p ; widget is true and there is a region
6129 (setq pr-i-region t)
6132 (t ; widget is true and there is no region
6134 (message "There is no region active")
6135 (setq pr-i-region nil)
6157 "This buffer isn't in a mode that printing treats specially.")
6199 pr-i-ps-file)
6201 (pr-insert-menu "PostScript Utility" 'pr-ps-utility
6202 (pr-choice-alist pr-ps-utility-alist)
6206 (pr-insert-toggle 'pr-i-ps-as-is " No Preprocessing"))
6213 (pr-insert-menu "PostScript Printer" 'pr-ps-name
6214 (pr-choice-alist pr-ps-printer-alist))
6231 (pr-insert-button 'pr-interface-ps-print "Print" " ")
6234 (pr-insert-radio-button 'pr-i-ps-send 'printer)
6237 (pr-insert-radio-button 'pr-i-ps-send 'file)
6285 (pr-insert-checkbox "\n\n " 'ps-landscape-mode
6287 (setq ps-landscape-mode (not ps-landscape-mode)
6288 pr-file-landscape ps-landscape-mode))
6290 (pr-insert-toggle 'pr-auto-region " Auto Region ")
6294 (pr-insert-toggle 'ps-print-header " Print Header ")
6298 (pr-insert-toggle 'ps-print-header-frame " Print Header Frame ")
6302 (pr-insert-toggle 'ps-line-number " Line Number\n ")
6305 (pr-insert-toggle 'ps-zebra-stripes " Zebra Stripes")
6317 'ps-spool-duplex
6319 (setq ps-spool-duplex (not ps-spool-duplex)
6320 pr-file-duplex ps-spool-duplex))
6326 'ps-spool-tumble
6328 (setq ps-spool-tumble (not ps-spool-tumble)
6329 pr-file-tumble ps-spool-tumble))
6334 (pr-insert-toggle 'ps-print-upside-down " Upside-Down")
6336 (pr-insert-menu "Page Parity" 'ps-even-or-odd-pages
6349 (pr-insert-button 'pr-customize "printing" " ")
6350 (pr-insert-button #'(lambda (&rest ignore) (ps-print-customize))
6351 "ps-print" " ")
6358 (pr-insert-button 'pr-show-pr-setup "printing" " ")
6359 (pr-insert-button 'pr-show-ps-setup "ps-print" " ")
6373 "Kill all printing help buffer."
6387 "Kill the printing buffer interface and quit."
6394 "printing buffer interface help."
6410 (cond (pr-i-region
6412 (pr-txt-region)))
6414 (let (pr-auto-region)
6417 (let (pr-auto-mode pr-auto-region)
6442 (if pr-i-region
6443 (pr-printify-region)
6456 (defun pr-interface-ps-print (&rest ignore)
6457 "Print using ps-print package."
6459 (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print
6460 'pr-ps-file-ps-print 'pr-ps-file-up-ps-print
6461 'pr-ps-region-ps-print 'pr-ps-mode-ps-print
6462 'pr-ps-buffer-ps-print))
6468 (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview
6469 'pr-ps-file-preview 'pr-ps-file-up-preview
6470 'pr-ps-region-preview 'pr-ps-mode-preview
6471 'pr-ps-buffer-preview))
6474 (defun pr-interface-ps (ps-despool ps-directory ps-file ps-file-up ps-region
6475 ps-mode ps-buffer)
6477 (let ((outfile (or (and (eq pr-i-process 'file) pr-i-ps-as-is)
6478 (pr-i-ps-send))))
6482 (funcall ps-despool outfile))
6488 (funcall ps-directory
6491 (cond ((or (file-directory-p pr-i-ps-file)
6492 (not (file-readable-p pr-i-ps-file)))
6494 (pr-i-ps-as-is
6496 (funcall ps-file pr-i-ps-file)))
6499 (funcall ps-file-up pr-i-n-up pr-i-ps-file outfile)))
6503 (cond (pr-i-region
6505 (funcall ps-region pr-i-n-up outfile)))
6507 (let (pr-auto-region)
6508 (funcall ps-mode pr-i-n-up outfile)))
6510 (let (pr-auto-mode pr-auto-region)
6511 (funcall ps-buffer pr-i-n-up outfile)))
6522 (defun pr-i-ps-send ()
6523 (cond ((eq pr-i-ps-send 'printer)
6525 ((not (eq pr-i-ps-send 'file))
6526 (error "Internal error: `pr-i-ps-send' = %S" pr-i-ps-send))
6561 (setq pr-i-ps-file file))))
6681 (provide 'printing)
6685 ;;; printing.el ends here