]> code.delx.au - gnu-emacs/blobdiff - lisp/printing.el
Fix race conditions with MS-Windows lock files by using _sopen.
[gnu-emacs] / lisp / printing.el
index e66cca259335a03a95d684991464db86de4bf328..bf50aa8f679d3cbede637906378b223206762d4e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; printing.el --- printing utilities
 
-;; Copyright (C) 2000-2001, 2003-201 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2003-2013 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -139,10 +139,9 @@ Please send all bug fixes and enhancements to
 ;;
 ;; One way to set variables is by calling `pr-customize', customize all
 ;; variables and save the customization by future sessions (see Options
-;; section).  Other way is by coding your settings on Emacs init file (that is,
-;; ~/.emacs file), see below for a first setting template that it should be
-;; inserted on your ~/.emacs file (or c:/_emacs, if you're using Windows 9x/NT
-;; or MS-DOS):
+;; section).  Other way is by adding code to your init file; see below
+;; for a first setting template that it should be inserted on your
+;; init file:
 ;;
 ;; * Example of setting for Windows system:
 ;;
@@ -297,8 +296,7 @@ Please send all bug fixes and enhancements to
 ;; Using `printing'
 ;; ----------------
 ;;
-;; To use `printing' insert in your ~/.emacs file (or c:/_emacs, if you're
-;; using Windows 9x/NT or MS-DOS):
+;; To use `printing' insert in your init file:
 ;;
 ;;    (require 'printing)
 ;;    ;; ...some user settings...
@@ -547,7 +545,7 @@ Please send all bug fixes and enhancements to
 ;; `pr-auto-region'            Non-nil means region is automagically detected.
 ;;
 ;; `pr-auto-mode'              Non-nil means major-mode specific printing is
-;;                             prefered over normal printing.
+;;                             preferred over normal printing.
 ;;
 ;; `pr-mode-alist'             Specify an alist for a major-mode and printing
 ;;                             function.
@@ -1385,6 +1383,10 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
   (eval-when-compile
     (require 'easymenu))               ; to avoid compilation gripes
 
+  (declare-function easy-menu-add-item "easymenu"
+                    (map path item &optional before))
+  (declare-function easy-menu-remove-item "easymenu" (map path name))
+
   (eval-and-compile
       (defun pr-global-menubar (pr-menu-spec)
        (require 'easymenu)
@@ -1798,7 +1800,7 @@ The alist element has the form:
 Where:
 
 SYMBOL         It's a symbol to identify a text printer.  It's for
-               `pr-txt-name' variable setting and for menu selection.
+               setting option `pr-txt-name' and for menu selection.
                Examples:
                        'prt_06a
                        'my_printer
@@ -1949,7 +1951,7 @@ The alist element has the form:
 Where:
 
 SYMBOL         It's a symbol to identify a PostScript printer.  It's for
-               `pr-ps-name' variable setting and for menu selection.
+               setting option `pr-ps-name' and for menu selection.
                Examples:
                        'prt_06a
                        'my_printer
@@ -2141,7 +2143,7 @@ Useful links:
   `http://bama.ua.edu/cgi-bin/man-cgi?lp'
   `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp'
 
-* GNU utilities for Win32 (cp.exe)
+* GNU utilities for w32 (cp.exe)
   `http://unxutils.sourceforge.net/'
 "
   :type '(repeat
@@ -2426,7 +2428,7 @@ marked instead of all buffer."
 
 
 (defcustom pr-auto-mode t
-  "Non-nil means major-mode specific printing is prefered over normal printing.
+  "Non-nil means major-mode specific printing is preferred over normal printing.
 
 That is, if current major-mode is declared in `pr-mode-alist', the `*-buffer*'
 and `*-region*' commands will behave like `*-mode*' commands; otherwise,
@@ -2536,7 +2538,7 @@ LPR-PRINT It's a symbol function for text printing.  It's invoked with
                nil, it's used (point-max).
 
 PS-PRINT       It's a symbol function for PostScript printing.  It's invoked
-               with 3 arguments: n-up printing, file name and the list:
+               with three arguments: n-up printing, file name and the list:
                (HEADER-LINES  LEFT-HEADER  RIGHT-HEADER DEFAULT...).
 
                Usually PS-PRINT function prepares the environment or buffer
@@ -2933,9 +2935,9 @@ INHERITS  Specify the inheritance for SYMBOL group.  It's a symbol name
 
                The example above has two setting groups: no-duplex and
                no-duplex-and-landscape.  When setting no-duplex is activated
-               through `inherits-from:' (see `pr-ps-utility', `pr-mode-alist'
-               and `pr-ps-printer-alist'), the variables pr-file-duplex and
-               pr-file-tumble are both set to nil.
+               through `inherits-from:' (see option `pr-ps-utility',
+               `pr-mode-alist' and `pr-ps-printer-alist'), the variables
+               pr-file-duplex and pr-file-tumble are both set to nil.
 
                Now when setting no-duplex-and-landscape is activated through
                `inherits-from:', the variable pr-file-landscape is set to nil
@@ -3692,7 +3694,7 @@ VI. Customization:
          "\n\n
 The printing interface buffer has the same functionality as the printing menu.
 The major difference is that the states (like sending PostScript generated to a
-file, n-up printing, etc.) are set and saved between priting buffer
+file, n-up printing, etc.) are set and saved between printing buffer
 activation.  Also, the landscape, duplex and tumble values are the same for
 PostScript file and directory/buffer/region/mode processing; using menu, there
 are different value sets for PostScript file and directory/buffer/region/mode
@@ -4611,7 +4613,7 @@ bottom."
 
 ;;;###autoload
 (defun pr-toggle-region ()
-  "Toggle auto region."
+  "Toggle whether the region is automagically detected."
   (interactive)
   (pr-toggle-region-menu t))
 
@@ -4667,7 +4669,7 @@ bottom."
   "Interactively select a PostScript utility."
   (interactive)
   (pr-menu-set-utility-title
-   (pr-complete-alist "Postscript utility"
+   (pr-complete-alist "PostScript utility"
                      pr-ps-utility-alist pr-ps-utility)))
 
 
@@ -4710,12 +4712,12 @@ Interactively, you have the following situations:
 
    M-x pr-ps-fast-fire RET
       The command prompts the user for a N-UP value and printing will
-      immediatelly be done using the current active printer.
+      immediately be done using the current active printer.
 
    C-u   M-x pr-ps-fast-fire RET
    C-u 0 M-x pr-ps-fast-fire RET
       The command prompts the user for a N-UP value and also for a current
-      PostScript printer, then printing will immediatelly be done using the new
+      PostScript printer, then printing will immediately be done using the new
       current active printer.
 
    C-u 1 M-x pr-ps-fast-fire RET
@@ -4736,7 +4738,7 @@ zero and the argument SELECT is treated as follows:
    If it's nil, send the image to the printer.
 
    If it's a list or an integer lesser or equal to zero, the command prompts
-   the user for a current PostScript printer, then printing will immediatelly
+   the user for a current PostScript printer, then printing will immediately
    be done using the new current active printer.
 
    If it's an integer equal to 1, the command prompts the user for a file name
@@ -4749,7 +4751,7 @@ zero and the argument SELECT is treated as follows:
    instead of sending it to the printer.
 
    If it's a symbol which it's defined in `pr-ps-printer-alist', it's the new
-   active printer and printing will immediatelly be done using the new active
+   active printer and printing will immediately be done using the new active
    printer.
 
    Otherwise, send the image to the printer.
@@ -4800,7 +4802,7 @@ Noninteractively, the argument SELECT-PRINTER is treated as follows:
    If it's nil, the printing is sent to the current active text printer.
 
    If it's a symbol which it's defined in `pr-txt-printer-alist', it's the new
-   active printer and printing will immediatelly be done using the new active
+   active printer and printing will immediately be done using the new active
    printer.
 
    If it's non-nil, the command prompts the user for a new active text printer.
@@ -5346,102 +5348,119 @@ If menu binding was not done, calls `pr-menu-bind'."
 
 
 (defun pr-toggle-file-duplex-menu (&optional no-menu)
+  "Toggle whether to print PostScript files in duplex mode."
   (interactive)
   (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil
             '("PostScript Print" "File") no-menu))
 
 
 (defun pr-toggle-file-tumble-menu (&optional no-menu)
+  "Toggle whether to print PostScript files in tumble mode."
   (interactive)
   (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil
             '("PostScript Print" "File") no-menu))
 
 
 (defun pr-toggle-file-landscape-menu (&optional no-menu)
+  "Toggle whether to print PostScript files in landscape orientation."
   (interactive)
   (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil
             '("PostScript Print" "File") no-menu))
 
 
 (defun pr-toggle-ghostscript-menu (&optional no-menu)
+  "Toggle whether to print using ghostscript."
   (interactive)
   (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript"
             'postscript-process 2 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-faces-menu (&optional no-menu)
+  "Toggle whether to print with face attributes."
   (interactive)
   (pr-toggle 'pr-faces-p "Printing with faces"
             'postscript-process 1 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-spool-menu (&optional no-menu)
+  "Toggle whether to spool printing in a buffer."
   (interactive)
   (pr-toggle 'pr-spool-p "Spooling printing"
             'postscript-process 0 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-duplex-menu (&optional no-menu)
+  "Toggle whether to generate PostScript for a two-sided printer."
   (interactive)
   (pr-toggle 'ps-spool-duplex "Printing duplex"
             'postscript-options 5 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-tumble-menu (&optional no-menu)
+  "Toggle how pages on opposite sides of a sheet are oriented."
   (interactive)
   (pr-toggle 'ps-spool-tumble "Tumble"
             'postscript-options 6 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-landscape-menu (&optional no-menu)
+  "Toggle whether to print in landscape mode."
   (interactive)
   (pr-toggle 'ps-landscape-mode "Landscape"
             'postscript-options 0 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-upside-down-menu (&optional no-menu)
+  "Toggle whether to print upside-down (that is, rotated by 180 degrees)."
   (interactive)
   (pr-toggle 'ps-print-upside-down "Upside-Down"
             'postscript-options 7 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-line-menu (&optional no-menu)
+  "Toggle whether to means print line numbers."
   (interactive)
   (pr-toggle 'ps-line-number "Line number"
             'postscript-options 3 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-zebra-menu (&optional no-menu)
+  "Toggle whether to print zebra stripes."
   (interactive)
   (pr-toggle 'ps-zebra-stripes "Zebra stripe"
             'postscript-options 4 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-header-menu (&optional no-menu)
+  "Toggle whether to print a header at the top of each page."
   (interactive)
   (pr-toggle 'ps-print-header "Print header"
             'postscript-options 1 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-header-frame-menu (&optional no-menu)
+  "Toggle whether to draw a gaudy frame around the header."
   (interactive)
   (pr-toggle 'ps-print-header-frame "Print header frame"
             'postscript-options 2 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-lock-menu (&optional no-menu)
+  "Toggle whether the menu is locked while selecting toggle options."
   (interactive)
   (pr-toggle 'pr-menu-lock "Menu lock"
             'printing 2 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-region-menu (&optional no-menu)
+  "Toggle whether the region is automagically detected."
   (interactive)
   (pr-toggle 'pr-auto-region "Auto region"
             'printing 0 12 'toggle nil no-menu))
 
 
 (defun pr-toggle-mode-menu (&optional no-menu)
+  "Toggle whether major-mode specific printing is preferred over normal printing."
   (interactive)
   (pr-toggle 'pr-auto-mode "Auto mode"
             'printing 1 12 'toggle nil no-menu))
@@ -6064,6 +6083,8 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
   (and pr-i-region                     ; let region activated
        (pr-keep-region-active)))
 
+(declare-function widget-field-action "wid-edit" (widget &optional _event))
+(declare-function widget-value-set "wid-edit" (widget value))
 
 (defun pr-insert-section-1 ()
   ;; 1. Print: