changeset 58204:687bb63efa9d

interactive-p & file permission bits
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Sun, 14 Nov 2004 00:47:34 +0000
parents cd5849662239
children fd88ccc2e4cf
files lisp/ChangeLog lisp/printing.el
diffstat 2 files changed, 538 insertions(+), 520 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 14 00:37:12 2004 +0000
+++ b/lisp/ChangeLog	Sun Nov 14 00:47:34 2004 +0000
@@ -1,3 +1,42 @@
+2004-11-13  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+	* printing.el: Doc fix.  Insert :version tag into all defcustom.
+	Handle interactive-p as is recommended in Emacs Lisp Reference.  Set
+	the file permission bits for newly created files.  Reported by Glenn
+	Morris <gmorris+emacs@ast.cam.ac.uk>.  The printing menu
+	specification (in `pr-menu-spec') was merged.  Suggested by Stefan
+	Monnier <monnier@iro.umontreal.ca>.
+	(pr-version): New version number (6.8.3).
+	(pr-file-modes): New option.
+	(pr-interactive-p): New var.
+	(pr-save-interactive, pr-save-file-modes): New macros.
+	(pr-setup): Code fix.
+	(pr-menu-spec): Menu specification merged.
+	(pr-call-process, pr-text2ps): Set file permission bits.
+	(pr-despool-print): Set file permission bits.  Handle interactive-p as
+	is recommended.
+	(pr-interface, pr-ps-directory-preview)
+	(pr-ps-directory-using-ghostscript, pr-ps-directory-print)
+	(pr-ps-directory-ps-print, pr-ps-buffer-preview)
+	(pr-ps-buffer-using-ghostscript, pr-ps-buffer-print)
+	(pr-ps-buffer-ps-print, pr-ps-region-preview)
+	(pr-ps-region-using-ghostscript, pr-ps-region-print)
+	(pr-ps-region-ps-print, pr-ps-mode-preview)
+	(pr-ps-mode-using-ghostscript, pr-ps-mode-print, pr-ps-mode-ps-print)
+	(pr-printify-directory, pr-txt-directory, pr-despool-preview)
+	(pr-despool-using-ghostscript, pr-despool-ps-print)
+	(pr-ps-file-up-preview, pr-ps-file-using-ghostscript)
+	(pr-ps-file-up-ps-print, pr-toggle-file-duplex, pr-toggle-file-tumble)
+	(pr-toggle-file-landscape, pr-toggle-ghostscript, pr-toggle-faces)
+	(pr-toggle-spool, pr-toggle-duplex, pr-toggle-tumble)
+	(pr-toggle-landscape, pr-toggle-upside-down, pr-toggle-line)
+	(pr-toggle-zebra, pr-toggle-header, pr-toggle-header-frame)
+	(pr-toggle-lock, pr-toggle-region, pr-toggle-mode, pr-ps-name)
+	(pr-txt-name, pr-ps-utility, pr-ps-fast-fire, pr-txt-fast-fire)
+	(pr-menu-lock, pr-update-menus, pr-ps-utility-args)
+	(pr-set-outfilename, pr-interface-ps-print, pr-interface-preview):
+	Handle interactive-p as is recommended.
+
 2004-11-13  Daniel Pfeiffer  <occitan@esperanto.org>
 
 	* progmodes/cc-mode.el (c-basic-common-initc-font-lock-init)
--- a/lisp/printing.el	Sun Nov 14 00:37:12 2004 +0000
+++ b/lisp/printing.el	Sun Nov 14 00:47:34 2004 +0000
@@ -5,13 +5,13 @@
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
-;; Time-stamp: <2004/11/11 23:54:13 vinicius>
+;; Time-stamp: <2004/11/13 21:36:38 vinicius>
 ;; Keywords: wp, print, PostScript
-;; Version: 6.8.2
+;; Version: 6.8.3
 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
 
-(defconst pr-version "6.8.2"
-  "printing.el, v 6.8.2 <2004/11/11 vinicius>
+(defconst pr-version "6.8.3"
+  "printing.el, v 6.8.3 <2004/11/13 vinicius>
 
 Please send all bug fixes and enhancements to
 	Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -440,15 +440,19 @@
 ;;
 ;; Current global keyboard mapping for GNU Emacs is:
 ;;
-;;    (global-set-key [print]   'pr-ps-fast-fire)
-;;    (global-set-key [M-print] 'pr-ps-mode-using-ghostscript)
-;;    (global-set-key [C-print] 'pr-txt-fast-fire)
+;;    (global-set-key [print]     'pr-ps-fast-fire)
+;;    (global-set-key [M-print]   'pr-ps-mode-using-ghostscript)
+;;    (global-set-key [S-print]   'pr-ps-mode-using-ghostscript)
+;;    (global-set-key [C-print]   'pr-txt-fast-fire)
+;;    (global-set-key [C-M-print] 'pr-txt-fast-fire)
 ;;
 ;; And for XEmacs is:
 ;;
-;;    (global-set-key 'f22           'pr-ps-fast-fire)
-;;    (global-set-key '(meta f22)    'pr-ps-mode-using-ghostscript)
-;;    (global-set-key '(control f22) 'pr-txt-fast-fire)
+;;    (global-set-key 'f22                'pr-ps-fast-fire)
+;;    (global-set-key '(meta f22)         'pr-ps-mode-using-ghostscript)
+;;    (global-set-key '(shift f22)        'pr-ps-mode-using-ghostscript)
+;;    (global-set-key '(control f22)      'pr-txt-fast-fire)
+;;    (global-set-key '(control meta f22) 'pr-txt-fast-fire)
 ;;
 ;; As a suggestion of global keyboard mapping for some `printing' commands:
 ;;
@@ -486,6 +490,9 @@
 ;;
 ;; `pr-ps-temp-file'		Specify PostScript temporary file name.
 ;;
+;; `pr-file-modes'		Specify the file permission bits for newly
+;;				created files.
+;;
 ;; `pr-gv-command'		Specify path and name of the gsview/gv
 ;;				utility.
 ;;
@@ -943,6 +950,9 @@
 ;; Acknowledgments
 ;; ---------------
 ;;
+;; Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for GNU Emacs and XEmacs
+;; printing menu (in `pr-menu-spec') merging suggestion.
+;;
 ;; Thanks to Lennart Borgman <lennart.borgman.073@student.lu.se> for gsprint
 ;; suggestion (see tip 5 in section Tips).
 ;;
@@ -1119,6 +1129,7 @@
   :type '(choice :tag "Path style"
 		 (const :tag "Windows 9x/NT Style (\\)" :value windows)
 		 (const :tag "Unix Style (/)" :value unix))
+  :version "20"
   :group 'printing)
 
 
@@ -1230,6 +1241,7 @@
 				:tag "Directory"
 				(string :value "")
 				(symbol :value symbol)))))
+  :version "20"
   :group 'printing)
 
 
@@ -1244,6 +1256,7 @@
 function (see it for documentation) to update text printer menu."
   :type 'symbol
   :set 'pr-txt-name-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -1356,6 +1369,7 @@
 			(const :tag "None" nil)
 			string)))
   :set 'pr-alist-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -1370,6 +1384,7 @@
 function (see it for documentation) to update PostScript printer menu."
   :type 'symbol
   :set 'pr-ps-name-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -1564,6 +1579,7 @@
 	     (sexp :tag "Value")))
 	   ))
   :set 'pr-alist-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -1578,14 +1594,34 @@
 		((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.ps"
-  "*Specify PostScript temporary file name."
+  "*Specify PostScript temporary file name.
+
+See also `pr-temp-dir' and `pr-file-modes'."
   :type '(file :tag "PostScript Temporary File Name")
+  :version "20"
+  :group 'printing)
+
+
+;; It uses 0600 as default instead of (default-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.
+
+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)
 
 
@@ -1597,6 +1633,7 @@
 
 See also `pr-path-alist'."
   :type '(string :tag "Ghostview Utility")
+  :version "20"
   :group 'printing)
 
 
@@ -1608,6 +1645,7 @@
 
 See also `pr-path-alist'."
   :type '(string :tag "Ghostscript Utility")
+  :version "20"
   :group 'printing)
 
 
@@ -1638,6 +1676,7 @@
      located in the same directory as gswin32.exe.
    - for brief documentation, type: gswin32.exe -h"
   :type '(repeat (string :tag "Ghostscript Switch"))
+  :version "20"
   :group 'printing)
 
 
@@ -1654,6 +1693,7 @@
 See `pr-gs-switches' for documentation.
 See also `pr-ps-printer-alist'."
   :type '(string :tag "Ghostscript Device")
+  :version "20"
   :group 'printing)
 
 
@@ -1667,6 +1707,7 @@
 See `pr-gs-switches' for documentation.
 See also `pr-ps-printer-alist'."
   :type '(integer :tag "Ghostscript Resolution")
+  :version "20"
   :group 'printing)
 
 
@@ -1679,30 +1720,35 @@
 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."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
 (defcustom pr-spool-p nil
   "*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."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
 (defcustom pr-file-duplex nil
   "*Non-nil means print PostScript file in duplex mode."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -1714,6 +1760,7 @@
 If tumble is on, produces a printing suitable for binding at the top or
 bottom."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -1726,6 +1773,7 @@
 `*-region*' commands, that is, `*-buffer*' commands will print only the region
 marked instead of all buffer."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -1737,6 +1785,7 @@
 `*-buffer*' commands will print the current buffer and `*-region*' commands
 will print the current region."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -1937,6 +1986,7 @@
 	      (variable :tag "Other"))
 	     (sexp :tag "Value")))
 	   ))
+  :version "20"
   :group 'printing)
 
 
@@ -1954,6 +2004,7 @@
       `pr-ps-utility-alist'."
   :type '(symbol :tag "PS File Utility")
   :set 'pr-ps-utility-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -2138,6 +2189,7 @@
 		  (sexp :tag "Value")))
 		))
   :set 'pr-alist-custom-set
+  :version "20"
   :group 'printing)
 
 
@@ -2146,6 +2198,7 @@
 
 See also `pr-menu-char-height' and `pr-menu-char-width'."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -2161,6 +2214,7 @@
 
 See also `pr-menu-lock' and `pr-menu-char-width'."
   :type 'integer
+  :version "20"
   :group 'printing)
 
 
@@ -2176,6 +2230,7 @@
 
 See also `pr-menu-lock' and `pr-menu-char-height'."
   :type 'integer
+  :version "20"
   :group 'printing)
 
 
@@ -2292,6 +2347,7 @@
 	      (variable :tag "Other"))
 	     (sexp :tag "Value")))
 	   ))
+  :version "20"
   :group 'printing)
 
 
@@ -2345,6 +2401,7 @@
 			 (const postscript-process)
 			 (const printing)
 			 (const help)))
+  :version "20"
   :group 'printing)
 
 
@@ -2356,6 +2413,7 @@
 
    Error: could not open \"c:\\temp\\prspool.ps\" for reading."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -2369,6 +2427,7 @@
 `pr-ps-directory-print', `pr-ps-directory-ps-print', `pr-printify-directory'
 and `pr-txt-directory'."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -2377,6 +2436,7 @@
 
 It's used by `pr-interface'."
   :type 'string
+  :version "20"
   :group 'printing)
 
 
@@ -2390,6 +2450,7 @@
 
 It's used by `pr-interface'."
   :type '(repeat (regexp :tag "Buffer Name Regexp"))
+  :version "20"
   :group 'printing)
 
 
@@ -2398,6 +2459,7 @@
 
 It's used by `pr-interface'."
   :type 'boolean
+  :version "20"
   :group 'printing)
 
 
@@ -2445,6 +2507,32 @@
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Macros
+
+
+(defvar pr-interactive-p nil
+  "Save the `interactive-p' result value.
+
+It's used by `pr-save-interactive' (which see).")
+
+
+(defmacro pr-save-interactive (&rest body)
+  "Save the `interactive-p' result value using `let'.
+
+It uses `pr-interactive-p' var (which see)."
+  `(let ((pr-interactive-p (or pr-interactive-p (interactive-p))))
+     ,@body))
+
+
+(defmacro pr-save-file-modes (&rest body)
+  "Set temporally file modes to `pr-file-modes'."
+  `(let ((pr--default-file-modes (default-file-modes)))	; save default
+     (set-default-file-modes pr-file-modes)
+     ,@body
+     (set-default-file-modes pr--default-file-modes))) ; restore default
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Keys & Menus
 
 
@@ -2489,33 +2577,46 @@
 
 
   (defconst pr-menu-spec
-    (cond
-     ((eq ps-print-emacs-type 'emacs)	; GNU Emacs
-      '(
+    ;; Menu mapping:
+    ;;   unfortunately XEmacs doesn't support :active or :visible
+    ;;   for submenus, only for items.
+    ;;   It uses :included instead of :active or :visible.
+    ;;   Also, XEmacs doesn't support :help tag.
+    (let ((pr-:active  (if (eq ps-print-emacs-type 'emacs)
+			   :active	; GNU Emacs
+			 :included))	; XEmacs
+	  (pr-:visible (if (eq ps-print-emacs-type 'emacs)
+			   :visible	; GNU Emacs
+			 :included))	; XEmacs
+	  pr-:help)
+      (if (eq ps-print-emacs-type 'emacs)
+	  (defalias 'pr-:help #'(lambda (text) (list :help text))) ; GNU Emacs
+	(defalias 'pr-:help 'ignore))				   ; XEmacs
+      `(
 	["Printing Interface" pr-interface
-	 :help "Use buffer interface instead of menu interface"]
+	 ,@(pr-:help "Use buffer interface instead of menu interface")]
 	"--"
-	("PostScript Preview" :visible (pr-visible-p 'postscript)
-	 :help "Preview PostScript instead of sending to printer"
-	 ("Directory" :active (not pr-spool-p)
+	("PostScript Preview" ,pr-:visible (pr-visible-p 'postscript)
+	 ,@(pr-:help "Preview PostScript instead of sending to printer")
+	 ("Directory" ,pr-:active (not pr-spool-p)
 	  ["1-up"     (pr-ps-directory-preview 1   nil nil t) t]
 	  ["2-up"     (pr-ps-directory-preview 2   nil nil t) t]
 	  ["4-up"     (pr-ps-directory-preview 4   nil nil t) t]
 	  ["Other..." (pr-ps-directory-preview nil nil nil t)
 	   :keys "\\[pr-ps-buffer-preview]"])
-	 ("Buffer" :active (not pr-spool-p)
+	 ("Buffer" ,pr-:active (not pr-spool-p)
 	  ["1-up"     (pr-ps-buffer-preview 1   t) t]
 	  ["2-up"     (pr-ps-buffer-preview 2   t) t]
 	  ["4-up"     (pr-ps-buffer-preview 4   t) t]
 	  ["Other..." (pr-ps-buffer-preview nil t)
 	   :keys "\\[pr-ps-buffer-preview]"])
-	 ("Region" :active (and (not pr-spool-p) (ps-mark-active-p))
+	 ("Region" ,pr-:active (and (not pr-spool-p) (ps-mark-active-p))
 	  ["1-up"     (pr-ps-region-preview 1   t) t]
 	  ["2-up"     (pr-ps-region-preview 2   t) t]
 	  ["4-up"     (pr-ps-region-preview 4   t) t]
 	  ["Other..." (pr-ps-region-preview nil t)
 	   :keys "\\[pr-ps-region-preview]"])
-	 ("Mode" :active (and (not pr-spool-p) (pr-mode-alist-p))
+	 ("Mode" ,pr-:active (and (not pr-spool-p) (pr-mode-alist-p))
 	  ["1-up"     (pr-ps-mode-preview 1   t) t]
 	  ["2-up"     (pr-ps-mode-preview 2   t) t]
 	  ["4-up"     (pr-ps-mode-preview 4   t) t]
@@ -2524,10 +2625,10 @@
 	 ("File"
 	  ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)
 	   :keys "\\[pr-ps-file-preview]"
-	   :help "Preview PostScript file"]
+	   ,@(pr-:help "Preview PostScript file")]
 	  "--"
 	  ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
-	   :help "Select PostScript utility"]
+	   ,@(pr-:help "Select PostScript utility")]
 	  "--"
 	  ["1-up..."   (pr-ps-file-up-preview 1   t t) pr-ps-utility-alist]
 	  ["2-up..."   (pr-ps-file-up-preview 2   t t) pr-ps-utility-alist]
@@ -2537,21 +2638,21 @@
 	  "--"
 	  ["Landscape" pr-toggle-file-landscape
 	   :style toggle :selected pr-file-landscape
-	   :help "Toggle landscape for PostScript file"
+	   ,@(pr-:help "Toggle landscape for PostScript file")
 	   :active pr-ps-utility-alist]
 	  ["Duplex"    pr-toggle-file-duplex
 	   :style toggle :selected pr-file-duplex
-	   :help "Toggle duplex for PostScript file"
+	   ,@(pr-:help "Toggle duplex for PostScript file")
 	   :active pr-ps-utility-alist]
 	  ["Tumble"    pr-toggle-file-tumble
 	   :style toggle :selected pr-file-tumble
-	   :help "Toggle tumble for PostScript file"
+	   ,@(pr-:help "Toggle tumble for PostScript file")
 	   :active (and pr-file-duplex pr-ps-utility-alist)])
 	 ["Despool..." (call-interactively 'pr-despool-preview)
 	  :active pr-spool-p :keys "\\[pr-despool-preview]"
-	  :help "Despool PostScript buffer to printer or file (C-u)"])
-	("PostScript Print" :visible (pr-visible-p 'postscript)
-	 :help "Send PostScript to printer or file (C-u)"
+	  ,@(pr-:help "Despool PostScript buffer to printer or file (C-u)")])
+	("PostScript Print" ,pr-:visible (pr-visible-p 'postscript)
+	 ,@(pr-:help "Send PostScript to printer or file (C-u)")
 	 ("Directory"
 	  ["1-up"     (pr-ps-directory-ps-print 1   nil nil t) t]
 	  ["2-up"     (pr-ps-directory-ps-print 2   nil nil t) t]
@@ -2564,13 +2665,13 @@
 	  ["4-up"     (pr-ps-buffer-ps-print 4   t) t]
 	  ["Other..." (pr-ps-buffer-ps-print nil t)
 	   :keys "\\[pr-ps-buffer-ps-print]"])
-	 ("Region" :active (ps-mark-active-p)
+	 ("Region" ,pr-:active (ps-mark-active-p)
 	  ["1-up"     (pr-ps-region-ps-print 1   t) t]
 	  ["2-up"     (pr-ps-region-ps-print 2   t) t]
 	  ["4-up"     (pr-ps-region-ps-print 4   t) t]
 	  ["Other..." (pr-ps-region-ps-print nil t)
 	   :keys "\\[pr-ps-region-ps-print]"])
-	 ("Mode" :active (pr-mode-alist-p)
+	 ("Mode" ,pr-:active (pr-mode-alist-p)
 	  ["1-up"     (pr-ps-mode-ps-print 1   t) t]
 	  ["2-up"     (pr-ps-mode-ps-print 2   t) t]
 	  ["4-up"     (pr-ps-mode-ps-print 4   t) t]
@@ -2579,10 +2680,10 @@
 	 ("File"
 	  ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)
 	   :keys "\\[pr-ps-file-ps-print]"
-	   :help "Send PostScript file to printer"]
+	   ,@(pr-:help "Send PostScript file to printer")]
 	  "--"
 	  ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
-	   :help "Select PostScript utility"]
+	   ,@(pr-:help "Select PostScript utility")]
 	  "--"
 	  ["1-up..."   (pr-ps-file-up-ps-print 1   t t) pr-ps-utility-alist]
 	  ["2-up..."   (pr-ps-file-up-ps-print 2   t t) pr-ps-utility-alist]
@@ -2592,37 +2693,38 @@
 	  "--"
 	  ["Landscape" pr-toggle-file-landscape
 	   :style toggle :selected pr-file-landscape
-	   :help "Toggle landscape for PostScript file"
+	   ,@(pr-:help "Toggle landscape for PostScript file")
 	   :active pr-ps-utility-alist]
 	  ["Duplex"    pr-toggle-file-duplex
 	   :style toggle :selected pr-file-duplex
-	   :help "Toggle duplex for PostScript file"
+	   ,@(pr-:help "Toggle duplex for PostScript file")
 	   :active pr-ps-utility-alist]
 	  ["Tumble"    pr-toggle-file-tumble
 	   :style toggle :selected pr-file-tumble
-	   :help "Toggle tumble for PostScript file"
+	   ,@(pr-:help "Toggle tumble for PostScript file")
 	   :active (and pr-file-duplex pr-ps-utility-alist)])
 	 ["Despool..." (call-interactively 'pr-despool-ps-print)
 	  :active pr-spool-p :keys "\\[pr-despool-ps-print]"
-	  :help "Despool PostScript buffer to printer or file (C-u)"])
+	  ,@(pr-:help "Despool PostScript buffer to printer or file (C-u)")])
 	["PostScript Printers" pr-update-menus
 	 :active pr-ps-printer-alist :included (pr-visible-p 'postscript)
-	 :help "Select PostScript printer"]
+	 ,@(pr-:help "Select PostScript printer")]
 	"--"
-	("Printify" :visible (pr-visible-p 'text)
-	 :help "Replace non-printing chars with printable representations."
+	("Printify" ,pr-:visible (pr-visible-p 'text)
+	 ,@(pr-:help
+	    "Replace non-printing chars with printable representations.")
 	 ["Directory" pr-printify-directory t]
 	 ["Buffer"    pr-printify-buffer    t]
 	 ["Region"    pr-printify-region    (ps-mark-active-p)])
-	("Print" :visible (pr-visible-p 'text)
-	 :help "Send text to printer"
+	("Print" ,pr-:visible (pr-visible-p 'text)
+	 ,@(pr-:help "Send text to printer")
 	 ["Directory" pr-txt-directory t]
 	 ["Buffer"    pr-txt-buffer    t]
 	 ["Region"    pr-txt-region    (ps-mark-active-p)]
 	 ["Mode"      pr-txt-mode      (pr-mode-alist-p)])
 	["Text Printers" pr-update-menus
 	 :active pr-txt-printer-alist :included (pr-visible-p 'text)
-	 :help "Select text printer"]
+	 ,@(pr-:help "Select text printer")]
 	"--"
 	["Landscape"               pr-toggle-landscape
 	 :style toggle :selected ps-landscape-mode
@@ -2648,8 +2750,8 @@
 	["Upside-Down"             pr-toggle-upside-down
 	 :style toggle :selected ps-print-upside-down
 	 :included (pr-visible-p 'postscript-options)]
-	("Print All Pages" :visible (pr-visible-p 'postscript-options)
-	 :help "Select odd/even pages/sheets to print"
+	("Print All Pages" ,pr-:visible (pr-visible-p 'postscript-options)
+	 ,@(pr-:help "Select odd/even pages/sheets to print")
 	 ["All Pages"   (pr-even-or-odd-pages nil)
 	  :style radio :selected (eq ps-even-or-odd-pages nil)]
 	 ["Even Pages"  (pr-even-or-odd-pages 'even-page)
@@ -2664,15 +2766,15 @@
 	["Spool Buffer"            pr-toggle-spool
 	 :style toggle :selected pr-spool-p
 	 :included (pr-visible-p 'postscript-process)
-	 :help "Toggle PostScript spooling"]
+	 ,@(pr-:help "Toggle PostScript spooling")]
 	["Print with faces"        pr-toggle-faces
 	 :style toggle :selected pr-faces-p
 	 :included (pr-visible-p 'postscript-process)
-	 :help "Toggle PostScript printing with faces"]
+	 ,@(pr-:help "Toggle PostScript printing with faces")]
 	["Print via Ghostscript" pr-toggle-ghostscript
 	 :style toggle :selected pr-print-using-ghostscript
 	 :included (pr-visible-p 'postscript-process)
-	 :help "Toggle PostScript generation using ghostscript"]
+	 ,@(pr-:help "Toggle PostScript generation using ghostscript")]
 	"--"
 	["Auto Region" pr-toggle-region
 	 :style toggle :selected pr-auto-region
@@ -2684,205 +2786,16 @@
 	 :style toggle :selected pr-menu-lock
 	 :included (pr-visible-p 'printing)]
 	"--"
-	("Customize" :visible (pr-visible-p 'help)
+	("Customize" ,pr-:visible (pr-visible-p 'help)
 	 ["printing" pr-customize       t]
 	 ["ps-print" ps-print-customize t]
 	 ["lpr"      lpr-customize      t])
-	("Show Settings" :visible (pr-visible-p 'help)
+	("Show Settings" ,pr-:visible (pr-visible-p 'help)
 	 ["printing" pr-show-pr-setup  t]
 	 ["ps-print" pr-show-ps-setup  t]
 	 ["lpr"      pr-show-lpr-setup t])
 	["Help" pr-help :active t :included (pr-visible-p 'help)]
-	))
-
-
-     ((eq ps-print-emacs-type 'xemacs)	; XEmacs
-      ;; Menu mapping:
-      ;;   unfortunately XEmacs doesn't support :active or :visible
-      ;;   for submenus, only for items.
-      ;;   It uses :included instead of :active or :visible.
-      ;;   Also, XEmacs doesn't support :help tag.
-      '(
-	["Printing Interface" pr-interface]
-	"--"
-	("PostScript Preview" :included (pr-visible-p 'postscript)
-	 ("Directory" :included (not pr-spool-p)
-	  ["1-up"     (pr-ps-directory-preview 1   nil nil t) t]
-	  ["2-up"     (pr-ps-directory-preview 2   nil nil t) t]
-	  ["4-up"     (pr-ps-directory-preview 4   nil nil t) t]
-	  ["Other..." (pr-ps-directory-preview nil nil nil t)
-	   :keys "\\[pr-ps-buffer-preview]"])
-	 ("Buffer" :included (not pr-spool-p)
-	  ["1-up"     (pr-ps-buffer-preview 1   t) t]
-	  ["2-up"     (pr-ps-buffer-preview 2   t) t]
-	  ["4-up"     (pr-ps-buffer-preview 4   t) t]
-	  ["Other..." (pr-ps-buffer-preview nil t)
-	   :keys "\\[pr-ps-buffer-preview]"])
-	 ("Region" :included (and (not pr-spool-p) (ps-mark-active-p))
-	  ["1-up"     (pr-ps-region-preview 1   t) t]
-	  ["2-up"     (pr-ps-region-preview 2   t) t]
-	  ["4-up"     (pr-ps-region-preview 4   t) t]
-	  ["Other..." (pr-ps-region-preview nil t)
-	   :keys "\\[pr-ps-region-preview]"])
-	 ("Mode" :included (and (not pr-spool-p) (pr-mode-alist-p))
-	  ["1-up"     (pr-ps-mode-preview 1   t) t]
-	  ["2-up"     (pr-ps-mode-preview 2   t) t]
-	  ["4-up"     (pr-ps-mode-preview 4   t) t]
-	  ["Other..." (pr-ps-mode-preview nil t)
-	   :keys "\\[pr-ps-mode-preview]"])
-	 ("File"
-	  ["No Preprocessing..." (call-interactively 'pr-ps-file-preview)
-	   :keys "\\[pr-ps-file-preview]"]
-	  "--"
-	  ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist]
-	  "--"
-	  ["1-up..."   (pr-ps-file-up-preview 1   t t) pr-ps-utility-alist]
-	  ["2-up..."   (pr-ps-file-up-preview 2   t t) pr-ps-utility-alist]
-	  ["4-up..."   (pr-ps-file-up-preview 4   t t) pr-ps-utility-alist]
-	  ["Other..."  (pr-ps-file-up-preview nil t t)
-	   :keys "\\[pr-ps-file-up-preview]" :active pr-ps-utility-alist]
-	  "--"
-	  ["Landscape" pr-toggle-file-landscape
-	   :style toggle :selected pr-file-landscape
-	   :active pr-ps-utility-alist]
-	  ["Duplex"    pr-toggle-file-duplex
-	   :style toggle :selected pr-file-duplex
-	   :active pr-ps-utility-alist]
-	  ["Tumble"    pr-toggle-file-tumble
-	   :style toggle :selected pr-file-tumble
-	   :active (and pr-file-duplex pr-ps-utility-alist)])
-	 ["Despool..." (call-interactively 'pr-despool-preview)
-	  :active pr-spool-p :keys "\\[pr-despool-preview]"])
-	("PostScript Print" :included (pr-visible-p 'postscript)
-	 ("Directory"
-	  ["1-up"     (pr-ps-directory-ps-print 1   nil nil t) t]
-	  ["2-up"     (pr-ps-directory-ps-print 2   nil nil t) t]
-	  ["4-up"     (pr-ps-directory-ps-print 4   nil nil t) t]
-	  ["Other..." (pr-ps-directory-ps-print nil nil nil t)
-	   :keys "\\[pr-ps-buffer-ps-print]"])
-	 ("Buffer"
-	  ["1-up"     (pr-ps-buffer-ps-print 1   t) t]
-	  ["2-up"     (pr-ps-buffer-ps-print 2   t) t]
-	  ["4-up"     (pr-ps-buffer-ps-print 4   t) t]
-	  ["Other..." (pr-ps-buffer-ps-print nil t)
-	   :keys "\\[pr-ps-buffer-ps-print]"])
-	 ("Region" :included (ps-mark-active-p)
-	  ["1-up"     (pr-ps-region-ps-print 1   t) t]
-	  ["2-up"     (pr-ps-region-ps-print 2   t) t]
-	  ["4-up"     (pr-ps-region-ps-print 4   t) t]
-	  ["Other..." (pr-ps-region-ps-print nil t)
-	   :keys "\\[pr-ps-region-ps-print]"])
-	 ("Mode" :included (pr-mode-alist-p)
-	  ["1-up"     (pr-ps-mode-ps-print 1   t) t]
-	  ["2-up"     (pr-ps-mode-ps-print 2   t) t]
-	  ["4-up"     (pr-ps-mode-ps-print 4   t) t]
-	  ["Other..." (pr-ps-mode-ps-print nil t)
-	   :keys "\\[pr-ps-mode-ps-print]"])
-	 ("File"
-	  ["No Preprocessing..." (call-interactively 'pr-ps-file-ps-print)
-	   :keys "\\[pr-ps-file-ps-print]"]
-	  "--"
-	  ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist]
-	  "--"
-	  ["1-up..."   (pr-ps-file-up-ps-print 1   t t) pr-ps-utility-alist]
-	  ["2-up..."   (pr-ps-file-up-ps-print 2   t t) pr-ps-utility-alist]
-	  ["4-up..."   (pr-ps-file-up-ps-print 4   t t) pr-ps-utility-alist]
-	  ["Other..."  (pr-ps-file-up-ps-print nil t t)
-	   :keys "\\[pr-ps-file-up-ps-print]" :active pr-ps-utility-alist]
-	  "--"
-	  ["Landscape" pr-toggle-file-landscape
-	   :style toggle :selected pr-file-landscape
-	   :active pr-ps-utility-alist]
-	  ["Duplex"    pr-toggle-file-duplex
-	   :style toggle :selected pr-file-duplex
-	   :active pr-ps-utility-alist]
-	  ["Tumble"    pr-toggle-file-tumble
-	   :style toggle :selected pr-file-tumble
-	   :active (and pr-file-duplex pr-ps-utility-alist)])
-	 ["Despool..." (call-interactively 'pr-despool-ps-print)
-	  :active pr-spool-p :keys "\\[pr-despool-ps-print]"])
-	["PostScript Printers" pr-update-menus
-	 :active pr-ps-printer-alist :included (pr-visible-p 'postscript)]
-	"--"
-	("Printify" :included (pr-visible-p 'text)
-	 ["Directory" pr-printify-directory t]
-	 ["Buffer"    pr-printify-buffer    t]
-	 ["Region"    pr-printify-region    (ps-mark-active-p)])
-	("Print" :included (pr-visible-p 'text)
-	 ["Directory" pr-txt-directory t]
-	 ["Buffer"    pr-txt-buffer    t]
-	 ["Region"    pr-txt-region    (ps-mark-active-p)]
-	 ["Mode"      pr-txt-mode      (pr-mode-alist-p)])
-	["Text Printers" pr-update-menus
-	 :active pr-txt-printer-alist :included (pr-visible-p 'text)]
-	"--"
-	["Landscape"               pr-toggle-landscape
-	 :style toggle :selected ps-landscape-mode
-	 :included (pr-visible-p 'postscript-options)]
-	["Print Header"            pr-toggle-header
-	 :style toggle :selected ps-print-header
-	 :included (pr-visible-p 'postscript-options)]
-	["Print Header Frame"      pr-toggle-header-frame
-	 :style toggle :selected ps-print-header-frame :active ps-print-header
-	 :included (pr-visible-p 'postscript-options)]
-	["Line Number"             pr-toggle-line
-	 :style toggle :selected ps-line-number
-	 :included (pr-visible-p 'postscript-options)]
-	["Zebra Stripes"           pr-toggle-zebra
-	 :style toggle :selected ps-zebra-stripes
-	 :included (pr-visible-p 'postscript-options)]
-	["Duplex"                  pr-toggle-duplex
-	 :style toggle :selected ps-spool-duplex
-	 :included (pr-visible-p 'postscript-options)]
-	["Tumble"                  pr-toggle-tumble
-	 :style toggle :selected ps-spool-tumble :active ps-spool-duplex
-	 :included (pr-visible-p 'postscript-options)]
-	["Upside-Down"             pr-toggle-upside-down
-	 :style toggle :selected ps-print-upside-down
-	 :included (pr-visible-p 'postscript-options)]
-	("Print All Pages" :included (pr-visible-p 'postscript-options)
-	 ["All Pages"   (pr-even-or-odd-pages nil)
-	  :style radio :selected (eq ps-even-or-odd-pages nil)]
-	 ["Even Pages"  (pr-even-or-odd-pages 'even-page)
-	  :style radio :selected (eq ps-even-or-odd-pages 'even-page)]
-	 ["Odd Pages"   (pr-even-or-odd-pages 'odd-page)
-	  :style radio :selected (eq ps-even-or-odd-pages 'odd-page)]
-	 ["Even Sheets" (pr-even-or-odd-pages 'even-sheet)
-	  :style radio :selected (eq ps-even-or-odd-pages 'even-sheet)]
-	 ["Odd Sheets"  (pr-even-or-odd-pages 'odd-sheet)
-	  :style radio :selected (eq ps-even-or-odd-pages 'odd-sheet)])
-	"--"
-	["Spool Buffer"            pr-toggle-spool
-	 :style toggle :selected pr-spool-p
-	 :included (pr-visible-p 'postscript-process)]
-	["Print with faces"        pr-toggle-faces
-	 :style toggle :selected pr-faces-p
-	 :included (pr-visible-p 'postscript-process)]
-	["Print via Ghostscript" pr-toggle-ghostscript
-	 :style toggle :selected pr-print-using-ghostscript
-	 :included (pr-visible-p 'postscript-process)]
-	"--"
-	["Auto Region" pr-toggle-region
-	 :style toggle :selected pr-auto-region
-	 :included (pr-visible-p 'printing)]
-	["Auto Mode"   pr-toggle-mode
-	 :style toggle :selected pr-auto-mode
-	 :included (pr-visible-p 'printing)]
-	["Menu Lock"   pr-toggle-lock
-	 :style toggle :selected pr-menu-lock
-	 :included (pr-visible-p 'printing)]
-	"--"
-	("Customize" :included (pr-visible-p 'help)
-	 ["printing" pr-customize       t]
-	 ["ps-print" ps-print-customize t]
-	 ["lpr"      lpr-customize      t])
-	("Show Settings" :included (pr-visible-p 'help)
-	 ["printing" pr-show-pr-setup  t]
-	 ["ps-print" pr-show-ps-setup  t]
-	 ["lpr"      pr-show-lpr-setup t])
-	["Help" pr-help :active t :included (pr-visible-p 'help)]
-	))
-     ))
+	)))
 
 
   (cond
@@ -2915,23 +2828,29 @@
 	      pr-menu-bar (vector 'menu-bar 'file
 				  (pr-get-symbol "Print")))))
      (t
-      (easy-menu-change '("file") "Print" pr-menu-spec)))
-
-    ;; Key binding
-    (global-set-key [print]   'pr-ps-fast-fire)
-    (global-set-key [M-print] 'pr-ps-mode-using-ghostscript)
-    (global-set-key [C-print] 'pr-txt-fast-fire))
+      (easy-menu-change '("file") "Print" pr-menu-spec))))
 
 
    ((eq ps-print-emacs-type 'xemacs)	; XEmacs
     ;; Menu binding
     (pr-xemacs-global-menubar
-     (pr-x-add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))
-
-    ;; Key binding
-    (global-set-key 'f22           'pr-ps-fast-fire)
-    (global-set-key '(meta f22)    'pr-ps-mode-using-ghostscript)
-    (global-set-key '(control f22) 'pr-txt-fast-fire))))
+     (pr-x-add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))))
+
+
+  ;; Key binding
+  (let ((pr-print-key (if (eq ps-print-emacs-type 'emacs)
+			  'print	; GNU Emacs
+			'f22)))		; XEmacs
+    (global-set-key `[,pr-print-key]                'pr-ps-fast-fire)
+    ;; Well, M-print and S-print are used because in my keyboard S-print works
+    ;; and M-print doesn't.  But M-print can work in other keyboard.
+    (global-set-key `[(meta ,pr-print-key)]         'pr-ps-mode-using-ghostscript)
+    (global-set-key `[(shift ,pr-print-key)]        'pr-ps-mode-using-ghostscript)
+    ;; Well, C-print and C-M-print are used because in my keyboard C-M-print works
+    ;; and C-print doesn't.  But C-print can work in other keyboard.
+    (global-set-key `[(control ,pr-print-key)]      'pr-txt-fast-fire)
+    (global-set-key `[(control meta ,pr-print-key)] 'pr-txt-fast-fire)
+    ))
 
 
 ;;; You can also use something like:
@@ -3407,9 +3326,10 @@
 
 For more information, type \\[pr-interface-help]."
   (interactive)
-  (save-excursion
-    (set-buffer (or buffer (current-buffer)))
-    (pr-create-interface)))
+  (pr-save-interactive
+   (save-excursion
+     (set-buffer (or buffer (current-buffer)))
+     (pr-create-interface))))
 
 
 ;;;###autoload
@@ -3430,12 +3350,13 @@
 
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-ps-dir-args (pr-prompt "PS preview dir")))
-  (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
-		      (pr-prompt "PS preview dir"))
-  (setq filename (pr-ps-file filename))
-  (pr-ps-file-list n-up dir file-regexp filename)
-  (or pr-spool-p
-      (pr-ps-file-preview filename)))
+  (pr-save-interactive
+   (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
+		       (pr-prompt "PS preview dir"))
+   (setq filename (pr-ps-file filename))
+   (pr-ps-file-list n-up dir file-regexp filename)
+   (or pr-spool-p
+       (pr-ps-file-preview filename))))
 
 
 ;;;###autoload
@@ -3456,12 +3377,13 @@
 
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir GS")))
-  (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
-		      (pr-prompt "PS print dir GS"))
-  (let ((file (pr-ps-file filename)))
-    (pr-ps-file-list n-up dir file-regexp file)
-    (pr-ps-file-using-ghostscript file)
-    (or filename (pr-delete-file file))))
+  (pr-save-interactive
+   (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
+		       (pr-prompt "PS print dir GS"))
+   (let ((file (pr-ps-file filename)))
+     (pr-ps-file-list n-up dir file-regexp file)
+     (pr-ps-file-using-ghostscript file)
+     (or filename (pr-delete-file file)))))
 
 
 ;;;###autoload
@@ -3482,12 +3404,13 @@
 
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-ps-dir-args (pr-prompt "PS print dir")))
-  (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
-		      (pr-prompt "PS print dir"))
-  (let ((file (pr-ps-file filename)))
-    (pr-ps-file-list n-up dir file-regexp file)
-    (pr-ps-file-print file)
-    (or filename (pr-delete-file file))))
+  (pr-save-interactive
+   (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
+		       (pr-prompt "PS print dir"))
+   (let ((file (pr-ps-file filename)))
+     (pr-ps-file-list n-up dir file-regexp file)
+     (pr-ps-file-print file)
+     (or filename (pr-delete-file file)))))
 
 
 ;;;###autoload
@@ -3511,11 +3434,12 @@
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-ps-dir-args
 		(pr-prompt (pr-prompt-gs "PS print dir"))))
-  (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
-		      (pr-prompt (pr-prompt-gs "PS print dir")))
-  (if (pr-using-ghostscript-p)
-      (pr-ps-directory-using-ghostscript n-up dir file-regexp filename)
-    (pr-ps-directory-print n-up dir file-regexp filename)))
+  (pr-save-interactive
+   (pr-set-ps-dir-args 'n-up 'dir 'file-regexp 'filename
+		       (pr-prompt (pr-prompt-gs "PS print dir")))
+   (if (pr-using-ghostscript-p)
+       (pr-ps-directory-using-ghostscript n-up dir file-regexp filename)
+     (pr-ps-directory-print n-up dir file-regexp filename))))
 
 
 ;;;###autoload
@@ -3531,10 +3455,11 @@
 temporary file.  If FILENAME is a string, save the PostScript image in a file
 with that name.  If FILENAME is t, prompts for a file name."
   (interactive (pr-interactive-n-up-file (pr-prompt "PS preview")))
-  (if (pr-auto-mode-p)
-      (pr-ps-mode-preview n-up filename)
-    (pr-ps-preview (pr-region-active-symbol) n-up filename
-		   (pr-region-active-string "PS preview"))))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (pr-ps-mode-preview n-up filename)
+     (pr-ps-preview (pr-region-active-symbol) n-up filename
+		    (pr-region-active-string "PS preview")))))
 
 
 ;;;###autoload
@@ -3550,10 +3475,11 @@
 printer.  If FILENAME is a string, save the PostScript image in a file with
 that name.  If FILENAME is t, prompts for a file name."
   (interactive (pr-interactive-n-up-file (pr-prompt "PS print GS")))
-  (if (pr-auto-mode-p)
-      (pr-ps-mode-using-ghostscript n-up filename)
-    (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
-			     (pr-region-active-string "PS print GS"))))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (pr-ps-mode-using-ghostscript n-up filename)
+     (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
+			      (pr-region-active-string "PS print GS")))))
 
 
 ;;;###autoload
@@ -3569,10 +3495,11 @@
 printer.  If FILENAME is a string, save the PostScript image in a file with
 that name.  If FILENAME is t, prompts for a file name."
   (interactive (pr-interactive-n-up-file (pr-prompt "PS print")))
-  (if (pr-auto-mode-p)
-      (pr-ps-mode-print n-up filename)
-    (pr-ps-print (pr-region-active-symbol) n-up filename
-		 (pr-region-active-string "PS print"))))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (pr-ps-mode-print n-up filename)
+     (pr-ps-print (pr-region-active-symbol) n-up filename
+		  (pr-region-active-string "PS print")))))
 
 
 ;;;###autoload
@@ -3591,14 +3518,15 @@
 that name.  If FILENAME is t, prompts for a file name."
   (interactive (pr-interactive-n-up-file
 		(pr-prompt (pr-prompt-gs "PS print"))))
-  (cond ((pr-auto-mode-p)
-	 (pr-ps-mode-ps-print n-up filename))
-	((pr-using-ghostscript-p)
-	 (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
-				  (pr-region-active-string "PS print GS")))
-	(t
-	 (pr-ps-print (pr-region-active-symbol) n-up filename
-		      (pr-region-active-string "PS print")))))
+  (pr-save-interactive
+   (cond ((pr-auto-mode-p)
+	  (pr-ps-mode-ps-print n-up filename))
+	 ((pr-using-ghostscript-p)
+	  (pr-ps-using-ghostscript (pr-region-active-symbol) n-up filename
+				   (pr-region-active-string "PS print GS")))
+	 (t
+	  (pr-ps-print (pr-region-active-symbol) n-up filename
+		       (pr-region-active-string "PS print"))))))
 
 
 ;;;###autoload
@@ -3607,10 +3535,11 @@
 
 See also `pr-ps-buffer-preview'."
   (interactive (pr-interactive-n-up-file (pr-prompt-region "PS preview")))
-  (if (pr-auto-mode-p)
-      (let ((pr-auto-region t))
-	(pr-ps-mode-preview n-up filename))
-    (pr-ps-preview 'region n-up filename "PS preview region")))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (let ((pr-auto-region t))
+	 (pr-ps-mode-preview n-up filename))
+     (pr-ps-preview 'region n-up filename "PS preview region"))))
 
 
 ;;;###autoload
@@ -3619,10 +3548,11 @@
 
 See also `pr-ps-buffer-using-ghostscript'."
   (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print GS")))
-  (if (pr-auto-mode-p)
-      (let ((pr-auto-region t))
-	(pr-ps-mode-using-ghostscript n-up filename))
-    (pr-ps-using-ghostscript 'region n-up filename "PS print GS region")))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (let ((pr-auto-region t))
+	 (pr-ps-mode-using-ghostscript n-up filename))
+     (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))))
 
 
 ;;;###autoload
@@ -3631,10 +3561,11 @@
 
 See also `pr-ps-buffer-print'."
   (interactive (pr-interactive-n-up-file (pr-prompt-region "PS print")))
-  (if (pr-auto-mode-p)
-      (let ((pr-auto-region t))
-	(pr-ps-mode-print n-up filename))
-    (pr-ps-print 'region n-up filename "PS print region")))
+  (pr-save-interactive
+   (if (pr-auto-mode-p)
+       (let ((pr-auto-region t))
+	 (pr-ps-mode-print n-up filename))
+     (pr-ps-print 'region n-up filename "PS print region"))))
 
 
 ;;;###autoload
@@ -3644,13 +3575,14 @@
 See also `pr-ps-buffer-ps-print'."
   (interactive (pr-interactive-n-up-file
 		(pr-prompt-region (pr-prompt-gs "PS print"))))
-  (cond ((pr-auto-mode-p)
-	 (let ((pr-auto-region t))
-	   (pr-ps-mode-ps-print n-up filename)))
-	((pr-using-ghostscript-p)
-	 (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))
-	(t
-	 (pr-ps-print 'region n-up filename "PS print region"))))
+  (pr-save-interactive
+   (cond ((pr-auto-mode-p)
+	  (let ((pr-auto-region t))
+	    (pr-ps-mode-ps-print n-up filename)))
+	 ((pr-using-ghostscript-p)
+	  (pr-ps-using-ghostscript 'region n-up filename "PS print GS region"))
+	 (t
+	  (pr-ps-print 'region n-up filename "PS print region")))))
 
 
 ;;;###autoload
@@ -3659,11 +3591,12 @@
 
 See also `pr-ps-buffer-preview'."
   (interactive (pr-interactive-n-up-file "PS preview mode"))
-  (pr-set-n-up-and-filename 'n-up 'filename "PS preview mode")
-  (let ((file (pr-ps-file filename)))
-    (and (pr-ps-mode n-up file)
-	 (not pr-spool-p)
-	 (pr-ps-file-preview file))))
+  (pr-save-interactive
+   (pr-set-n-up-and-filename 'n-up 'filename "PS preview mode")
+   (let ((file (pr-ps-file filename)))
+     (and (pr-ps-mode n-up file)
+	  (not pr-spool-p)
+	  (pr-ps-file-preview file)))))
 
 
 ;;;###autoload
@@ -3672,12 +3605,13 @@
 
 See also `pr-ps-buffer-using-ghostscript'."
   (interactive (pr-interactive-n-up-file "PS print GS mode"))
-  (pr-set-n-up-and-filename 'n-up 'filename "PS print GS mode")
-  (let ((file (pr-ps-file filename)))
-    (when (and (pr-ps-mode n-up file)
-	       (not pr-spool-p))
-      (pr-ps-file-using-ghostscript file)
-      (or filename (pr-delete-file file)))))
+  (pr-save-interactive
+   (pr-set-n-up-and-filename 'n-up 'filename "PS print GS mode")
+   (let ((file (pr-ps-file filename)))
+     (when (and (pr-ps-mode n-up file)
+		(not pr-spool-p))
+       (pr-ps-file-using-ghostscript file)
+       (or filename (pr-delete-file file))))))
 
 
 ;;;###autoload
@@ -3686,8 +3620,9 @@
 
 See also `pr-ps-buffer-print'."
   (interactive (pr-interactive-n-up-file "PS print mode"))
-  (pr-set-n-up-and-filename 'n-up 'filename "PS print mode")
-  (pr-ps-mode n-up filename))
+  (pr-save-interactive
+   (pr-set-n-up-and-filename 'n-up 'filename "PS print mode")
+   (pr-ps-mode n-up filename)))
 
 
 ;;;###autoload
@@ -3696,9 +3631,10 @@
 
 See also `pr-ps-buffer-ps-print'."
   (interactive (pr-interactive-n-up-file (pr-prompt-gs "PS print mode")))
-  (if (pr-using-ghostscript-p)
-      (pr-ps-mode-using-ghostscript n-up filename)
-    (pr-ps-mode-print n-up filename)))
+  (pr-save-interactive
+   (if (pr-using-ghostscript-p)
+       (pr-ps-mode-using-ghostscript n-up filename)
+     (pr-ps-mode-print n-up filename))))
 
 
 ;;;###autoload
@@ -3715,8 +3651,9 @@
 
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-dir-args "Printify dir"))
-  (pr-set-dir-args 'dir 'file-regexp "Printify dir")
-  (pr-file-list dir file-regexp 'pr-printify-buffer))
+  (pr-save-interactive
+   (pr-set-dir-args 'dir 'file-regexp "Printify dir")
+   (pr-file-list dir file-regexp 'pr-printify-buffer)))
 
 
 ;;;###autoload
@@ -3751,8 +3688,9 @@
 
 See also documentation for `pr-list-directory'."
   (interactive (pr-interactive-dir-args "Print dir"))
-  (pr-set-dir-args 'dir 'file-regexp "Print dir")
-  (pr-file-list dir file-regexp 'pr-txt-buffer))
+  (pr-save-interactive
+   (pr-set-dir-args 'dir 'file-regexp "Print dir")
+   (pr-file-list dir file-regexp 'pr-txt-buffer)))
 
 
 ;;;###autoload
@@ -3800,10 +3738,11 @@
 save the image in a temporary file.  If FILENAME is a string, save the
 PostScript image in a file with that name."
   (interactive (list (ps-print-preprint current-prefix-arg)))
-  (let ((file (pr-ps-file filename)))
-    (when (stringp file)
-      (pr-despool-print file)
-      (pr-ps-file-preview file))))
+  (pr-save-interactive
+   (let ((file (pr-ps-file filename)))
+     (when (stringp file)
+       (pr-despool-print file)
+       (pr-ps-file-preview file)))))
 
 
 ;;;###autoload
@@ -3818,11 +3757,12 @@
 send the image to the printer.  If FILENAME is a string, save the PostScript
 image in a file with that name."
   (interactive (list (ps-print-preprint current-prefix-arg)))
-  (let ((file (pr-ps-file filename)))
-    (when (stringp file)
-      (pr-despool-print file)
-      (pr-ps-file-using-ghostscript file)
-      (or filename (pr-delete-file file)))))
+  (pr-save-interactive
+   (let ((file (pr-ps-file filename)))
+     (when (stringp file)
+       (pr-despool-print file)
+       (pr-ps-file-using-ghostscript file)
+       (or filename (pr-delete-file file))))))
 
 
 ;;;###autoload
@@ -3837,11 +3777,13 @@
 send the image to the printer.  If FILENAME is a string, save the PostScript
 image in a file with that name."
   (interactive (list (ps-print-preprint current-prefix-arg)))
-  (let ((ps-lpr-command         (pr-command pr-ps-command))
-	(ps-lpr-switches        pr-ps-switches)
-	(ps-printer-name-option pr-ps-printer-switch)
-	(ps-printer-name        pr-ps-printer))
-    (ps-despool filename)))
+  (pr-save-interactive
+   (pr-save-file-modes
+    (let ((ps-lpr-command         (pr-command pr-ps-command))
+	  (ps-lpr-switches        pr-ps-switches)
+	  (ps-printer-name-option pr-ps-printer-switch)
+	  (ps-printer-name        pr-ps-printer))
+      (ps-despool filename)))))
 
 
 ;;;###autoload
@@ -3856,9 +3798,10 @@
 send the image to the printer.  If FILENAME is a string, save the PostScript
 image in a file with that name."
   (interactive (list (ps-print-preprint current-prefix-arg)))
-  (if pr-print-using-ghostscript
-      (pr-despool-using-ghostscript filename)
-    (pr-despool-print filename)))
+  (pr-save-interactive
+   (if pr-print-using-ghostscript
+       (pr-despool-using-ghostscript filename)
+     (pr-despool-print filename))))
 
 
 ;;;###autoload
@@ -3873,10 +3816,11 @@
 (defun pr-ps-file-up-preview (n-up ifilename &optional ofilename)
   "Preview PostScript file FILENAME."
   (interactive (pr-interactive-n-up-inout "PS preview"))
-  (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
-				     "PS preview ")))
-    (pr-ps-utility-process n-up ifilename outfile)
-    (pr-ps-file-preview outfile)))
+  (pr-save-interactive
+   (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
+				      "PS preview ")))
+     (pr-ps-utility-process n-up ifilename outfile)
+     (pr-ps-file-preview outfile))))
 
 
 ;;;###autoload
@@ -3884,20 +3828,21 @@
   "Print PostScript file FILENAME using ghostscript."
   (interactive (list (pr-ps-infile-preprint "Print preview ")))
   (and (stringp filename) (file-exists-p filename)
-       (let* ((file (pr-expand-file-name filename))
-	      (tempfile (pr-dosify-file-name (make-temp-file file))))
-	 ;; gs use
-	 (pr-call-process pr-gs-command
-			  (format "-sDEVICE=%s" pr-gs-device)
-			  (format "-r%d" pr-gs-resolution)
-			  (pr-switches-string pr-gs-switches "pr-gs-switches")
-			  (format "-sOutputFile=\"%s\"" tempfile)
-			  file
-			  "-c quit")
-	 ;; printing
-	 (pr-ps-file-print tempfile)
-	 ;; deleting
-	 (pr-delete-file tempfile))))
+       (pr-save-interactive
+	(let* ((file (pr-expand-file-name filename))
+	       (tempfile (pr-dosify-file-name (make-temp-file file))))
+	  ;; gs use
+	  (pr-call-process pr-gs-command
+			   (format "-sDEVICE=%s" pr-gs-device)
+			   (format "-r%d" pr-gs-resolution)
+			   (pr-switches-string pr-gs-switches "pr-gs-switches")
+			   (format "-sOutputFile=\"%s\"" tempfile)
+			   file
+			   "-c quit")
+	  ;; printing
+	  (pr-ps-file-print tempfile)
+	  ;; deleting
+	  (pr-delete-file tempfile)))))
 
 
 ;;;###autoload
@@ -3908,12 +3853,14 @@
        ;; printing
        (let ((file (pr-expand-file-name filename)))
 	 (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)
 		 (erase-buffer)
 		 (insert-file-contents-literally file))
 	       (pr-despool-print))
+	   ;; use `pr-ps-command' to print
 	   (apply 'pr-call-process
 		  pr-ps-command
 		  (pr-switches-string pr-ps-switches "pr-gs-switches")
@@ -3958,22 +3905,24 @@
 		(if pr-print-using-ghostscript
 		    "PS print GS"
 		  "PS print")))
-  (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
-				     (if pr-print-using-ghostscript
-					 "PS print GS "
-				       "PS print "))))
-    (pr-ps-utility-process n-up ifilename outfile)
-    (unless ofilename
-      (pr-ps-file-ps-print outfile)
-      (pr-delete-file outfile))))
+  (pr-save-interactive
+   (let ((outfile (pr-ps-utility-args 'n-up 'ifilename 'ofilename
+				      (if pr-print-using-ghostscript
+					  "PS print GS "
+					"PS print "))))
+     (pr-ps-utility-process n-up ifilename outfile)
+     (unless ofilename
+       (pr-ps-file-ps-print outfile)
+       (pr-delete-file outfile)))))
 
 
 ;;;###autoload
 (defun pr-toggle-file-duplex ()
   "Toggle duplex for PostScript file."
   (interactive)
-  (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil
-	     '("PostScript Print" "File")))
+  (pr-save-interactive
+   (pr-toggle 'pr-file-duplex "PS file duplex" nil 7 5 nil
+	      '("PostScript Print" "File"))))
 
 
 ;;;###autoload
@@ -3985,48 +3934,54 @@
 If tumble is on, produces a printing suitable for binding at the top or
 bottom."
   (interactive)
-  (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil
-	     '("PostScript Print" "File")))
+  (pr-save-interactive
+   (pr-toggle 'pr-file-tumble "PS file tumble" nil 8 5 nil
+	      '("PostScript Print" "File"))))
 
 
 ;;;###autoload
 (defun pr-toggle-file-landscape ()
   "Toggle landscape for PostScript file."
   (interactive)
-  (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil
-	     '("PostScript Print" "File")))
+  (pr-save-interactive
+   (pr-toggle 'pr-file-landscape "PS file landscape" nil 6 5 nil
+	      '("PostScript Print" "File"))))
 
 
 ;;;###autoload
 (defun pr-toggle-ghostscript ()
   "Toggle printing using ghostscript."
   (interactive)
-  (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript"
-	     'postscript-process 2 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-print-using-ghostscript "Printing using ghostscript"
+	      'postscript-process 2 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-faces ()
   "Toggle printing with faces."
   (interactive)
-  (pr-toggle 'pr-faces-p "Printing with faces"
-	     'postscript-process 1 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-faces-p "Printing with faces"
+	      'postscript-process 1 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-spool ()
   "Toggle spooling."
   (interactive)
-  (pr-toggle 'pr-spool-p "Spooling printing"
-	     'postscript-process 0 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-spool-p "Spooling printing"
+	      'postscript-process 0 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-duplex ()
   "Toggle duplex."
   (interactive)
-  (pr-toggle 'ps-spool-duplex "Printing duplex"
-	     'postcsript-options 5 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-spool-duplex "Printing duplex"
+	      'postcsript-options 5 12 'toggle)))
 
 
 ;;;###autoload
@@ -4038,80 +3993,90 @@
 If tumble is on, produces a printing suitable for binding at the top or
 bottom."
   (interactive)
-  (pr-toggle 'ps-spool-tumble "Tumble"
-	     'postscript-options 6 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-spool-tumble "Tumble"
+	      'postscript-options 6 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-landscape ()
   "Toggle landscape."
   (interactive)
-  (pr-toggle 'ps-landscape-mode "Landscape"
-	     'postscript-options 0 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-landscape-mode "Landscape"
+	      'postscript-options 0 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-upside-down ()
   "Toggle upside-down."
   (interactive)
-  (pr-toggle 'ps-print-upside-down "Upside-Down"
-	     'postscript-options 7 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-print-upside-down "Upside-Down"
+	      'postscript-options 7 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-line ()
   "Toggle line number."
   (interactive)
-  (pr-toggle 'ps-line-number "Line number"
-	     'postscript-options 3 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-line-number "Line number"
+	      'postscript-options 3 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-zebra ()
   "Toggle zebra stripes."
   (interactive)
-  (pr-toggle 'ps-zebra-stripes "Zebra stripe"
-	     'postscript-options 4 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-zebra-stripes "Zebra stripe"
+	      'postscript-options 4 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-header ()
   "Toggle printing header."
   (interactive)
-  (pr-toggle 'ps-print-header "Print header"
-	     'postscript-options 1 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-print-header "Print header"
+	      'postscript-options 1 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-header-frame ()
   "Toggle printing header frame."
   (interactive)
-  (pr-toggle 'ps-print-header-frame "Print header frame"
-	     'postscript-options 2 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'ps-print-header-frame "Print header frame"
+	      'postscript-options 2 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-lock ()
   "Toggle menu lock."
   (interactive)
-  (pr-toggle 'pr-menu-lock "Menu lock"
-	     'printing 2 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-menu-lock "Menu lock"
+	      'printing 2 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-region ()
   "Toggle auto region."
   (interactive)
-  (pr-toggle 'pr-auto-region "Auto region"
-	     'printing 0 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-auto-region "Auto region"
+	      'printing 0 12 'toggle)))
 
 
 ;;;###autoload
 (defun pr-toggle-mode ()
   "Toggle auto mode."
   (interactive)
-  (pr-toggle 'pr-auto-mode "Auto mode"
-	     'printing 1 12 'toggle))
+  (pr-save-interactive
+   (pr-toggle 'pr-auto-mode "Auto mode"
+	      'printing 1 12 'toggle)))
 
 
 ;;;###autoload
@@ -4139,24 +4104,30 @@
 (defun pr-ps-name ()
   "Interactively select a PostScript printer."
   (interactive)
-  (pr-menu-set-ps-title
-   (pr-complete-alist "PostScript printer" pr-ps-printer-alist pr-ps-name)))
+  (pr-save-interactive
+   (pr-menu-set-ps-title
+    (pr-complete-alist "PostScript printer"
+		       pr-ps-printer-alist pr-ps-name))))
 
 
 ;;;###autoload
 (defun pr-txt-name ()
   "Interactively select a text printer."
   (interactive)
-  (pr-menu-set-txt-title
-   (pr-complete-alist "Text printer" pr-txt-printer-alist pr-txt-name)))
+  (pr-save-interactive
+   (pr-menu-set-txt-title
+    (pr-complete-alist "Text printer"
+		       pr-txt-printer-alist pr-txt-name))))
 
 
 ;;;###autoload
 (defun pr-ps-utility ()
   "Interactively select a PostScript utility."
   (interactive)
-  (pr-menu-set-utility-title
-   (pr-complete-alist "Postscript utility" pr-ps-utility-alist pr-ps-utility)))
+  (pr-save-interactive
+   (pr-menu-set-utility-title
+    (pr-complete-alist "Postscript utility"
+		       pr-ps-utility-alist pr-ps-utility))))
 
 
 ;;;###autoload
@@ -4247,28 +4218,29 @@
 are both set to t."
   (interactive (list (pr-interactive-n-up (pr-prompt-gs "PS print fast"))
 		     current-prefix-arg))
-  (let ((pr-auto-region t)
-	(pr-auto-mode   t)
-	filename)
-    (cond ((null select))
-	  ((listp select)
-	   (pr-ps-name))
-	  ((and (symbolp select)
-		(assq select pr-ps-printer-alist))
-	   (pr-menu-set-ps-title select))
-	  ((integerp select)
-	   (and (/= select 1)
-		(pr-ps-name))
-	   (and (>= select 1) (not pr-spool-p)
-		(setq filename (pr-ps-outfile-preprint
-				(if pr-print-using-ghostscript
-				    "Fast GS "
-				  "Fast "))))))
-    (pr-ps-buffer-ps-print
-     (if (integerp n-up)
-	 (min (max n-up 1) 100)
-       (error "n-up must be an integer greater than zero"))
-     filename)))
+  (pr-save-interactive
+   (let ((pr-auto-region t)
+	 (pr-auto-mode   t)
+	 filename)
+     (cond ((null select))
+	   ((listp select)
+	    (pr-ps-name))
+	   ((and (symbolp select)
+		 (assq select pr-ps-printer-alist))
+	    (pr-menu-set-ps-title select))
+	   ((integerp select)
+	    (and (/= select 1)
+		 (pr-ps-name))
+	    (and (>= select 1) (not pr-spool-p)
+		 (setq filename (pr-ps-outfile-preprint
+				 (if pr-print-using-ghostscript
+				     "Fast GS "
+				   "Fast "))))))
+     (pr-ps-buffer-ps-print
+      (if (integerp n-up)
+	  (min (max n-up 1) 100)
+	(error "n-up must be an integer greater than zero"))
+      filename))))
 
 
 ;;;###autoload
@@ -4296,15 +4268,16 @@
 Note that this command always behaves as if `pr-auto-region' and `pr-auto-mode'
 are both set to t."
   (interactive (list current-prefix-arg))
-  (cond ((null select-printer))
-	((and (symbolp select-printer)
-	      (assq select-printer pr-txt-printer-alist))
-	 (pr-menu-set-txt-title select-printer))
-	(t
-	 (pr-txt-name)))
-  (let ((pr-auto-region t)
-	(pr-auto-mode   t))
-    (pr-txt-buffer)))
+  (pr-save-interactive
+   (cond ((null select-printer))
+	 ((and (symbolp select-printer)
+	       (assq select-printer pr-txt-printer-alist))
+	  (pr-menu-set-txt-title select-printer))
+	 (t
+	  (pr-txt-name)))
+   (let ((pr-auto-region t)
+	 (pr-auto-mode   t))
+     (pr-txt-buffer))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -4350,6 +4323,7 @@
       nil
       '(20 . pr-temp-dir)
       '(20 . pr-ps-temp-file)
+      '(20 . pr-file-modes)
       '(20 . pr-delete-temp-file)
       '(20 . pr-list-directory)
       nil
@@ -4704,7 +4678,7 @@
 
     ;; GNU Emacs
     (defun pr-menu-lock (entry index horizontal state path)
-      (when (and (not (interactive-p)) pr-menu-lock)
+      (when (and (not pr-interactive-p) pr-menu-lock)
 	(or (and pr-menu-position (eq state pr-menu-state))
 	    (setq pr-menu-position (pr-menu-position entry index horizontal)
 		  pr-menu-state    state))
@@ -4726,7 +4700,7 @@
 
     ;; XEmacs
     (defun pr-menu-lock (entry index horizontal state path)
-      (when (and (not (interactive-p)) pr-menu-lock)
+      (when (and (not pr-interactive-p) pr-menu-lock)
 	(or (and pr-menu-position (eq state pr-menu-state))
 	    (setq pr-menu-position (pr-menu-position entry index horizontal)
 		  pr-menu-state    state))
@@ -4757,10 +4731,11 @@
 non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
 non-nil."
   (interactive "P")
-  (pr-update-var 'pr-ps-name pr-ps-printer-alist)
-  (pr-update-var 'pr-txt-name pr-txt-printer-alist)
-  (pr-update-var 'pr-ps-utility pr-ps-utility-alist)
-  (pr-do-update-menus force))
+  (pr-save-interactive
+   (pr-update-var 'pr-ps-name pr-ps-printer-alist)
+   (pr-update-var 'pr-txt-name pr-txt-printer-alist)
+   (pr-update-var 'pr-ps-utility pr-ps-utility-alist)
+   (pr-do-update-menus force)))
 
 
 (defvar pr-ps-printer-menu-modified  t
@@ -5280,7 +5255,7 @@
   (or (symbol-value n-up-sym)
       (set n-up-sym (pr-interactive-n-up prompt)))
   (and (eq (symbol-value infile-sym) t)
-       (set infile-sym (and (not (interactive-p))
+       (set infile-sym (and (not pr-interactive-p)
 			    (pr-ps-infile-preprint prompt))))
   ;; input file
   (or (symbol-value infile-sym)
@@ -5288,7 +5263,7 @@
   (set infile-sym (pr-dosify-file-name (symbol-value infile-sym)))
   ;; output file
   (and (eq (symbol-value outfile-sym) t)
-       (set outfile-sym (and (not (interactive-p))
+       (set outfile-sym (and (not pr-interactive-p)
 			     current-prefix-arg
 			     (pr-ps-outfile-preprint prompt))))
   (and (symbol-value outfile-sym)
@@ -5331,23 +5306,24 @@
 
 
 (defun pr-call-process (command &rest args)
-  (let ((buffer (get-buffer-create "*Printing Command Output*"))
-	(cmd    (pr-command command))
-	status)
-    (setq args (pr-remove-nil-from-list args))
-    (save-excursion
-      (set-buffer buffer)
-      (goto-char (point-max))
-      (insert (format "%s %S\n" cmd args)))
-    (setq status
-	  (condition-case data
-	      (apply 'call-process cmd nil buffer nil args)
-	    ((quit error)
-	     (error-message-string data))))
-    (save-excursion
-      (set-buffer buffer)
-      (goto-char (point-max))
-      (insert (format "Exit status: %s\n" status)))))
+  (pr-save-file-modes
+   (let ((buffer (get-buffer-create "*Printing Command Output*"))
+	 (cmd    (pr-command command))
+	 status)
+     (setq args (pr-remove-nil-from-list args))
+     (save-excursion
+       (set-buffer buffer)
+       (goto-char (point-max))
+       (insert (format "%s %S\n" cmd args)))
+     (setq status
+	   (condition-case data
+	       (apply 'call-process cmd nil buffer nil args)
+	     ((quit error)
+	      (error-message-string data))))
+     (save-excursion
+       (set-buffer buffer)
+       (goto-char (point-max))
+       (insert (format "Exit status: %s\n" status))))))
 
 
 (defun pr-txt-print (from to)
@@ -5485,7 +5461,7 @@
 (defun pr-set-outfilename (filename-sym)
   (and (not pr-spool-p)
        (eq (symbol-value filename-sym) t)
-       (set filename-sym (and (not (interactive-p))
+       (set filename-sym (and (not pr-interactive-p)
 			      current-prefix-arg
 			      (ps-print-preprint current-prefix-arg))))
   (and (symbol-value filename-sym)
@@ -5580,41 +5556,42 @@
 
 
 (defun pr-text2ps (kind n-up filename &optional from to)
-  (let ((ps-n-up-printing n-up)
-	(ps-spool-config (and (eq ps-spool-config 'setpagedevice)
-			      'setpagedevice)))
-    (pr-delete-file-if-exists filename)
-    (cond (pr-faces-p
-	   (cond (pr-spool-p
-		  ;; pr-faces-p and pr-spool-p
-		  ;; here FILENAME arg is ignored
-		  (cond ((eq kind 'buffer)
-			 (ps-spool-buffer-with-faces))
-			((eq kind 'region)
-			 (ps-spool-region-with-faces (or from (point))
-						     (or to (mark))))
-			))
+  (pr-save-file-modes
+   (let ((ps-n-up-printing n-up)
+	 (ps-spool-config (and (eq ps-spool-config 'setpagedevice)
+			       'setpagedevice)))
+     (pr-delete-file-if-exists filename)
+     (cond (pr-faces-p
+	    (cond (pr-spool-p
+		   ;; pr-faces-p and pr-spool-p
+		   ;; here FILENAME arg is ignored
+		   (cond ((eq kind 'buffer)
+			  (ps-spool-buffer-with-faces))
+			 ((eq kind 'region)
+			  (ps-spool-region-with-faces (or from (point))
+						      (or to (mark))))
+			 ))
 		  ;; pr-faces-p and not pr-spool-p
-		 ((eq kind 'buffer)
-		  (ps-print-buffer-with-faces filename))
-		 ((eq kind 'region)
-		  (ps-print-region-with-faces (or from (point))
-					      (or to (mark)) filename))
-		 ))
-	  (pr-spool-p
-	   ;; not pr-faces-p and pr-spool-p
-	   ;; here FILENAME arg is ignored
-	   (cond ((eq kind 'buffer)
-		  (ps-spool-buffer))
-		 ((eq kind 'region)
-		  (ps-spool-region (or from (point)) (or to (mark))))
-		 ))
-	  ;; not pr-faces-p and not pr-spool-p
-	  ((eq kind 'buffer)
-	   (ps-print-buffer filename))
-	  ((eq kind 'region)
-	   (ps-print-region (or from (point)) (or to (mark)) filename))
-	  )))
+		  ((eq kind 'buffer)
+		   (ps-print-buffer-with-faces filename))
+		  ((eq kind 'region)
+		   (ps-print-region-with-faces (or from (point))
+					       (or to (mark)) filename))
+		  ))
+	   (pr-spool-p
+	    ;; not pr-faces-p and pr-spool-p
+	    ;; here FILENAME arg is ignored
+	    (cond ((eq kind 'buffer)
+		   (ps-spool-buffer))
+		  ((eq kind 'region)
+		   (ps-spool-region (or from (point)) (or to (mark))))
+		  ))
+	   ;; not pr-faces-p and not pr-spool-p
+	   ((eq kind 'buffer)
+	    (ps-print-buffer filename))
+	   ((eq kind 'region)
+	    (ps-print-region (or from (point)) (or to (mark)) filename))
+	   ))))
 
 
 (defun pr-command (command)
@@ -6154,19 +6131,21 @@
 (defun pr-interface-ps-print (&rest ignore)
   "Print using ps-print package."
   (interactive)
-  (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print
-		   'pr-ps-file-ps-print 'pr-ps-file-up-ps-print
-		   'pr-ps-region-ps-print 'pr-ps-mode-ps-print
-		   'pr-ps-buffer-ps-print))
+  (pr-save-interactive
+   (pr-interface-ps 'pr-despool-ps-print 'pr-ps-directory-ps-print
+		    'pr-ps-file-ps-print 'pr-ps-file-up-ps-print
+		    'pr-ps-region-ps-print 'pr-ps-mode-ps-print
+		    'pr-ps-buffer-ps-print)))
 
 
 (defun pr-interface-preview (&rest ignore)
   "Preview a PostScript file."
   (interactive)
-  (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview
-		   'pr-ps-file-preview 'pr-ps-file-up-preview
-		   'pr-ps-region-preview 'pr-ps-mode-preview
-		   'pr-ps-buffer-preview))
+  (pr-save-interactive
+   (pr-interface-ps 'pr-despool-preview 'pr-ps-directory-preview
+		    'pr-ps-file-preview 'pr-ps-file-up-preview
+		    'pr-ps-region-preview 'pr-ps-mode-preview
+		    'pr-ps-buffer-preview)))
 
 
 (defun pr-interface-ps (ps-despool ps-directory ps-file ps-file-up ps-region