comparison lisp/printing.el @ 54146:2a5eca2838d1

A lot of doc fix.
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Thu, 26 Feb 2004 04:03:40 +0000
parents 695cf19ef79e
children c312c950b64d
comparison
equal deleted inserted replaced
54145:e3765a3df826 54146:2a5eca2838d1
1 ;;; printing.el --- printing utilities 1 ;;; printing.el --- printing utilities
2 2
3 ;; Copyright (C) 2000, 2001, 2002, 2003 3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> 6 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 7 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
8 ;; Time-stamp: <2004/02/26 00:43:07 vinicius>
8 ;; Keywords: wp, print, PostScript 9 ;; Keywords: wp, print, PostScript
9 ;; Time-stamp: <2002/09/11 16:59:00 vinicius> 10 ;; Version: 6.7.2
10 ;; Version: 6.7.1
11 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 11 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
12 12
13 (defconst pr-version "6.7.1" 13 (defconst pr-version "6.7.2"
14 "printing.el, v 6.7.1 <2002/09/11 vinicius> 14 "printing.el, v 6.7.2 <2004/02/26 vinicius>
15 15
16 Please send all bug fixes and enhancements to 16 Please send all bug fixes and enhancements to
17 Vinicius Jose Latorre <vinicius@cpqd.com.br> 17 Vinicius Jose Latorre <vinicius@cpqd.com.br>
18 ") 18 ")
19 19
253 ;; The general meanings of above commands are: 253 ;; The general meanings of above commands are:
254 ;; 254 ;;
255 ;; PREFIX: 255 ;; PREFIX:
256 ;; `pr-interface' buffer interface for printing package. 256 ;; `pr-interface' buffer interface for printing package.
257 ;; `pr-help' help for printing package. 257 ;; `pr-help' help for printing package.
258 ;; `pr-ps-name' select interactively a PostScript printer. 258 ;; `pr-ps-name' interactively select a PostScript printer.
259 ;; `pr-txt-name' select interactively a text printer. 259 ;; `pr-txt-name' interactively select a text printer.
260 ;; `pr-ps-utility' select interactively a PostScript utility. 260 ;; `pr-ps-utility' interactively select a PostScript utility.
261 ;; `pr-show-*-setup' show current settings. 261 ;; `pr-show-*-setup' show current settings.
262 ;; `pr-ps-*' deal with PostScript code generation. 262 ;; `pr-ps-*' deal with PostScript code generation.
263 ;; `pr-txt-*' deal with text generation. 263 ;; `pr-txt-*' deal with text generation.
264 ;; `pr-toggle-*' toggle on/off some boolean variable. 264 ;; `pr-toggle-*' toggle on/off some boolean variable.
265 ;; `pr-despool-*' despool the PostScript spooling buffer. 265 ;; `pr-despool-*' despool the PostScript spooling buffer.
379 ;; `pr-temp-dir' Specify a directory for temporary files during 379 ;; `pr-temp-dir' Specify a directory for temporary files during
380 ;; printing. 380 ;; printing.
381 ;; 381 ;;
382 ;; `pr-ps-temp-file' Specify PostScript temporary file name. 382 ;; `pr-ps-temp-file' Specify PostScript temporary file name.
383 ;; 383 ;;
384 ;; `pr-gv-command' Specify path and name of gsview program. 384 ;; `pr-gv-command' Specify path and name of the gsview/gv
385 ;; 385 ;; utility.
386 ;; `pr-gs-command' Specify path and name of ghostscript program. 386 ;;
387 ;; `pr-gs-command' Specify path and name of the ghostscript
388 ;; utility.
387 ;; 389 ;;
388 ;; `pr-gs-switches' Specify ghostscript switches. 390 ;; `pr-gs-switches' Specify ghostscript switches.
389 ;; 391 ;;
390 ;; `pr-gs-device' Specify ghostscript device switch value. 392 ;; `pr-gs-device' Specify ghostscript device switch value.
391 ;; 393 ;;
406 ;; `pr-file-tumble' Non-nil means print PostScript file in tumble 408 ;; `pr-file-tumble' Non-nil means print PostScript file in tumble
407 ;; mode. 409 ;; mode.
408 ;; 410 ;;
409 ;; `pr-auto-region' Non-nil means region is automagically detected. 411 ;; `pr-auto-region' Non-nil means region is automagically detected.
410 ;; 412 ;;
411 ;; `pr-auto-mode' Non-nil means major-mode printing is prefered 413 ;; `pr-auto-mode' Non-nil means major-mode specific printing is
412 ;; over normal printing. 414 ;; prefered over normal printing.
413 ;; 415 ;;
414 ;; `pr-mode-alist' Specify an alist for a major-mode and printing 416 ;; `pr-mode-alist' Specify an alist for a major-mode and printing
415 ;; function. 417 ;; function.
416 ;; 418 ;;
417 ;; `pr-ps-utility' Specify PostScript utility processing. 419 ;; `pr-ps-utility' Specify PostScript utility processing.
524 ;; 13 |[ ]Tumble | \--\ |Buffer | | 4-up... | 526 ;; 13 |[ ]Tumble | \--\ |Buffer | | 4-up... |
525 ;; 14 |[ ]Upside-Down | | |Region | | Other... | 527 ;; 14 |[ ]Upside-Down | | |Region | | Other... |
526 ;; 15 | Print All Pages >|--\ | |Mode | +------------+ 528 ;; 15 | Print All Pages >|--\ | |Mode | +------------+
527 ;; +-----------------------------+ | | +---------+ |[ ]Landscape| Id 529 ;; +-----------------------------+ | | +---------+ |[ ]Landscape| Id
528 ;; IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie 530 ;; IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie
529 ;; 17 |[ ]Print with-faces | | \--|( )name A| |[ ]Tumble | If 531 ;; 17 |[ ]Print with faces | | \--|( )name A| |[ ]Tumble | If
530 ;; 18 |[ ]Print Using Ghostscript | | |( )name B| +------------+ 532 ;; 18 |[ ]Print via Ghostscript | | |( )name B| +------------+
531 ;; +-----------------------------+ | |... | 533 ;; +-----------------------------+ | |... |
532 ;; V 19 |[ ]Auto Region | | |(*)name | 534 ;; V 19 |[ ]Auto Region | | |(*)name |
533 ;; 20 |[ ]Auto Mode | | |... | 535 ;; 20 |[ ]Auto Mode | | |... |
534 ;; 21 |[ ]Menu Lock | | +---------+ +--------------+ 536 ;; 21 |[ ]Menu Lock | | +---------+ +--------------+
535 ;; +-----------------------------+ \------------------|(*)All Pages | 537 ;; +-----------------------------+ \------------------|(*)All Pages |
688 ;; 690 ;;
689 ;; 20. Turn this option on if you want that when current major-mode is 691 ;; 20. Turn this option on if you want that when current major-mode is
690 ;; declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands 692 ;; declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
691 ;; behave like `*-mode*' commands. 693 ;; behave like `*-mode*' commands.
692 ;; 694 ;;
693 ;; 21. If you want that Printing menu stays poped up while you are setting 695 ;; 21. If you want that Printing menu stays open while you are setting
694 ;; toggle options, turn on this option. The variables 696 ;; toggle options, turn on this option. The variables
695 ;; `pr-menu-char-height' and `pr-menu-char-width' are used to guess the 697 ;; `pr-menu-char-height' and `pr-menu-char-width' are used to guess the
696 ;; menu position, so don't forget to adjust these variables if menu 698 ;; menu position, so don't forget to adjust these variables if menu
697 ;; position is not ok. 699 ;; position is not ok.
698 ;; 700 ;;
1155 `pr-txt-name' variable setting and for menu selection. 1157 `pr-txt-name' variable setting and for menu selection.
1156 Examples: 1158 Examples:
1157 'prt_06a 1159 'prt_06a
1158 'my_printer 1160 'my_printer
1159 1161
1160 COMMAND Name of program for printing a text file. On MS-DOS and 1162 COMMAND Name of the program for printing a text file. On MS-DOS and
1161 MS-Windows systems, if the value is an empty string then Emacs 1163 MS-Windows systems, if the value is an empty string, then Emacs
1162 will write directly to the printer port named by NAME (see text 1164 will write directly to the printer port given by NAME (see text
1163 below), that is, the NAME should be something like \"PRN\" or 1165 below), that is, the NAME should be something like \"PRN\" or
1164 \"LPT1:\". 1166 \"LPT1:\".
1165 If NAME is something like \"\\\\\\\\host\\\\share-name\" then 1167 If NAME is something like \"\\\\\\\\host\\\\share-name\" then
1166 COMMAND shouldn't be an empty string. 1168 COMMAND shouldn't be an empty string.
1167 The programs `print' and `nprint' (the standard print programs 1169 The programs `print' and `nprint' (the standard print programs
1285 `pr-ps-name' variable setting and for menu selection. 1287 `pr-ps-name' variable setting and for menu selection.
1286 Examples: 1288 Examples:
1287 'prt_06a 1289 'prt_06a
1288 'my_printer 1290 'my_printer
1289 1291
1290 COMMAND Name of program for printing a PostScript file. On MS-DOS and 1292 COMMAND Name of the program for printing a PostScript file. On MS-DOS
1291 MS-Windows systems, if the value is an empty string then Emacs 1293 and MS-Windows systems, if the value is an empty string then
1292 will write directly to the printer port named by NAME (see text 1294 Emacs will write directly to the printer port given by NAME
1293 below), that is, the NAME should be something like \"PRN\" or 1295 (see text below), that is, the NAME should be something like
1294 \"LPT1:\". 1296 \"PRN\" or \"LPT1:\".
1295 If NAME is something like \"\\\\\\\\host\\\\share-name\" then 1297 If NAME is something like \"\\\\\\\\host\\\\share-name\" then
1296 COMMAND shouldn't be an empty string. 1298 COMMAND shouldn't be an empty string.
1297 The programs `print' and `nprint' (the standard print programs 1299 The programs `print' and `nprint' (the standard print programs
1298 on Windows NT and Novell Netware respectively) are handled 1300 on Windows NT and Novell Netware respectively) are handled
1299 specially, using NAME as the destination for output; any other 1301 specially, using NAME as the destination for output; any other
1470 1472
1471 (defcustom pr-gv-command 1473 (defcustom pr-gv-command
1472 (if ps-windows-system 1474 (if ps-windows-system
1473 "gsview32.exe" 1475 "gsview32.exe"
1474 "gv") 1476 "gv")
1475 "*Specify path and name of gsview program. 1477 "*Specify path and name of the gsview/gv utility.
1476 1478
1477 See also `pr-path-alist'." 1479 See also `pr-path-alist'."
1478 :type '(string :tag "Ghostview Program") 1480 :type '(string :tag "Ghostview Utility")
1479 :group 'printing) 1481 :group 'printing)
1480 1482
1481 1483
1482 (defcustom pr-gs-command 1484 (defcustom pr-gs-command
1483 (if ps-windows-system 1485 (if ps-windows-system
1484 "gswin32.exe" 1486 "gswin32.exe"
1485 "gs") 1487 "gs")
1486 "*Specify path and name of ghostscript program. 1488 "*Specify path and name of the ghostscript utility.
1487 1489
1488 See also `pr-path-alist'." 1490 See also `pr-path-alist'."
1489 :type '(string :tag "Ghostscript Program") 1491 :type '(string :tag "Ghostscript Utility")
1490 :group 'printing) 1492 :group 'printing)
1491 1493
1492 1494
1493 (defcustom pr-gs-switches 1495 (defcustom pr-gs-switches
1494 (if ps-windows-system 1496 (if ps-windows-system
1522 1524
1523 (defcustom pr-gs-device 1525 (defcustom pr-gs-device
1524 (if ps-windows-system 1526 (if ps-windows-system
1525 "mswinpr2" 1527 "mswinpr2"
1526 "uniprint") 1528 "uniprint")
1527 "*Specify ghostscript device switch value (-sDEVICE=). 1529 "*Specify the ghostscript device switch value (-sDEVICE=).
1528 1530
1529 A note on the gs switches: 1531 A note on the gs switches:
1530 1532
1531 -sDEVICE=djet500 the printer - works with HP DeskJet 540 1533 -sDEVICE=djet500 the printer - works with HP DeskJet 540
1532 1534
1607 :type 'boolean 1609 :type 'boolean
1608 :group 'printing) 1610 :group 'printing)
1609 1611
1610 1612
1611 (defcustom pr-auto-mode t 1613 (defcustom pr-auto-mode t
1612 "*Non-nil means major-mode printing is prefered over normal printing. 1614 "*Non-nil means major-mode specific printing is prefered over normal printing.
1613 1615
1614 That is, if current major-mode is declared in `pr-mode-alist', the `*-buffer*' 1616 That is, if current major-mode is declared in `pr-mode-alist', the `*-buffer*'
1615 and `*-region*' commands will behave like `*-mode*' commands; otherwise, 1617 and `*-region*' commands will behave like `*-mode*' commands; otherwise,
1616 `*-buffer*' commands will print the current buffer and `*-region*' commands 1618 `*-buffer*' commands will print the current buffer and `*-region*' commands
1617 will print the current region." 1619 will print the current region."
1874 \"psnup -q\" 1876 \"psnup -q\"
1875 1877
1876 . for Windows system: 1878 . for Windows system:
1877 \"c:/psutils/psnup -q\" 1879 \"c:/psutils/psnup -q\"
1878 1880
1879 MUST-SWITCHES List of sexp's to pass as options for PostScript utility 1881 MUST-SWITCHES List of sexp's to pass as options to the PostScript utility
1880 program. These options are necessary to process the utility 1882 program. These options are necessary to process the utility
1881 program and must be place before any other switches. 1883 program and must be placed before any other switches.
1882 Example: 1884 Example:
1883 . for psnup: 1885 . for psnup:
1884 '(\"-q\") 1886 '(\"-q\")
1885 1887
1886 PAPERSIZE It's a format string to specify paper size switch. 1888 PAPERSIZE It's a format string to specify paper size switch.
1919 \" \" ; psnup ... input output 1921 \" \" ; psnup ... input output
1920 1922
1921 . for mpage 1923 . for mpage
1922 \">\" ; mpage ... input > output 1924 \">\" ; mpage ... input > output
1923 1925
1924 SWITCHES List of sexp's to pass as extra options for PostScript utility 1926 SWITCHES List of sexp's to pass as extra options to the PostScript utility
1925 program. 1927 program.
1926 Example: 1928 Example:
1927 . for psnup 1929 . for psnup
1928 '(\"-q\") 1930 '(\"-q\")
1929 nil 1931 nil
2200 |[ ] Tumble | 2202 |[ ] Tumble |
2201 |[ ] Upside-Down | 2203 |[ ] Upside-Down |
2202 | Print All Pages >| 2204 | Print All Pages >|
2203 +------------------------------+ 2205 +------------------------------+
2204 `postscript-process' |[ ] Spool Buffer | 2206 `postscript-process' |[ ] Spool Buffer |
2205 |[ ] Print with-faces | 2207 |[ ] Print with faces |
2206 |[ ] Print Using Ghostscript | 2208 |[ ] Print via Ghostscript |
2207 +------------------------------+ 2209 +------------------------------+
2208 `printing' |[ ] Auto Region | 2210 `printing' |[ ] Auto Region |
2209 |[ ] Auto Mode | 2211 |[ ] Auto Mode |
2210 |[ ] Menu Lock | 2212 |[ ] Menu Lock |
2211 +------------------------------+ 2213 +------------------------------+
2297 "Name of program for printing a text file. 2299 "Name of program for printing a text file.
2298 See `pr-txt-printer-alist'.") 2300 See `pr-txt-printer-alist'.")
2299 2301
2300 2302
2301 (defvar pr-txt-switches nil 2303 (defvar pr-txt-switches nil
2302 "List of sexp's to pass as extra options for text printer program. 2304 "List of sexp's to pass as extra options to the text printer program.
2303 See `pr-txt-printer-alist'.") 2305 See `pr-txt-printer-alist'.")
2304 2306
2305 2307
2306 (defvar pr-txt-printer nil 2308 (defvar pr-txt-printer nil
2307 "Specify text printer name. 2309 "Specify text printer name.
2312 "Name of program for printing a PostScript file. 2314 "Name of program for printing a PostScript file.
2313 See `pr-ps-printer-alist'.") 2315 See `pr-ps-printer-alist'.")
2314 2316
2315 2317
2316 (defvar pr-ps-switches nil 2318 (defvar pr-ps-switches nil
2317 "List of sexp's to pass as extra options for PostScript printer program. 2319 "List of sexp's to pass as extra options to the PostScript printer program.
2318 See `pr-ps-printer-alist'.") 2320 See `pr-ps-printer-alist'.")
2319 2321
2320 2322
2321 (defvar pr-ps-printer-switch nil 2323 (defvar pr-ps-printer-switch nil
2322 "Specify PostScript printer name switch. 2324 "Specify PostScript printer name switch.
2554 "--" 2556 "--"
2555 ["Spool Buffer" pr-toggle-spool 2557 ["Spool Buffer" pr-toggle-spool
2556 :style toggle :selected pr-spool-p 2558 :style toggle :selected pr-spool-p
2557 :included (pr-visible-p 'postscript-process) 2559 :included (pr-visible-p 'postscript-process)
2558 :help "Toggle PostScript spooling"] 2560 :help "Toggle PostScript spooling"]
2559 ["Print with-faces" pr-toggle-faces 2561 ["Print with faces" pr-toggle-faces
2560 :style toggle :selected pr-faces-p 2562 :style toggle :selected pr-faces-p
2561 :included (pr-visible-p 'postscript-process) 2563 :included (pr-visible-p 'postscript-process)
2562 :help "Toggle PostScript printing with faces"] 2564 :help "Toggle PostScript printing with faces"]
2563 ["Print Using Ghostscript" pr-toggle-ghostscript 2565 ["Print via Ghostscript" pr-toggle-ghostscript
2564 :style toggle :selected pr-print-using-ghostscript 2566 :style toggle :selected pr-print-using-ghostscript
2565 :included (pr-visible-p 'postscript-process) 2567 :included (pr-visible-p 'postscript-process)
2566 :help "Toggle PostScript generation using ghostscript"] 2568 :help "Toggle PostScript generation using ghostscript"]
2567 "--" 2569 "--"
2568 ["Auto Region" pr-toggle-region 2570 ["Auto Region" pr-toggle-region
2744 :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)]) 2746 :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)])
2745 "--" 2747 "--"
2746 ["Spool Buffer" pr-toggle-spool 2748 ["Spool Buffer" pr-toggle-spool
2747 :style toggle :selected pr-spool-p 2749 :style toggle :selected pr-spool-p
2748 :included (pr-visible-p 'postscript-process)] 2750 :included (pr-visible-p 'postscript-process)]
2749 ["Print with-faces" pr-toggle-faces 2751 ["Print with faces" pr-toggle-faces
2750 :style toggle :selected pr-faces-p 2752 :style toggle :selected pr-faces-p
2751 :included (pr-visible-p 'postscript-process)] 2753 :included (pr-visible-p 'postscript-process)]
2752 ["Print Using Ghostscript" pr-toggle-ghostscript 2754 ["Print via Ghostscript" pr-toggle-ghostscript
2753 :style toggle :selected pr-print-using-ghostscript 2755 :style toggle :selected pr-print-using-ghostscript
2754 :included (pr-visible-p 'postscript-process)] 2756 :included (pr-visible-p 'postscript-process)]
2755 "--" 2757 "--"
2756 ["Auto Region" pr-toggle-region 2758 ["Auto Region" pr-toggle-region
2757 :style toggle :selected pr-auto-region 2759 :style toggle :selected pr-auto-region
2868 13 |[ ]Tumble | \\--\\ |Buffer | | 4-up... | 2870 13 |[ ]Tumble | \\--\\ |Buffer | | 4-up... |
2869 14 |[ ]Upside-Down | | |Region | | Other... | 2871 14 |[ ]Upside-Down | | |Region | | Other... |
2870 15 | Print All Pages >|--\\ | |Mode | +------------+ 2872 15 | Print All Pages >|--\\ | |Mode | +------------+
2871 +-----------------------------+ | | +---------+ |[ ]Landscape| Id 2873 +-----------------------------+ | | +---------+ |[ ]Landscape| Id
2872 IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie 2874 IV 16 |[ ]Spool Buffer | | | +-C-------+ |[ ]Duplex | Ie
2873 17 |[ ]Print with-faces | | \\--|( )name A| |[ ]Tumble | If 2875 17 |[ ]Print with faces | | \\--|( )name A| |[ ]Tumble | If
2874 18 |[ ]Print Using Ghostscript | | |( )name B| +------------+ 2876 18 |[ ]Print via Ghostscript | | |( )name B| +------------+
2875 +-----------------------------+ | |... | 2877 +-----------------------------+ | |... |
2876 V 19 |[ ]Auto Region | | |(*)name | 2878 V 19 |[ ]Auto Region | | |(*)name |
2877 20 |[ ]Auto Mode | | |... | 2879 20 |[ ]Auto Mode | | |... |
2878 21 |[ ]Menu Lock | | +---------+ +--------------+ 2880 21 |[ ]Menu Lock | | +---------+ +--------------+
2879 +-----------------------------+ \\------------------|(*)All Pages | 2881 +-----------------------------+ \\------------------|(*)All Pages |
2943 Also, if you already have a PostScript file you can print it. 2945 Also, if you already have a PostScript file you can print it.
2944 Instead of printing each buffer, region or major mode at once, you can 2946 Instead of printing each buffer, region or major mode at once, you can
2945 save temporarily the PostScript code generated in a buffer and print it 2947 save temporarily the PostScript code generated in a buffer and print it
2946 later. The option `Despool...' despools the PostScript spooling buffer 2948 later. The option `Despool...' despools the PostScript spooling buffer
2947 directly on a printer. If you type C-u before choosing this option, 2949 directly on a printer. If you type C-u before choosing this option,
2948 the PostScript code generated is saved in a file instead of sending to 2950 the PostScript code generated is saved in a file instead of sending it to
2949 printer. To spool the PostScript code generated you need to turn on 2951 the printer. To spool the PostScript code generated you need to turn on
2950 the option 16. This option is enabled if spooling is on (option 16). 2952 option 16. This option is enabled if spooling is on (option 16).
2951 See also the NOTE 1, NOTE 2 and NOTE 3 on option 1. 2953 See also the NOTE 1, NOTE 2 and NOTE 3 on option 1.
2952 2954
2953 3. You can select a new PostScript printer to send PostScript code 2955 3. You can select a new PostScript printer to send PostScript code
2954 generated. For selection it's used all PostScript printers defined 2956 generated. For selection it's used all PostScript printers defined
2955 in `pr-ps-printer-alist' variable (see it for documentation). 2957 in `pr-ps-printer-alist' variable (see it for documentation).
3030 3032
3031 20. Turn this option on if you want that when current major-mode is 3033 20. Turn this option on if you want that when current major-mode is
3032 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands 3034 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
3033 behave like `*-mode*' commands. 3035 behave like `*-mode*' commands.
3034 3036
3035 21. If you want that Printing menu stays poped while you are setting 3037 21. If you want that Printing menu stays open while you are setting
3036 toggle options, turn on this option. The variables 3038 toggle options, turn on this option. The variables
3037 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the 3039 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the
3038 menu position, so don't forget to adjust these variables if menu 3040 menu position, so don't forget to adjust these variables if menu
3039 position is not ok. 3041 position is not ok.
3040 3042
3235 Turn this option on if you want that when current major-mode is 3237 Turn this option on if you want that when current major-mode is
3236 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands 3238 declared in `pr-mode-alist', the `*-buffer*' and `*-region*' commands
3237 behave like `*-mode*' commands. 3239 behave like `*-mode*' commands.
3238 3240
3239 * Menu Lock: 3241 * Menu Lock:
3240 If you want that Printing menu stays poped while you are setting 3242 If you want that Printing menu stays open while you are setting
3241 toggle options, turn on this option. The variables 3243 toggle options, turn on this option. The variables
3242 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the 3244 `pr-menu-char-height' and `pr-menu-char-width' are used to guess the
3243 menu position, so don't forget to adjust these variables if menu 3245 menu position, so don't forget to adjust these variables if menu
3244 position is not ok. 3246 position is not ok.
3245 3247
3246 * Spool Buffer: 3248 * Spool Buffer:
3247 To spool the PostScript code generated. You can despool later by 3249 To spool the PostScript code generated. You can despool later by
3248 setting Despool option on PostScript printer section. 3250 setting Despool option on PostScript printer section.
3249 3251
3250 * Print with-faces: 3252 * Print with faces:
3251 If you use colors in your buffers and want to see these colors on your 3253 If you use colors in your buffers and want to see these colors on your
3252 PostScript code generated, turn on this option. If you have a 3254 PostScript code generated, turn on this option. If you have a
3253 black/white PostScript printer, these colors are displayed in gray 3255 black/white PostScript printer, these colors are displayed in gray
3254 scale by PostScript printer interpreter. 3256 scale by PostScript printer interpreter.
3255 3257
3256 * Print Using Ghostscript: 3258 * Print via Ghostscript:
3257 If you don't have a PostScript printer to send PostScript files, turn 3259 If you don't have a PostScript printer to send PostScript files, turn
3258 on this option. When this option is on, the ghostscript is used to 3260 on this option. When this option is on, the ghostscript is used to
3259 print PostScript files. In GNU or Unix system, if ghostscript is set 3261 print PostScript files. In GNU or Unix system, if ghostscript is set
3260 as a PostScript filter, you don't need to turn on this option. 3262 as a PostScript filter, you don't need to turn on this option.
3261 3263
3292 3294
3293 ;;;###autoload 3295 ;;;###autoload
3294 (defun pr-interface (&optional buffer) 3296 (defun pr-interface (&optional buffer)
3295 "Activate the printing interface buffer. 3297 "Activate the printing interface buffer.
3296 3298
3297 If BUFFER is nil, it uses the current buffer for printing. 3299 If BUFFER is nil, the current buffer is used for printing.
3298 3300
3299 For more informations, type \\[pr-interface-help]." 3301 For more information, type \\[pr-interface-help]."
3300 (interactive) 3302 (interactive)
3301 (save-excursion 3303 (save-excursion
3302 (set-buffer (or buffer (current-buffer))) 3304 (set-buffer (or buffer (current-buffer)))
3303 (pr-create-interface))) 3305 (pr-create-interface)))
3304 3306
3797 "Print PostScript file FILENAME." 3799 "Print PostScript file FILENAME."
3798 (interactive (list (pr-ps-infile-preprint "Print "))) 3800 (interactive (list (pr-ps-infile-preprint "Print ")))
3799 (and (stringp filename) (file-exists-p filename) 3801 (and (stringp filename) (file-exists-p filename)
3800 ;; printing 3802 ;; printing
3801 (let ((file (pr-expand-file-name filename))) 3803 (let ((file (pr-expand-file-name filename)))
3802 (if (string-equal pr-ps-command "") 3804 (if (string= pr-ps-command "")
3803 (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name))) 3805 (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
3804 (save-excursion 3806 (save-excursion
3805 (set-buffer ps-spool-buffer) 3807 (set-buffer ps-spool-buffer)
3806 (erase-buffer) 3808 (erase-buffer)
3807 (insert-file-contents-literally file)) 3809 (insert-file-contents-literally file))
3899 3901
3900 ;;;###autoload 3902 ;;;###autoload
3901 (defun pr-toggle-faces () 3903 (defun pr-toggle-faces ()
3902 "Toggle printing with faces." 3904 "Toggle printing with faces."
3903 (interactive) 3905 (interactive)
3904 (pr-toggle 'pr-faces-p "Printing with-faces" 3906 (pr-toggle 'pr-faces-p "Printing with faces"
3905 'postscript-process 1 12 'toggle)) 3907 'postscript-process 1 12 'toggle))
3906 3908
3907 3909
3908 ;;;###autoload 3910 ;;;###autoload
3909 (defun pr-toggle-spool () 3911 (defun pr-toggle-spool ()
4006 'printing 1 12 'toggle)) 4008 'printing 1 12 'toggle))
4007 4009
4008 4010
4009 ;;;###autoload 4011 ;;;###autoload
4010 (defun pr-customize (&rest ignore) 4012 (defun pr-customize (&rest ignore)
4011 "Customization of `printing' group." 4013 "Customization of the `printing' group."
4012 (interactive) 4014 (interactive)
4013 (customize-group 'printing)) 4015 (customize-group 'printing))
4014 4016
4015 4017
4016 ;;;###autoload 4018 ;;;###autoload
4017 (defun lpr-customize (&rest ignore) 4019 (defun lpr-customize (&rest ignore)
4018 "Customization of `lpr' group." 4020 "Customization of the `lpr' group."
4019 (interactive) 4021 (interactive)
4020 (customize-group 'lpr)) 4022 (customize-group 'lpr))
4021 4023
4022 4024
4023 ;;;###autoload 4025 ;;;###autoload
4024 (defun pr-help (&rest ignore) 4026 (defun pr-help (&rest ignore)
4025 "Help for printing package." 4027 "Help for the printing package."
4026 (interactive) 4028 (interactive)
4027 (pr-show-setup pr-help-message "*Printing Help*")) 4029 (pr-show-setup pr-help-message "*Printing Help*"))
4028 4030
4029 4031
4030 ;;;###autoload 4032 ;;;###autoload
4031 (defun pr-ps-name () 4033 (defun pr-ps-name ()
4032 "Select interactively a PostScript printer." 4034 "Interactively select a PostScript printer."
4033 (interactive) 4035 (interactive)
4034 (pr-menu-set-ps-title 4036 (pr-menu-set-ps-title
4035 (pr-complete-alist "PostScript printer" pr-ps-printer-alist pr-ps-name))) 4037 (pr-complete-alist "PostScript printer" pr-ps-printer-alist pr-ps-name)))
4036 4038
4037 4039
4038 ;;;###autoload 4040 ;;;###autoload
4039 (defun pr-txt-name () 4041 (defun pr-txt-name ()
4040 "Select interactively a text printer." 4042 "Interactively select a text printer."
4041 (interactive) 4043 (interactive)
4042 (pr-menu-set-txt-title 4044 (pr-menu-set-txt-title
4043 (pr-complete-alist "Text printer" pr-txt-printer-alist pr-txt-name))) 4045 (pr-complete-alist "Text printer" pr-txt-printer-alist pr-txt-name)))
4044 4046
4045 4047
4046 ;;;###autoload 4048 ;;;###autoload
4047 (defun pr-ps-utility () 4049 (defun pr-ps-utility ()
4048 "Select interactively a PostScript utility." 4050 "Interactively select a PostScript utility."
4049 (interactive) 4051 (interactive)
4050 (pr-menu-set-utility-title 4052 (pr-menu-set-utility-title
4051 (pr-complete-alist "Postscript utility" pr-ps-utility-alist pr-ps-utility))) 4053 (pr-complete-alist "Postscript utility" pr-ps-utility-alist pr-ps-utility)))
4052 4054
4053 4055
4525 (setq index (+ index 4527 (setq index (+ index
4526 (cdr (assq key pr-menu-entry-alist))))))) 4528 (cdr (assq key pr-menu-entry-alist)))))))
4527 (+ index 2)) 4529 (+ index 2))
4528 4530
4529 4531
4532 (defvar pr-menu-position nil)
4533 (defvar pr-menu-state nil)
4534
4535
4530 (eval-and-compile 4536 (eval-and-compile
4531 (cond 4537 (cond
4532 ((eq ps-print-emacs-type 'xemacs) 4538 ((eq ps-print-emacs-type 'xemacs)
4533 ;; XEmacs 4539 ;; XEmacs
4534 (defun pr-menu-position (entry index horizontal) 4540 (defun pr-menu-position (entry index horizontal)
4558 (list (- (car pos) ; X 4564 (list (- (car pos) ; X
4559 (* horizontal pr-menu-char-width)) 4565 (* horizontal pr-menu-char-width))
4560 (- (cdr pos) ; Y 4566 (- (cdr pos) ; Y
4561 (* (pr-menu-index entry index) pr-menu-char-height))) 4567 (* (pr-menu-index entry index) pr-menu-char-height)))
4562 (selected-frame)))) ; frame 4568 (selected-frame)))) ; frame
4563 ))) 4569 ))
4564 4570
4565 4571 (cond
4566 (defvar pr-menu-position nil) 4572 ((eq ps-print-emacs-type 'emacs)
4567 (defvar pr-menu-state nil) 4573 ;; GNU Emacs
4568 4574 (defun pr-menu-lookup (path)
4569 4575 (let ((ipath pr-menu-bar))
4570 (cond 4576 (lookup-key global-map
4571 ((eq ps-print-emacs-type 'emacs) 4577 (if path
4572 ;; GNU Emacs 4578 (vconcat ipath
4573 (defun pr-menu-lock (entry index horizontal state path) 4579 (mapcar 'pr-get-symbol
4574 (when (and (not (interactive-p)) pr-menu-lock) 4580 (if (listp path)
4575 (or (and pr-menu-position (eq state pr-menu-state)) 4581 path
4576 (setq pr-menu-position (pr-menu-position entry index horizontal) 4582 (list path))))
4577 pr-menu-state state)) 4583 ipath))))
4578 (let* ((menu (pr-menu-lookup path)) 4584
4579 (result (x-popup-menu pr-menu-position menu))) 4585 ;; GNU Emacs
4580 (and result 4586 (defun pr-menu-lock (entry index horizontal state path)
4581 (let ((command (lookup-key menu (vconcat result)))) 4587 (when (and (not (interactive-p)) pr-menu-lock)
4582 (if (fboundp command) 4588 (or (and pr-menu-position (eq state pr-menu-state))
4583 (funcall command) 4589 (setq pr-menu-position (pr-menu-position entry index horizontal)
4584 (eval command))))) 4590 pr-menu-state state))
4585 (setq pr-menu-position nil))) 4591 (let* ((menu (pr-menu-lookup path))
4586 4592 (result (x-popup-menu pr-menu-position menu)))
4587 ;; GNU Emacs 4593 (and result
4588 (defun pr-menu-lookup (path) 4594 (let ((command (lookup-key menu (vconcat result))))
4589 (let ((ipath pr-menu-bar)) 4595 (if (fboundp command)
4590 (lookup-key global-map 4596 (funcall command)
4591 (if path 4597 (eval command)))))
4592 (vconcat ipath 4598 (setq pr-menu-position nil))))
4593 (mapcar 'pr-get-symbol 4599
4594 (if (listp path) 4600
4595 path 4601 ((eq ps-print-emacs-type 'xemacs)
4596 (list path)))) 4602 ;; XEmacs
4597 ipath))))) 4603 (defun pr-menu-lookup (path)
4598 4604 (car (pr-x-find-menu-item current-menubar (cons "Printing" path))))
4599 4605
4600 ((eq ps-print-emacs-type 'xemacs) 4606 ;; XEmacs
4601 ;; XEmacs 4607 (defun pr-menu-lock (entry index horizontal state path)
4602 (defun pr-menu-lock (entry index horizontal state path) 4608 (when (and (not (interactive-p)) pr-menu-lock)
4603 (when (and (not (interactive-p)) pr-menu-lock) 4609 (or (and pr-menu-position (eq state pr-menu-state))
4604 (or (and pr-menu-position (eq state pr-menu-state)) 4610 (setq pr-menu-position (pr-menu-position entry index horizontal)
4605 (setq pr-menu-position (pr-menu-position entry index horizontal) 4611 pr-menu-state state))
4606 pr-menu-state state)) 4612 (let* ((menu (pr-menu-lookup path))
4607 (let* ((menu (pr-menu-lookup path)) 4613 (result (pr-x-get-popup-menu-response menu pr-menu-position)))
4608 (result (pr-x-get-popup-menu-response menu pr-menu-position))) 4614 (and (pr-x-misc-user-event-p result)
4609 (and (pr-x-misc-user-event-p result) 4615 (funcall (pr-x-event-function result)
4610 (funcall (pr-x-event-function result) 4616 (pr-x-event-object result))))
4611 (pr-x-event-object result)))) 4617 (setq pr-menu-position nil))))))
4612 (setq pr-menu-position nil)))
4613
4614 ;; XEmacs
4615 (defun pr-menu-lookup (path)
4616 (car (pr-x-find-menu-item current-menubar (cons "Printing" path))))))
4617 4618
4618 4619
4619 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4620 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4620 ;; Printer & Utility Selection 4621 ;; Printer & Utility Selection
4621 4622
4640 (pr-update-var 'pr-ps-utility pr-ps-utility-alist) 4641 (pr-update-var 'pr-ps-utility pr-ps-utility-alist)
4641 (pr-do-update-menus force)) 4642 (pr-do-update-menus force))
4642 4643
4643 4644
4644 (defvar pr-ps-printer-menu-modified t 4645 (defvar pr-ps-printer-menu-modified t
4645 "Non-nil means `pr-ps-printer-alist' was modified and need to update menu.") 4646 "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.")
4646 (defvar pr-txt-printer-menu-modified t 4647 (defvar pr-txt-printer-menu-modified t
4647 "Non-nil means `pr-txt-printer-alist' was modified and need to update menu.") 4648 "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.")
4648 (defvar pr-ps-utility-menu-modified t 4649 (defvar pr-ps-utility-menu-modified t
4649 "Non-nil means `pr-ps-utility-alist' was modified and need to update menu.") 4650 "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.")
4650 4651
4651 4652
4652 (defconst pr-even-or-odd-alist 4653 (defconst pr-even-or-odd-alist
4653 '((nil . "Print All Pages") 4654 '((nil . "Print All Pages")
4654 (even-page . "Print Even Pages") 4655 (even-page . "Print Even Pages")
4655 (odd-page . "Print Odd Pages") 4656 (odd-page . "Print Odd Pages")
4656 (even-sheet . "Print Even Sheets") 4657 (even-sheet . "Print Even Sheets")
4657 (odd-sheet . "Print Odd Sheets"))) 4658 (odd-sheet . "Print Odd Sheets")))
4658 4659
4659 4660
4660 (defun pr-menu-create (name alist var-sym fun entry index) 4661 (defun pr-menu-create (name alist var-sym fun entry index)
4661 (cons name 4662 (cons name
4662 (mapcar 4663 (mapcar
4879 (pr-x-relabel-menu-item 4880 (pr-x-relabel-menu-item
4880 (list "Printing" (symbol-value var-sym)) 4881 (list "Printing" (symbol-value var-sym))
4881 newname) 4882 newname)
4882 (set var-sym newname))) 4883 (set var-sym newname)))
4883 4884
4884 4885 ;; GNU Emacs
4885 (defun pr-menu-set-item-name (item name) 4886 (defun pr-menu-set-item-name (item name)
4886 (and item 4887 (and item
4887 (setcar (nthcdr 2 item) name))) ; ITEM-NAME 4888 (setcar (nthcdr 2 item) name))) ; ITEM-NAME
4888 4889
4889 4890 ;; GNU Emacs
4890 (defun pr-menu-get-item (name-list) 4891 (defun pr-menu-get-item (name-list)
4891 ;; NAME-LIST is a string or a list of strings. 4892 ;; NAME-LIST is a string or a list of strings.
4892 (let ((ipath pr-menu-bar) 4893 (let ((ipath pr-menu-bar)
4893 (len (and (listp name-list) (length name-list)))) 4894 (len (and (listp name-list) (length name-list))))
4894 (and len (= len 1) 4895 (and len (= len 1)
5469 5470
5470 5471
5471 (defun pr-command (command) 5472 (defun pr-command (command)
5472 "Return absolute file name specification for COMMAND. 5473 "Return absolute file name specification for COMMAND.
5473 5474
5475 If COMMAND is an empty string, return it.
5476
5474 If COMMAND is already an absolute file name specification, return it. 5477 If COMMAND is already an absolute file name specification, return it.
5475 Else it uses `pr-path-alist' to find COMMAND, if find it then return it; 5478 Else it uses `pr-path-alist' to find COMMAND, if find it then return it;
5476 otherwise, gives an error. 5479 otherwise, gives an error.
5477 5480
5478 When using `pr-path-alist' to find COMMAND, the entries `cygwin', `windows' and 5481 When using `pr-path-alist' to find COMMAND, the entries `cygwin', `windows' and
5479 `unix' are used (see `pr-path-alist' for documentation). 5482 `unix' are used (see `pr-path-alist' for documentation).
5480 5483
5481 If Emacs is running on Windows 95/98/NT/2000, tries to find COMMAND, 5484 If Emacs is running on Windows 95/98/NT/2000, tries to find COMMAND,
5482 COMMAND.exe, COMMAND.bat and COMMAND.com in this order." 5485 COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
5483 (pr-dosify-path 5486 (if (string= command "")
5484 (or (pr-find-command command) 5487 command
5485 (pr-path-command (cond (pr-cygwin-system 'cygwin) 5488 (pr-dosify-path
5486 (ps-windows-system 'windows) 5489 (or (pr-find-command command)
5487 (t 'unix)) 5490 (pr-path-command (cond (pr-cygwin-system 'cygwin)
5488 (file-name-nondirectory command) 5491 (ps-windows-system 'windows)
5489 nil) 5492 (t 'unix))
5490 (error "Command not found: %s" (file-name-nondirectory command))))) 5493 (file-name-nondirectory command)
5494 nil)
5495 (error "Command not found: %s"
5496 (file-name-nondirectory command))))))
5491 5497
5492 5498
5493 (defun pr-path-command (symbol command sym-list) 5499 (defun pr-path-command (symbol command sym-list)
5494 (let ((lpath (cdr (assq symbol pr-path-alist))) 5500 (let ((lpath (cdr (assq symbol pr-path-alist)))
5495 cmd) 5501 cmd)
5713 :notify 'pr-interface-directory 5719 :notify 'pr-interface-directory
5714 :action (lambda (widget &optional event) 5720 :action (lambda (widget &optional event)
5715 (if (pr-interface-directory widget) 5721 (if (pr-interface-directory widget)
5716 (pr-widget-field-action widget event) 5722 (pr-widget-field-action widget event)
5717 (ding) 5723 (ding)
5718 (message "It should be a readable directory"))) 5724 (message "Please specify a readable directory")))
5719 pr-i-directory) 5725 pr-i-directory)
5720 ;; 1b. Directory: File Regexp 5726 ;; 1b. Directory: File Regexp
5721 (widget-create 'regexp 5727 (widget-create 'regexp
5722 :size 58 5728 :size 58
5723 :format "\n File Regexp : %v\n" 5729 :format "\n File Regexp : %v\n"
5737 :notify 'pr-interface-infile 5743 :notify 'pr-interface-infile
5738 :action (lambda (widget &rest event) 5744 :action (lambda (widget &rest event)
5739 (if (pr-interface-infile widget) 5745 (if (pr-interface-infile widget)
5740 (pr-widget-field-action widget event) 5746 (pr-widget-field-action widget event)
5741 (ding) 5747 (ding)
5742 (message "It should be a readable PostScript file"))) 5748 (message "Please specify a readable PostScript file")))
5743 pr-i-ps-file) 5749 pr-i-ps-file)
5744 ;; 1c. PostScript File: PostScript Utility 5750 ;; 1c. PostScript File: PostScript Utility
5745 (pr-insert-menu "PostScript Utility" 'pr-ps-utility 5751 (pr-insert-menu "PostScript Utility" 'pr-ps-utility
5746 (pr-choice-alist pr-ps-utility-alist) 5752 (pr-choice-alist pr-ps-utility-alist)
5747 "\n PostScript Utility : " 5753 "\n PostScript Utility : "
5764 'pr-i-despool 5770 'pr-i-despool
5765 #'(lambda (widget &rest ignore) 5771 #'(lambda (widget &rest ignore)
5766 (if pr-spool-p 5772 (if pr-spool-p
5767 (setq pr-i-despool (not pr-i-despool)) 5773 (setq pr-i-despool (not pr-i-despool))
5768 (ding) 5774 (ding)
5769 (message "It despool only when it's spooling") 5775 (message "Can despool only when spooling is actually selected")
5770 (setq pr-i-despool nil)) 5776 (setq pr-i-despool nil))
5771 (widget-value-set widget pr-i-despool) 5777 (widget-value-set widget pr-i-despool)
5772 (widget-setup)) ; MUST be called after widget-value-set 5778 (widget-setup)) ; MUST be called after widget-value-set
5773 " Despool ")) 5779 " Despool "))
5774 ;; 2. PostScript Printer: Preview Print Quit 5780 ;; 2. PostScript Printer: Preview Print Quit
5790 (or (not (file-exists-p pr-i-out-file)) 5796 (or (not (file-exists-p pr-i-out-file))
5791 (setq pr-i-answer-yes 5797 (setq pr-i-answer-yes
5792 (y-or-n-p "File exists; overwrite? ")))) 5798 (y-or-n-p "File exists; overwrite? "))))
5793 (pr-widget-field-action widget event) 5799 (pr-widget-field-action widget event)
5794 (ding) 5800 (ding)
5795 (message "It should be a writable PostScript file"))) 5801 (message "Please specify a writable PostScript file")))
5796 pr-i-out-file) 5802 pr-i-out-file)
5797 ;; 2. PostScript Printer: N-Up 5803 ;; 2. PostScript Printer: N-Up
5798 (widget-create 5804 (widget-create
5799 'integer 5805 'integer
5800 :size 3 5806 :size 3
5807 (<= 1 value) (<= value 100)) 5813 (<= 1 value) (<= value 100))
5808 (progn 5814 (progn
5809 (message " ") 5815 (message " ")
5810 (setq pr-i-n-up value)) 5816 (setq pr-i-n-up value))
5811 (ding) 5817 (ding)
5812 (message "It should be an integer between 1 and 100")))) 5818 (message "Please specify an integer between 1 and 100"))))
5813 pr-i-n-up)) 5819 pr-i-n-up))
5814 5820
5815 5821
5816 (defun pr-insert-section-3 () 5822 (defun pr-insert-section-3 ()
5817 ;; 3. Text Printer: 5823 ;; 3. Text Printer:
5855 (unless pr-spool-p 5861 (unless pr-spool-p
5856 (setq pr-i-despool nil) 5862 (setq pr-i-despool nil)
5857 (pr-update-checkbox 'pr-i-despool))) 5863 (pr-update-checkbox 'pr-i-despool)))
5858 " Spool Buffer") 5864 " Spool Buffer")
5859 5865
5860 ;; 4. Settings: Duplex Print with-faces 5866 ;; 4. Settings: Duplex Print with faces
5861 (pr-insert-checkbox "\n " 5867 (pr-insert-checkbox "\n "
5862 'ps-spool-duplex 5868 'ps-spool-duplex
5863 #'(lambda (&rest ignore) 5869 #'(lambda (&rest ignore)
5864 (setq ps-spool-duplex (not ps-spool-duplex) 5870 (setq ps-spool-duplex (not ps-spool-duplex)
5865 pr-file-duplex ps-spool-duplex)) 5871 pr-file-duplex ps-spool-duplex))
5866 " Duplex ") 5872 " Duplex ")
5867 (pr-insert-toggle 'pr-faces-p " Print with-faces") 5873 (pr-insert-toggle 'pr-faces-p " Print with faces")
5868 5874
5869 ;; 4. Settings: Tumble Print Using Ghostscript 5875 ;; 4. Settings: Tumble Print via Ghostscript
5870 (pr-insert-checkbox "\n " 5876 (pr-insert-checkbox "\n "
5871 'ps-spool-tumble 5877 'ps-spool-tumble
5872 #'(lambda (&rest ignore) 5878 #'(lambda (&rest ignore)
5873 (setq ps-spool-tumble (not ps-spool-tumble) 5879 (setq ps-spool-tumble (not ps-spool-tumble)
5874 pr-file-tumble ps-spool-tumble)) 5880 pr-file-tumble ps-spool-tumble))
5875 " Tumble ") 5881 " Tumble ")
5876 (pr-insert-toggle 'pr-print-using-ghostscript " Print Using Ghostscript\n ") 5882 (pr-insert-toggle 'pr-print-using-ghostscript " Print via Ghostscript\n ")
5877 5883
5878 ;; 4. Settings: Upside-Down Page Parity 5884 ;; 4. Settings: Upside-Down Page Parity
5879 (pr-insert-toggle 'ps-print-upside-down " Upside-Down ") 5885 (pr-insert-toggle 'ps-print-upside-down " Upside-Down ")
5880 (pr-insert-menu "Page Parity" 'ps-even-or-odd-pages 5886 (pr-insert-menu "Page Parity" 'ps-even-or-odd-pages
5881 (mapcar #'(lambda (alist) 5887 (mapcar #'(lambda (alist)
5960 (t 5966 (t
5961 (let (pr-auto-mode pr-auto-region) 5967 (let (pr-auto-mode pr-auto-region)
5962 (pr-txt-buffer))) 5968 (pr-txt-buffer)))
5963 ))) 5969 )))
5964 ((eq pr-i-process 'file) 5970 ((eq pr-i-process 'file)
5965 (error "It should be a text file")) 5971 (error "Please specify a text file"))
5966 (t 5972 (t
5967 (error "Internal error: `pr-i-process' = %S" pr-i-process)) 5973 (error "Internal error: `pr-i-process' = %S" pr-i-process))
5968 ) 5974 )
5969 ;; handlers 5975 ;; handlers
5970 ((quit error) 5976 ((quit error)
5985 (pr-interface-save 5991 (pr-interface-save
5986 (if pr-i-region 5992 (if pr-i-region
5987 (pr-printify-region) 5993 (pr-printify-region)
5988 (pr-printify-buffer)))) 5994 (pr-printify-buffer))))
5989 ((eq pr-i-process 'file) 5995 ((eq pr-i-process 'file)
5990 (error "It can't printify a PostScript file")) 5996 (error "Cannot printify a PostScript file"))
5991 (t 5997 (t
5992 (error "Internal error: `pr-i-process' = %S" pr-i-process)) 5998 (error "Internal error: `pr-i-process' = %S" pr-i-process))
5993 ) 5999 )
5994 ;; handlers 6000 ;; handlers
5995 ((quit error) 6001 ((quit error)
6032 (funcall ps-directory 6038 (funcall ps-directory
6033 pr-i-n-up pr-i-directory pr-i-regexp outfile))) 6039 pr-i-n-up pr-i-directory pr-i-regexp outfile)))
6034 ((eq pr-i-process 'file) 6040 ((eq pr-i-process 'file)
6035 (cond ((or (file-directory-p pr-i-ps-file) 6041 (cond ((or (file-directory-p pr-i-ps-file)
6036 (not (file-readable-p pr-i-ps-file))) 6042 (not (file-readable-p pr-i-ps-file)))
6037 (error "It should be a readable PostScript file")) 6043 (error "Please specify a readable PostScript file"))
6038 (pr-i-ps-as-is 6044 (pr-i-ps-as-is
6039 (pr-interface-save 6045 (pr-interface-save
6040 (funcall ps-file pr-i-ps-file))) 6046 (funcall ps-file pr-i-ps-file)))
6041 (t 6047 (t
6042 (pr-interface-save 6048 (pr-interface-save
6068 nil) 6074 nil)
6069 ((not (eq pr-i-ps-send 'file)) 6075 ((not (eq pr-i-ps-send 'file))
6070 (error "Internal error: `pr-i-ps-send' = %S" pr-i-ps-send)) 6076 (error "Internal error: `pr-i-ps-send' = %S" pr-i-ps-send))
6071 ((or (file-directory-p pr-i-out-file) 6077 ((or (file-directory-p pr-i-out-file)
6072 (not (file-writable-p pr-i-out-file))) 6078 (not (file-writable-p pr-i-out-file)))
6073 (error "It should be a writable PostScript file")) 6079 (error "Please specify a writable PostScript file"))
6074 ((or (not (file-exists-p pr-i-out-file)) 6080 ((or (not (file-exists-p pr-i-out-file))
6075 pr-i-answer-yes 6081 pr-i-answer-yes
6076 (setq pr-i-answer-yes 6082 (setq pr-i-answer-yes
6077 (y-or-n-p (format "File `%s' exists; overwrite? " 6083 (y-or-n-p (format "File `%s' exists; overwrite? "
6078 pr-i-out-file)))) 6084 pr-i-out-file))))
6082 6088
6083 6089
6084 (defun pr-i-directory () 6090 (defun pr-i-directory ()
6085 (or (and (file-directory-p pr-i-directory) 6091 (or (and (file-directory-p pr-i-directory)
6086 (file-readable-p pr-i-directory)) 6092 (file-readable-p pr-i-directory))
6087 (error "It should be a readable directory"))) 6093 (error "Please specify be a readable directory")))
6088 6094
6089 6095
6090 (defun pr-interface-directory (widget &rest ignore) 6096 (defun pr-interface-directory (widget &rest ignore)
6091 (and pr-buffer-verbose 6097 (and pr-buffer-verbose
6092 (message "Type M-TAB or ESC TAB for file completion")) 6098 (message "You can use M-TAB or ESC TAB for file completion"))
6093 (let ((dir (widget-value widget))) 6099 (let ((dir (widget-value widget)))
6094 (and (file-directory-p dir) 6100 (and (file-directory-p dir)
6095 (file-readable-p dir) 6101 (file-readable-p dir)
6096 (setq pr-i-directory dir)))) 6102 (setq pr-i-directory dir))))
6097 6103
6098 6104
6099 (defun pr-interface-infile (widget &rest ignore) 6105 (defun pr-interface-infile (widget &rest ignore)
6100 (and pr-buffer-verbose 6106 (and pr-buffer-verbose
6101 (message "Type M-TAB or ESC TAB for file completion")) 6107 (message "You can use M-TAB or ESC TAB for file completion"))
6102 (let ((file (widget-value widget))) 6108 (let ((file (widget-value widget)))
6103 (and (not (file-directory-p file)) 6109 (and (not (file-directory-p file))
6104 (file-readable-p file) 6110 (file-readable-p file)
6105 (setq pr-i-ps-file file)))) 6111 (setq pr-i-ps-file file))))
6106 6112
6107 6113
6108 (defun pr-interface-outfile (widget &rest ignore) 6114 (defun pr-interface-outfile (widget &rest ignore)
6109 (setq pr-i-answer-yes nil) 6115 (setq pr-i-answer-yes nil)
6110 (and pr-buffer-verbose 6116 (and pr-buffer-verbose
6111 (message "Type M-TAB or ESC TAB for file completion")) 6117 (message "You can use M-TAB or ESC TAB for file completion"))
6112 (let ((file (widget-value widget))) 6118 (let ((file (widget-value widget)))
6113 (and (not (file-directory-p file)) 6119 (and (not (file-directory-p file))
6114 (file-writable-p file) 6120 (file-writable-p file)
6115 (setq pr-i-out-file file)))) 6121 (setq pr-i-out-file file))))
6116 6122