Add 2011 to FSF/AIST copyright years.
[bpt/emacs.git] / lisp / printing.el
index 5ab1c9b..60e9330 100644 (file)
@@ -1,16 +1,16 @@
 ;;; printing.el --- printing utilities
 
-;; Copyright (C) 2000, 2001, 2003, 2004, 2005,
-;;   2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+;;   2010, 2011  Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
-;; Version: 6.9.1
+;; Version: 6.9.3
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
-(defconst pr-version "6.9.1"
-  "printing.el, v 6.9.1 <2007/08/02 vinicius>
+(defconst pr-version "6.9.3"
+  "printing.el, v 6.9.3 <2007/12/09 vinicius>
 
 Please send all bug fixes and enhancements to
        Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -18,19 +18,18 @@ Please send all bug fixes and enhancements to
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify it under
-;; the terms of the GNU General Public License as published by the Free
-;; Software Foundation; either version 3, or (at your option) any later
-;; version.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
-;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY
-;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-;; details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
-;; You should have received a copy of the GNU General Public License along with
-;; GNU Emacs; see the file COPYING.  If not, write to the Free Software
-;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -70,7 +69,7 @@ Please send all bug fixes and enhancements to
 ;; `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'.
 ;; Please, see README file for ps-print installation instructions.
 ;;
-;; `printing' was inspired on:
+;; `printing' was inspired by:
 ;;
 ;;    print-nt.el            Frederic Corne <frederic.corne@erli.fr>
 ;;      Special printing functions for Windows NT
@@ -1093,6 +1092,58 @@ If SUFFIX is non-nil, add that at the end of the file name."
          (set-default-file-modes umask)))))
 
 
+(eval-when-compile
+  ;; User Interface --- declared here to avoid compiler warnings
+  (defvar pr-path-style)
+  (defvar pr-auto-region)
+  (defvar pr-menu-char-height)
+  (defvar pr-menu-char-width)
+  (defvar pr-menu-lock)
+  (defvar pr-ps-printer-alist)
+  (defvar pr-txt-printer-alist)
+  (defvar pr-ps-utility-alist)
+
+
+  ;; Internal fun alias to avoid compilation gripes
+  (defalias 'pr-menu-lookup            'ignore)
+  (defalias 'pr-menu-lock              'ignore)
+  (defalias 'pr-menu-alist             'ignore)
+  (defalias 'pr-even-or-odd-pages      'ignore)
+  (defalias 'pr-menu-get-item          'ignore)
+  (defalias 'pr-menu-set-item-name     'ignore)
+  (defalias 'pr-menu-set-utility-title 'ignore)
+  (defalias 'pr-menu-set-ps-title      'ignore)
+  (defalias 'pr-menu-set-txt-title     'ignore)
+  (defalias 'pr-region-active-p        'ignore)
+  (defalias 'pr-do-update-menus        'ignore)
+  (defalias 'pr-update-mode-line       'ignore)
+  (defalias 'pr-read-string            'ignore)
+  (defalias 'pr-set-keymap-parents     'ignore)
+  (defalias 'pr-keep-region-active     'ignore))
+
+
+;; Internal Vars --- defined here to avoid compiler warnings
+(defvar pr-menu-print-item "print"
+  "Non-nil means that menu binding was not done.
+
+Used by `pr-menu-bind' and `pr-update-menus'.")
+
+(defvar pr-ps-printer-menu-modified  t
+  "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.")
+
+(defvar pr-txt-printer-menu-modified t
+  "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.")
+
+(defvar pr-ps-utility-menu-modified t
+  "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.")
+
+(defconst pr-even-or-odd-alist
+  '((nil        . "Print All Pages")
+    (even-page  . "Print Even Pages")
+    (odd-page   . "Print Odd Pages")
+    (even-sheet . "Print Even Sheets")
+    (odd-sheet  . "Print Odd Sheets")))
+
 \f
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1102,11 +1153,11 @@ If SUFFIX is non-nil, add that at the end of the file name."
 (cond
  ((featurep 'xemacs)                   ; XEmacs
   ;; XEmacs
-  (defalias 'pr-f-set-keymap-parents 'set-keymap-parents)
-  (defalias 'pr-f-set-keymap-name    'set-keymap-name)
+  (defalias 'pr-set-keymap-parents 'set-keymap-parents)
+  (defalias 'pr-set-keymap-name    'set-keymap-name)
 
   ;; XEmacs
-  (defun pr-f-read-string (prompt initial history default)
+  (defun pr-read-string (prompt initial history default)
     (let ((str (read-string prompt initial)))
       (if (and str (not (string= str "")))
          str
@@ -1301,9 +1352,9 @@ If SUFFIX is non-nil, add that at the end of the file name."
   )
  (t                                    ; GNU Emacs
   ;; GNU Emacs
-  (defalias 'pr-f-set-keymap-parents 'set-keymap-parent)
-  (defalias 'pr-f-set-keymap-name    'ignore)
-  (defalias 'pr-f-read-string        'read-string)
+  (defalias 'pr-set-keymap-parents 'set-keymap-parent)
+  (defalias 'pr-set-keymap-name    'ignore)
+  (defalias 'pr-read-string        'read-string)
 
   ;; GNU Emacs
   (defvar deactivate-mark)
@@ -1324,11 +1375,17 @@ If SUFFIX is non-nil, add that at the end of the file name."
   (defun pr-menu-char-width ()
     (frame-char-width))
 
+  (defvar pr-menu-bar nil
+    "Specify Printing menu-bar entry.")
+
   ;; GNU Emacs
   ;; Menu binding
   ;; Replace existing "print" item by "Printing" item.
   ;; If you're changing this file, you'll load it a second,
   ;; third... time, but "print" item exists only in the first load.
+  (eval-when-compile
+    (require 'easymenu))               ; to avoid compilation gripes
+
   (eval-and-compile
     (cond
      ;; GNU Emacs 20
@@ -1393,7 +1450,7 @@ If SUFFIX is non-nil, add that at the end of the file name."
       )))
 
   (defvar pr-menu-position nil)
-  (defvar pr-menu-state nil)
+  (defvar pr-menu-state    nil)
 
   ;; GNU Emacs
   (defun pr-menu-lookup (path)
@@ -1546,6 +1603,35 @@ If SUFFIX is non-nil, add that at the end of the file name."
   ))                                   ; end cond featurep
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Internal Functions (I)
+
+
+(defun pr-dosify-file-name (path)
+  "Replace unix-style directory separator character with dos/windows one."
+  (interactive "sPath: ")
+  (if (eq pr-path-style 'windows)
+      (subst-char-in-string ?/ ?\\ path)
+    path))
+
+
+(defun pr-unixify-file-name (path)
+  "Replace dos/windows-style directory separator character with unix one."
+  (interactive "sPath: ")
+  (if (eq pr-path-style 'windows)
+      (subst-char-in-string ?\\ ?/ path)
+    path))
+
+
+(defun pr-standard-file-name (path)
+  "Ensure the proper directory separator depending on the OS.
+That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory
+separator; otherwise, ensure unix-style directory separator."
+  (if (or pr-cygwin-system ps-windows-system)
+      (subst-char-in-string ?/ ?\\ path)
+    (subst-char-in-string ?\\ ?/ path)))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Customization Functions
 
@@ -1579,7 +1665,7 @@ If SUFFIX is non-nil, add that at the end of the file name."
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User Interface (I)
+;; User Interface
 
 
 (defgroup printing nil
@@ -1587,7 +1673,7 @@ If SUFFIX is non-nil, add that at the end of the file name."
   :tag "Printing Utilities"
   :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
   :prefix "pr-"
-  :version "20"
+  :version "22.1"
   :group 'wp
   :group 'postscript)
 
@@ -1597,7 +1683,7 @@ If SUFFIX is non-nil, add that at the end of the file name."
           ps-windows-system)
       'windows
     'unix)
-  "*Specify which path style to use for external commands.
+  "Specify which path style to use for external commands.
 
 Valid values are:
 
@@ -1607,48 +1693,14 @@ Valid values are:
   :type '(choice :tag "Path style"
                 (const :tag "Windows 9x/NT Style (\\)" :value windows)
                 (const :tag "Unix Style (/)" :value unix))
-  :version "20"
   :group 'printing)
 
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Internal Functions (I)
-
-
-(defun pr-dosify-file-name (path)
-  "Replace unix-style directory separator character with dos/windows one."
-  (interactive "sPath: ")
-  (if (eq pr-path-style 'windows)
-      (subst-char-in-string ?/ ?\\ path)
-    path))
-
-
-(defun pr-unixify-file-name (path)
-  "Replace dos/windows-style directory separator character with unix one."
-  (interactive "sPath: ")
-  (if (eq pr-path-style 'windows)
-      (subst-char-in-string ?\\ ?/ path)
-    path))
-
-
-(defun pr-standard-file-name (path)
-  "Ensure the proper directory separator depending on the OS.
-That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory
-separator; otherwise, ensure unix-style directory separator."
-  (if (or pr-cygwin-system ps-windows-system)
-      (subst-char-in-string ?/ ?\\ path)
-    (subst-char-in-string ?\\ ?/ path)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User Interface (II)
-
-
 (defcustom pr-path-alist
   '((unix    PATH)
     (cygwin  PATH)
     (windows PATH))
-  "*Specify an alist for command paths.
+  "Specify an alist for command paths.
 
 It's used to find commands used for printing package, like gv, gs, gsview.exe,
 mpage, print.exe, etc.  See also `pr-command' function.
@@ -1719,12 +1771,11 @@ Examples:
                                :tag "Directory"
                                (string :value "")
                                (symbol :value symbol)))))
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-txt-name 'default
-  "*Specify a printer for printing a text file.
+  "Specify a printer for printing a text file.
 
 The printer name symbol should be defined on `pr-txt-printer-alist' (see it for
 documentation).
@@ -1734,7 +1785,6 @@ modified by other means (for example, a lisp function), use `pr-update-menus'
 function (see it for documentation) to update text printer menu."
   :type 'symbol
   :set 'pr-txt-name-custom-set
-  :version "20"
   :group 'printing)
 
 
@@ -1755,7 +1805,7 @@ function (see it for documentation) to update text printer menu."
   ;;      (PRN      ""          nil "PRN")
   ;;      (standard "redpr.exe" nil "")
   ;;      )
-  "*Specify an alist of all text printers (text printer database).
+  "Specify an alist of all text printers (text printer database).
 
 The alist element has the form:
 
@@ -1867,12 +1917,11 @@ Useful links:
                        (const :tag "None" nil)
                        string)))
   :set 'pr-alist-custom-set
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-ps-name 'default
-  "*Specify a printer for printing a PostScript file.
+  "Specify a printer for printing a PostScript file.
 
 This printer name symbol should be defined on `pr-ps-printer-alist' (see it for
 documentation).
@@ -1882,7 +1931,6 @@ modified by other means (for example, a lisp function), use `pr-update-menus'
 function (see it for documentation) to update PostScript printer menu."
   :type 'symbol
   :set 'pr-ps-name-custom-set
-  :version "20"
   :group 'printing)
 
 
@@ -1908,7 +1956,7 @@ function (see it for documentation) to update PostScript printer menu."
   ;;      (PRN      ""          nil ""    "PRN")
   ;;      (standard "redpr.exe" nil ""    "")
   ;;      )
-  "*Specify an alist for all PostScript printers (PostScript printer database).
+  "Specify an alist for all PostScript printers (PostScript printer database).
 
 The alist element has the form:
 
@@ -2155,7 +2203,6 @@ Useful links:
             (sexp :tag "Value")))
           ))
   :set 'pr-alist-custom-set
-  :version "20"
   :group 'printing)
 
 
@@ -2167,23 +2214,20 @@ Useful links:
      (file-name-as-directory
       (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
          (cond (ps-windows-system "c:/temp")
-               ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:")
                (t "/tmp")
                )))))
-  "*Specify a directory for temporary files during printing.
+  "Specify a directory for temporary files during printing.
 
 See also `pr-ps-temp-file' and `pr-file-modes'."
   :type '(directory :tag "Temporary Directory")
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-ps-temp-file "prspool-"
-  "*Specify PostScript temporary file name prefix.
+  "Specify PostScript temporary file name prefix.
 
 See also `pr-temp-dir' and `pr-file-modes'."
   :type '(file :tag "PostScript Temporary File Name")
-  :version "21"
   :group 'printing)
 
 
@@ -2191,13 +2235,12 @@ See also `pr-temp-dir' and `pr-file-modes'."
 ;; So, by default, only the session owner have permission to deal with files
 ;; generated by `printing'.
 (defcustom pr-file-modes ?\600
-  "*Specify the file permission bits for newly created files.
+  "Specify the file permission bits for newly created files.
 
 It should be an integer; only the low 9 bits are used.
 
 See also `pr-temp-dir' and `pr-ps-temp-file'."
   :type '(integer :tag "File Permission Bits")
-  :version "21.3"
   :group 'printing)
 
 
@@ -2205,7 +2248,7 @@ See also `pr-temp-dir' and `pr-ps-temp-file'."
   (if ps-windows-system
       "gsview32.exe"
     "gv")
-  "*Specify path and name of the gsview/gv utility.
+  "Specify path and name of the gsview/gv utility.
 
 See also `pr-path-alist'.
 
@@ -2239,7 +2282,6 @@ Useful links:
   `http://www.cs.wisc.edu/~ghost/macos/index.htm'
 "
   :type '(string :tag "Ghostview Utility")
-  :version "20"
   :group 'printing)
 
 
@@ -2247,7 +2289,7 @@ Useful links:
   (if ps-windows-system
       "gswin32.exe"
     "gs")
-  "*Specify path and name of the ghostscript utility.
+  "Specify path and name of the ghostscript utility.
 
 See also `pr-path-alist'.
 
@@ -2266,7 +2308,6 @@ Useful links:
   `http://www.cs.wisc.edu/~ghost/doc/printer.htm'
 "
   :type '(string :tag "Ghostscript Utility")
-  :version "20"
   :group 'printing)
 
 
@@ -2274,7 +2315,7 @@ Useful links:
   (if ps-windows-system
       '("-q -dNOPAUSE -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts")
     '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10"))
-  "*Specify ghostscript switches.  See the documentation on GS for more info.
+  "Specify ghostscript switches.  See the documentation on GS for more info.
 
 It's a list of strings, where each string is one or more ghostscript switches.
 
@@ -2309,7 +2350,6 @@ Useful links:
   `http://www.cs.wisc.edu/~ghost/doc/printer.htm'
 "
   :type '(repeat (string :tag "Ghostscript Switch"))
-  :version "20"
   :group 'printing)
 
 
@@ -2317,7 +2357,7 @@ Useful links:
   (if ps-windows-system
       "mswinpr2"
     "uniprint")
-  "*Specify the ghostscript device switch value (-sDEVICE=).
+  "Specify the ghostscript device switch value (-sDEVICE=).
 
 A note on the gs switches:
 
@@ -2326,12 +2366,11 @@ A note on the gs switches:
 See `pr-gs-switches' for documentation.
 See also `pr-ps-printer-alist'."
   :type '(string :tag "Ghostscript Device")
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-gs-resolution 300
-  "*Specify ghostscript resolution switch value (-r).
+  "Specify ghostscript resolution switch value (-r).
 
 A note on the gs switches:
 
@@ -2340,12 +2379,11 @@ A note on the gs switches:
 See `pr-gs-switches' for documentation.
 See also `pr-ps-printer-alist'."
   :type '(integer :tag "Ghostscript Resolution")
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-print-using-ghostscript nil
-  "*Non-nil means print using ghostscript.
+  "Non-nil means print using ghostscript.
 
 This is useful if you don't have a PostScript printer, so you could use the
 ghostscript to print a PostScript file.
@@ -2353,52 +2391,46 @@ ghostscript to print a PostScript file.
 In GNU or Unix system, if ghostscript is set as a PostScript filter, this
 variable should be nil."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-faces-p nil
-  "*Non-nil means print with face attributes."
+  "Non-nil means print with face attributes."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-spool-p nil
-  "*Non-nil means spool printing in a buffer."
+  "Non-nil means spool printing in a buffer."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-file-landscape nil
-  "*Non-nil means print PostScript file in landscape orientation."
+  "Non-nil means print PostScript file in landscape orientation."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-file-duplex nil
-  "*Non-nil means print PostScript file in duplex mode."
+  "Non-nil means print PostScript file in duplex mode."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-file-tumble nil
-  "*Non-nil means print PostScript file in tumble mode.
+  "Non-nil means print PostScript file in tumble mode.
 
 If tumble is off, produces a printing suitable for binding on the left or
 right.
 If tumble is on, produces a printing suitable for binding at the top or
 bottom."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-auto-region t
-  "*Non-nil means region is automagically detected.
+  "Non-nil means region is automagically detected.
 
 Note that this will only work if you're using transient mark mode.
 
@@ -2406,19 +2438,17 @@ When this variable is non-nil, the `*-buffer*' commands will behave like
 `*-region*' commands, that is, `*-buffer*' commands will print only the region
 marked instead of all buffer."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (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 prefered 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,
 `*-buffer*' commands will print the current buffer and `*-region*' commands
 will print the current region."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
@@ -2480,7 +2510,7 @@ will print the current region."
      nil
      )
     )
-  "*Specify an alist for a major-mode and printing functions.
+  "Specify an alist for a major-mode and printing functions.
 
 To customize a major mode printing, just declare the customization in
 `pr-mode-alist' and invoke some of `*-mode*' commands.  An example for major
@@ -2619,12 +2649,11 @@ DEFAULT         It's a way to set default values when this entry is selected.
              (variable :tag "Other"))
             (sexp :tag "Value")))
           ))
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-ps-utility 'mpage
-  "*Specify PostScript utility symbol.
+  "Specify PostScript utility symbol.
 
 This utility symbol should be defined on `pr-ps-utility-alist' (see it for
 documentation).
@@ -2637,7 +2666,6 @@ NOTE: Don't forget to download and install the utilities declared on
       `pr-ps-utility-alist'."
   :type '(symbol :tag "PS File Utility")
   :set 'pr-ps-utility-custom-set
-  :version "20"
   :group 'printing)
 
 
@@ -2656,7 +2684,7 @@ NOTE: Don't forget to download and install the utilities declared on
   ;;    '((psnup "c:/psutils/psnup" ("-q") "-P%s" "-%d" "-l" nil  nil " " nil
   ;;             (pr-file-duplex . nil) (pr-file-tumble . nil))
   ;;      )
-  "*Specify an alist for PostScript utility processing (PS utility database).
+  "Specify an alist for PostScript utility processing (PS utility database).
 
 The alist element has the form:
 
@@ -2850,40 +2878,36 @@ Useful links:
                  (sexp :tag "Value")))
                ))
   :set 'pr-alist-custom-set
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-menu-lock t
-  "*Non-nil means menu is locked while selecting toggle options.
+  "Non-nil means menu is locked while selecting toggle options.
 
 See also `pr-menu-char-height' and `pr-menu-char-width'."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-menu-char-height (pr-menu-char-height)
-  "*Specify menu char height in pixels.
+  "Specify menu char height in pixels.
 
 This variable is used to guess which vertical position should be locked the
 menu, so don't forget to adjust it if menu position is not ok.
 
 See also `pr-menu-lock' and `pr-menu-char-width'."
   :type 'integer
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-menu-char-width (pr-menu-char-width)
-  "*Specify menu char width in pixels.
+  "Specify menu char width in pixels.
 
 This variable is used to guess which horizontal position should be locked the
 menu, so don't forget to adjust it if menu position is not ok.
 
 See also `pr-menu-lock' and `pr-menu-char-height'."
   :type 'integer
-  :version "20"
   :group 'printing)
 
 
@@ -2893,7 +2917,7 @@ See also `pr-menu-lock' and `pr-menu-char-height'."
      (pr-file-duplex . nil)            ; settings
      (pr-file-tumble . nil))
     )
-  "*Specify an alist for settings in general.
+  "Specify an alist for settings in general.
 
 The elements have the following form:
 
@@ -3000,13 +3024,12 @@ SETTING         It's a cons like:
              (variable :tag "Other"))
             (sexp :tag "Value")))
           ))
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-visible-entry-list
   '(postscript text postscript-options postscript-process printing help)
-  "*Specify a list of Printing menu visible entries.
+  "Specify a list of Printing menu visible entries.
 
 Valid values with the corresponding menu parts are:
 
@@ -3054,24 +3077,22 @@ Any other value is ignored."
                         (const postscript-process)
                         (const printing)
                         (const help)))
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-delete-temp-file t
-  "*Non-nil means delete temporary files.
+  "Non-nil means delete temporary files.
 
 Set `pr-delete-temp-file' to nil, if the following message (or a similar)
 happens when printing:
 
    Error: could not open \"c:\\temp\\prspool.ps\" for reading."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-list-directory nil
-  "*Non-nil means list directory when processing a directory.
+  "Non-nil means list directory when processing a directory.
 
 That is, any subdirectories (and the superdirectory) of the directory (given as
 argument of functions below) are also printed (as dired-mode listings).
@@ -3080,39 +3101,35 @@ It's used by `pr-ps-directory-preview', `pr-ps-directory-using-ghostscript',
 `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory'
 and `pr-txt-directory'."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-buffer-name "*Printing Interface*"
-  "*Specify the name of the buffer interface for printing package.
+  "Specify the name of the buffer interface for printing package.
 
 It's used by `pr-interface'."
   :type 'string
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-buffer-name-ignore
   (list (regexp-quote pr-buffer-name)  ; ignore printing interface buffer
        "^ .*$")                        ; ignore invisible buffers
-  "*Specify a regexp list for buffer names to be ignored in interface buffer.
+  "Specify a regexp list for buffer names to be ignored in interface buffer.
 
 NOTE: Case is important for matching, that is, `case-fold-search' is always
       nil.
 
 It's used by `pr-interface'."
   :type '(repeat (regexp :tag "Buffer Name Regexp"))
-  :version "20"
   :group 'printing)
 
 
 (defcustom pr-buffer-verbose t
-  "*Non-nil means to be verbose when editing a field in interface buffer.
+  "Non-nil means to be verbose when editing a field in interface buffer.
 
 It's used by `pr-interface'."
   :type 'boolean
-  :version "20"
   :group 'printing)
 
 
@@ -3155,10 +3172,6 @@ See `pr-ps-printer-alist'.")
 See `pr-ps-printer-alist'.")
 
 
-(defvar pr-menu-bar nil
-  "Specify Printing menu-bar entry.")
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Macros
 
@@ -3438,20 +3451,9 @@ See `pr-ps-printer-alist'.")
       )))
 
 
-(defvar pr-menu-print-item "print"
-  "Non-nil means that menu binding was not done.
-
-Used by `pr-menu-bind' and `pr-update-menus'.")
-
-
 (defun pr-menu-bind ()
   "Install `printing' menu in the menubar.
-
-On Emacs 20, it replaces the Tools/Print menu by Tools/Printing menu.
-
-On Emacs 21 and 22, it replaces the File/Print* menu entries by File/Print
-menu.
-
+This replaces the File/Print* menu entries with a File/Print sub-menu.
 Calls `pr-update-menus' to adjust menus."
   (interactive)
   (pr-global-menubar pr-menu-spec)
@@ -3946,8 +3948,7 @@ If BUFFER is nil, the current buffer is used for printing.
 
 For more information, type \\[pr-interface-help]."
   (interactive)
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
+  (with-current-buffer (or buffer (current-buffer))
     (pr-create-interface)))
 
 
@@ -4450,8 +4451,7 @@ image in a file with that name."
         (if (string= pr-ps-command "")
             ;; default action
             (let ((ps-spool-buffer (get-buffer-create ps-spool-buffer-name)))
-              (save-excursion
-                (set-buffer ps-spool-buffer)
+              (with-current-buffer ps-spool-buffer
                 (erase-buffer)
                 (insert-file-contents-literally file))
               (pr-despool-print))
@@ -4949,11 +4949,10 @@ Or choose the menu option Printing/Show Settings/lpr."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; mh-e (adapted from mh-e-init.el -- Tom Vogels <tov@ece.cmu.edu>)
 
-
-(defalias 'pr-mh-get-msg-num 'mh-get-msg-num)
-(defalias 'pr-mh-show 'mh-show)
-(defalias 'pr-mh-start-of-uncleaned-message 'mh-start-of-uncleaned-message)
-(defvar mh-show-buffer nil)
+(declare-function mh-get-msg-num "mh-utils" (error-if-no-message))
+(declare-function mh-show "mh-show" (&optional message redisplay-flag))
+(declare-function mh-start-of-uncleaned-message "mh-show" ())
+(defvar mh-show-buffer)
 
 
 (defun pr-article-date ()
@@ -4969,11 +4968,11 @@ Return only the dayname, if present, weekday, month, and year."
 
 (defun pr-mh-current-message ()
   "Go to mh-inbox current message."
-  (let ((msg (or (pr-mh-get-msg-num nil) 0)))
-    (pr-mh-show)
+  (let ((msg (or (mh-get-msg-num nil) 0)))
+    (mh-show)
     (set-buffer mh-show-buffer)
     (goto-char (point-min))
-    (pr-mh-start-of-uncleaned-message)
+    (mh-start-of-uncleaned-message)
     (message "Printing message %d" msg)))
 
 
@@ -5022,8 +5021,7 @@ Return only the dayname, if present, weekday, month, and year."
                      (symbol-value summary-buffer))
                 (symbol-value summary-default))))
     (and (get-buffer buf)
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (pr-mode-print n-up filename header-list)))))
 
 
@@ -5033,8 +5031,7 @@ Return only the dayname, if present, weekday, month, and year."
                      (symbol-value summary-buffer))
                 (symbol-value summary-default))))
     (and (get-buffer buf)
-        (save-excursion
-          (set-buffer buf)
+        (with-current-buffer buf
           (pr-mode-lpr header-list)))))
 
 
@@ -5195,9 +5192,9 @@ See `pr-visible-entry-alist'.")
 
 If FORCE is non-nil, update menus doesn't matter if `pr-ps-printer-alist',
 `pr-txt-printer-alist' or `pr-ps-utility-alist' were modified or not;
-otherwise, update PostScript printer menu iff `pr-ps-printer-menu-modified' is
-non-nil, update text printer menu iff `pr-txt-printer-menu-modified' is
-non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
+otherwise, update PostScript printer menu if `pr-ps-printer-menu-modified' is
+non-nil, update text printer menu if `pr-txt-printer-menu-modified' is
+non-nil, and update PostScript File menus if `pr-ps-utility-menu-modified' is
 non-nil.
 
 If menu binding was not done, calls `pr-menu-bind'."
@@ -5214,22 +5211,6 @@ If menu binding was not done, calls `pr-menu-bind'."
     (pr-do-update-menus force)))
 
 
-(defvar pr-ps-printer-menu-modified  t
-  "Non-nil means `pr-ps-printer-alist' was modified and we need to update menu.")
-(defvar pr-txt-printer-menu-modified t
-  "Non-nil means `pr-txt-printer-alist' was modified and we need to update menu.")
-(defvar pr-ps-utility-menu-modified t
-  "Non-nil means `pr-ps-utility-alist' was modified and we need to update menu.")
-
-
-(defconst pr-even-or-odd-alist
-  '((nil        . "Print All Pages")
-    (even-page  . "Print Even Pages")
-    (odd-page   . "Print Odd Pages")
-    (even-sheet . "Print Even Sheets")
-    (odd-sheet  . "Print Odd Sheets")))
-
-
 (defun pr-menu-create (name alist var-sym fun entry index)
   (cons name
        (mapcar
@@ -5311,15 +5292,15 @@ If menu binding was not done, calls `pr-menu-bind'."
 
 (defun pr-eval-local-alist (alist)
   (let (local-list)
-    (mapcar #'(lambda (option)
-               (let ((var-sym (car option))
-                     (value   (cdr option)))
-                 (setq local-list
-                       (if (eq var-sym 'inherits-from:)
-                           (nconc (pr-eval-setting-alist value) local-list)
-                         (set (make-local-variable var-sym) (eval value))
-                         (cons var-sym local-list)))))
-           alist)
+    (mapc #'(lambda (option)
+             (let ((var-sym (car option))
+                   (value   (cdr option)))
+               (setq local-list
+                     (if (eq var-sym 'inherits-from:)
+                         (nconc (pr-eval-setting-alist value) local-list)
+                       (set (make-local-variable var-sym) (eval value))
+                       (cons var-sym local-list)))))
+         alist)
     local-list))
 
 
@@ -5341,7 +5322,7 @@ If menu binding was not done, calls `pr-menu-bind'."
                  (setq local-list
                        (pr-eval-setting-alist inherits global
                                               (cons inherits old)))))
-          (mapcar
+          (mapc
            (cond ((not local)          ; global settings
                   #'(lambda (option)
                       (let ((var-sym (car option)))
@@ -5516,7 +5497,7 @@ If menu binding was not done, calls `pr-menu-bind'."
 (defun pr-show-setup (settings buffer-name)
   (with-output-to-temp-buffer buffer-name
     (princ settings)
-    (print-help-return-message)))
+    (help-print-return-message)))
 
 
 (defun pr-complete-alist (prompt alist default)
@@ -5643,8 +5624,7 @@ If menu binding was not done, calls `pr-menu-bind'."
        status)
     (setq args (pr-remove-nil-from-list args))
     ;; *Printing Command Output* == show command & args
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char (point-max))
       (insert (format "%s %S\n" cmd args)))
     ;; *Printing Command Output* == show any return message from command
@@ -5655,8 +5635,7 @@ If menu binding was not done, calls `pr-menu-bind'."
             ((quit error)
              (error-message-string data)))))
     ;; *Printing Command Output* == show exit status
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (goto-char (point-max))
       (insert (format "Exit status: %s\n\n" status)))
     ;; message if error status
@@ -5726,7 +5705,7 @@ If menu binding was not done, calls `pr-menu-bind'."
   (save-match-data
     (let* ((fmt-prompt "%s[%s] N-up printing (default 1): ")
           (prompt "")
-          (str (pr-f-read-string (format fmt-prompt prompt mess) "1" nil "1"))
+          (str (pr-read-string (format fmt-prompt prompt mess) "1" nil "1"))
           int)
       (while (if (string-match "^\\s *[0-9]+$" str)
                 (setq int (string-to-number str)
@@ -5736,7 +5715,7 @@ If menu binding was not done, calls `pr-menu-bind'."
               (setq prompt "Invalid integer syntax; "))
        (ding)
        (setq str
-             (pr-f-read-string (format fmt-prompt prompt mess) str nil "1")))
+             (pr-read-string (format fmt-prompt prompt mess) str nil "1")))
       int)))
 
 
@@ -5761,7 +5740,7 @@ If menu binding was not done, calls `pr-menu-bind'."
 
 
 (defun pr-interactive-regexp (mess)
-  (pr-f-read-string (format "[%s] File regexp to print: " mess) "" nil ""))
+  (pr-read-string (format "[%s] File regexp to print: " mess) "" nil ""))
 
 
 (defun pr-interactive-dir-args (mess)
@@ -5849,8 +5828,7 @@ If menu binding was not done, calls `pr-menu-bind'."
          (blist (buffer-list))
          found)
       (while (and (not found) blist)
-       (save-excursion
-         (set-buffer (car blist))
+       (with-current-buffer (car blist)
          (and (eq major-mode 'dired-mode)
               (save-excursion
                 (goto-char (point-min))
@@ -5874,9 +5852,8 @@ If menu binding was not done, calls `pr-menu-bind'."
                         pop-up-frames)
                     (and (or buffer
                              (file-readable-p file))
-                         (save-excursion
-                           (set-buffer (or buffer
-                                           (find-file-noselect file)))
+                         (with-current-buffer (or buffer
+                                                   (find-file-noselect file))
                            (funcall fun)
                            (or buffer
                                (kill-buffer (current-buffer))))))))
@@ -6015,7 +5992,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Printing Interface (inspired on ps-print-interface.el)
+;; Printing Interface (inspired by ps-print-interface.el)
 
 
 (eval-when-compile
@@ -6045,19 +6022,19 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
   "Keymap for pr-interface.")
 
 (unless pr-interface-map
-  (setq pr-interface-map (make-sparse-keymap))
-  (cond ((featurep 'xemacs)            ; XEmacs
-        (pr-f-set-keymap-parents pr-interface-map (list widget-keymap))
-        (pr-f-set-keymap-name pr-interface-map 'pr-interface-map))
-       (t                              ; GNU Emacs
-        (pr-f-set-keymap-parents pr-interface-map widget-keymap)))
-  (define-key pr-interface-map "q" 'pr-interface-quit)
-  (define-key pr-interface-map "?" 'pr-interface-help))
+  (let ((map (make-sparse-keymap)))
+    (cond ((featurep 'xemacs)          ; XEmacs
+          (pr-set-keymap-parents map (list widget-keymap))
+          (pr-set-keymap-name    map 'pr-interface-map))
+         (t                            ; GNU Emacs
+          (pr-set-keymap-parents map widget-keymap)))
+    (define-key map "q" 'pr-interface-quit)
+    (define-key map "?" 'pr-interface-help)
+    (setq pr-interface-map map)))
 
 
 (defmacro pr-interface-save (&rest body)
-  `(save-excursion
-     (set-buffer pr-i-buffer)
+  `(with-current-buffer pr-i-buffer
      ,@body))
 
 
@@ -6703,5 +6680,4 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
 (provide 'printing)
 
 
-;; arch-tag: 9ce9ac3f-0f60-4370-900b-1943215d9d18
 ;;; printing.el ends here