Add 2011 to FSF/AIST copyright years.
[bpt/emacs.git] / lisp / printing.el
index 6de2274..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.2
+;; Version: 6.9.3
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
-(defconst pr-version "6.9.2"
-  "printing.el, v 6.9.2 <2007/10/26 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
@@ -1118,8 +1117,8 @@ If SUFFIX is non-nil, add that at the end of the file name."
   (defalias 'pr-region-active-p        'ignore)
   (defalias 'pr-do-update-menus        'ignore)
   (defalias 'pr-update-mode-line       'ignore)
-  (defalias 'pr-f-read-string          'ignore)
-  (defalias 'pr-f-set-keymap-parents   'ignore)
+  (defalias 'pr-read-string            'ignore)
+  (defalias 'pr-set-keymap-parents     'ignore)
   (defalias 'pr-keep-region-active     'ignore))
 
 
@@ -1154,11 +1153,11 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
 (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
@@ -1353,9 +1352,9 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
   )
  (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)
@@ -1451,7 +1450,7 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
       )))
 
   (defvar pr-menu-position nil)
-  (defvar pr-menu-state nil)
+  (defvar pr-menu-state    nil)
 
   ;; GNU Emacs
   (defun pr-menu-lookup (path)
@@ -1684,7 +1683,7 @@ separator; otherwise, ensure unix-style directory separator."
           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:
 
@@ -1701,7 +1700,7 @@ Valid values are:
   '((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.
@@ -1776,7 +1775,7 @@ Examples:
 
 
 (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).
@@ -1806,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:
 
@@ -1922,7 +1921,7 @@ Useful links:
 
 
 (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).
@@ -1957,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:
 
@@ -2215,10 +2214,9 @@ 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")
@@ -2226,7 +2224,7 @@ See also `pr-ps-temp-file' and `pr-file-modes'."
 
 
 (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")
@@ -2237,7 +2235,7 @@ 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.
 
@@ -2250,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'.
 
@@ -2291,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'.
 
@@ -2317,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.
 
@@ -2359,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:
 
@@ -2372,7 +2370,7 @@ See also `pr-ps-printer-alist'."
 
 
 (defcustom pr-gs-resolution 300
-  "*Specify ghostscript resolution switch value (-r).
+  "Specify ghostscript resolution switch value (-r).
 
 A note on the gs switches:
 
@@ -2385,7 +2383,7 @@ See also `pr-ps-printer-alist'."
 
 
 (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.
@@ -2397,31 +2395,31 @@ variable should be nil."
 
 
 (defcustom pr-faces-p nil
-  "*Non-nil means print with face attributes."
+  "Non-nil means print with face attributes."
   :type 'boolean
   :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
   :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
   :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
   :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.
@@ -2432,7 +2430,7 @@ bottom."
 
 
 (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.
 
@@ -2444,7 +2442,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 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,
@@ -2512,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
@@ -2655,7 +2653,7 @@ DEFAULT           It's a way to set default values when this entry is selected.
 
 
 (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).
@@ -2686,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:
 
@@ -2884,7 +2882,7 @@ Useful links:
 
 
 (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
@@ -2892,7 +2890,7 @@ See also `pr-menu-char-height' and `pr-menu-char-width'."
 
 
 (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.
@@ -2903,7 +2901,7 @@ See also `pr-menu-lock' and `pr-menu-char-width'."
 
 
 (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.
@@ -2919,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:
 
@@ -3031,7 +3029,7 @@ SETTING           It's a cons like:
 
 (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:
 
@@ -3083,7 +3081,7 @@ Any other value is ignored."
 
 
 (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:
@@ -3094,7 +3092,7 @@ happens when 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).
@@ -3107,7 +3105,7 @@ and `pr-txt-directory'."
 
 
 (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
@@ -3117,7 +3115,7 @@ It's used by `pr-interface'."
 (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.
@@ -3128,7 +3126,7 @@ It's used by `pr-interface'."
 
 
 (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
@@ -3455,12 +3453,7 @@ See `pr-ps-printer-alist'.")
 
 (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)
@@ -3955,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)))
 
 
@@ -4459,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))
@@ -4958,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 ()
@@ -4978,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)))
 
 
@@ -5031,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)))))
 
 
@@ -5042,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)))))
 
 
@@ -5509,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)
@@ -5636,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
@@ -5648,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
@@ -5719,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)
@@ -5729,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)))
 
 
@@ -5754,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)
@@ -5842,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))
@@ -5867,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))))))))
@@ -6008,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
@@ -6038,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))
 
 
@@ -6696,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