emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/printing.el,v


From: Vinicius Jose Latorre
Subject: [Emacs-diffs] Changes to emacs/lisp/printing.el,v
Date: Sat, 27 Oct 2007 00:25:44 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Vinicius Jose Latorre <viniciusjl>      07/10/27 00:25:43

Index: printing.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/printing.el,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- printing.el 23 Oct 2007 02:45:54 -0000      1.52
+++ printing.el 27 Oct 2007 00:25:43 -0000      1.53
@@ -6,11 +6,11 @@
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
 ;; Keywords: wp, print, PostScript
-;; Version: 6.9.1
+;; Version: 6.9.2
 ;; 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.2"
+  "printing.el, v 6.9.2 <2007/10/26 vinicius>
 
 Please send all bug fixes and enhancements to
        Vinicius Jose Latorre <address@hidden>
@@ -1093,394 +1093,746 @@
          (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-f-read-string          'ignore)
+  (defalias 'pr-f-set-keymap-parents   'ignore)
+  (defalias 'pr-keep-region-active     'ignore))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User Interface (I)
 
+;; Internal Vars --- defined here to avoid compiler warnings
+(defvar pr-menu-print-item "print"
+  "Non-nil means that menu binding was not done.
 
-(defgroup printing nil
-  "Printing Utilities group."
-  :tag "Printing Utilities"
-  :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
-  :prefix "pr-"
-  :version "20"
-  :group 'wp
-  :group 'postscript)
+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.")
 
-(defcustom pr-path-style
-  (if (and (not pr-cygwin-system)
-          ps-windows-system)
-      'windows
-    'unix)
-  "*Specify which path style to use for external commands.
+(defvar pr-txt-printer-menu-modified t
+  "Non-nil means `pr-txt-printer-alist' was modified and we need to update 
menu.")
 
-Valid values are:
+(defvar pr-ps-utility-menu-modified t
+  "Non-nil means `pr-ps-utility-alist' was modified and we need to update 
menu.")
 
-   windows     Windows 9x/NT style (\\)
+(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")))
 
-   unix                Unix style (/)"
-  :type '(choice :tag "Path style"
-                (const :tag "Windows 9x/NT Style (\\)" :value windows)
-                (const :tag "Unix Style (/)" :value unix))
-  :version "20"
-  :group 'printing)
 
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; XEmacs Definitions
 
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Customization Functions
+(cond
+ ((featurep 'xemacs)                   ; XEmacs
+  ;; XEmacs
+  (defalias 'pr-f-set-keymap-parents 'set-keymap-parents)
+  (defalias 'pr-f-set-keymap-name    'set-keymap-name)
 
+  ;; XEmacs
+  (defun pr-f-read-string (prompt initial history default)
+    (let ((str (read-string prompt initial)))
+      (if (and str (not (string= str "")))
+         str
+       default)))
 
-(defun pr-alist-custom-set (symbol value)
-  "Set the value of custom variables for printer & utility selection."
-  (set symbol value)
-  (and (featurep 'printing)            ; update only after printing is loaded
-       (pr-update-menus t)))
+  ;; XEmacs
+  (defvar zmacs-region-stays  nil)
 
+  ;; XEmacs
+  (defun pr-keep-region-active ()
+    (setq zmacs-region-stays t))
 
-(defun pr-ps-utility-custom-set (symbol value)
-  "Update utility menu entry."
-  (set symbol value)
-  (and (featurep 'printing)            ; update only after printing is loaded
-       (pr-menu-set-utility-title value)))
+  ;; XEmacs
+  (defun pr-region-active-p ()
+    (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))
 
+  ;; XEmacs
+  (defun pr-menu-char-height ()
+    (font-height (face-font 'default)))
 
-(defun pr-ps-name-custom-set (symbol value)
-  "Update `PostScript Printer:' menu entry."
-  (set symbol value)
-  (and (featurep 'printing)            ; update only after printing is loaded
-       (pr-menu-set-ps-title value)))
+  ;; XEmacs
+  (defun pr-menu-char-width ()
+    (font-width (face-font 'default)))
 
+  ;; XEmacs
+  (defmacro pr-xemacs-global-menubar (&rest body)
+    `(save-excursion
+       (let ((temp (get-buffer-create (make-temp-name " *Temp"))))
+        ;; be sure to access global menubar
+        (set-buffer temp)
+        ,@body
+        (kill-buffer temp))))
 
-(defun pr-txt-name-custom-set (symbol value)
-  "Update `Text Printer:' menu entry."
-  (set symbol value)
-  (and (featurep 'printing)            ; update only after printing is loaded
-       (pr-menu-set-txt-title value)))
+  ;; XEmacs
+  (defun pr-global-menubar (pr-menu-spec)
+    ;; Menu binding
+    (pr-xemacs-global-menubar
+     (add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))
+    (setq pr-menu-print-item nil))
 
+  ;; XEmacs
+  (defvar current-mouse-event nil)
+  (defun pr-menu-position (entry index horizontal)
+    (make-event
+     'button-release
+     (list 'button 1
+          'x (- (event-x-pixel current-mouse-event) ; X
+                (* horizontal pr-menu-char-width))
+          'y (- (event-y-pixel current-mouse-event) ; Y
+                (* (pr-menu-index entry index) pr-menu-char-height)))))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Internal Functions (I)
+  (defvar pr-menu-position nil)
+  (defvar pr-menu-state nil)
 
+  ;; XEmacs
+  (defvar current-menubar nil)         ; to avoid compilation gripes
+  (defun pr-menu-lookup (path)
+    (car (find-menu-item current-menubar (cons "Printing" path))))
 
-(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))
+  ;; XEmacs
+  (defun pr-menu-lock (entry index horizontal state path)
+    (when 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))
+      (let* ((menu   (pr-menu-lookup path))
+            (result (get-popup-menu-response menu pr-menu-position)))
+       (and (misc-user-event-p result)
+            (funcall (event-function result)
+                     (event-object result))))
+      (setq pr-menu-position nil)))
 
+  ;; XEmacs
+  (defalias 'pr-update-mode-line 'set-menubar-dirty-flag)
 
-(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))
+  ;; XEmacs
+  (defvar pr-ps-name-old     "PostScript Printers")
+  (defvar pr-txt-name-old    "Text Printers")
+  (defvar pr-ps-utility-old  "PostScript Utility")
+  (defvar pr-even-or-odd-old "Print All Pages")
 
+  ;; XEmacs
+  (defun pr-do-update-menus (&optional force)
+    (pr-menu-alist pr-ps-printer-alist
+                  'pr-ps-name
+                  'pr-menu-set-ps-title
+                  '("Printing")
+                  'pr-ps-printer-menu-modified
+                  force
+                  pr-ps-name-old
+                  'postscript 2)
+    (pr-menu-alist pr-txt-printer-alist
+                  'pr-txt-name
+                  'pr-menu-set-txt-title
+                  '("Printing")
+                  'pr-txt-printer-menu-modified
+                  force
+                  pr-txt-name-old
+                  'text 2)
+    (let ((save-var pr-ps-utility-menu-modified))
+      (pr-menu-alist pr-ps-utility-alist
+                    'pr-ps-utility
+                    'pr-menu-set-utility-title
+                    '("Printing" "PostScript Print" "File")
+                    'save-var
+                    force
+                    pr-ps-utility-old
+                    nil 1))
+    (pr-menu-alist pr-ps-utility-alist
+                  'pr-ps-utility
+                  'pr-menu-set-utility-title
+                  '("Printing" "PostScript Preview" "File")
+                  'pr-ps-utility-menu-modified
+                  force
+                  pr-ps-utility-old
+                  nil 1)
+    (pr-even-or-odd-pages ps-even-or-odd-pages force))
 
-(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)))
+  ;; XEmacs
+  (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
+                             entry index)
+    (when (and alist (or force (symbol-value modified-sym)))
+      (pr-xemacs-global-menubar
+       (add-submenu menu-path
+                   (pr-menu-create name alist var-sym
+                                   fun entry index)))
+      (funcall fun (symbol-value var-sym))
+      (set modified-sym nil)))
 
+  ;; XEmacs
+  (defun pr-relabel-menu-item (newname var-sym)
+    (pr-xemacs-global-menubar
+     (relabel-menu-item
+      (list "Printing" (symbol-value var-sym))
+      newname)
+     (set var-sym newname)))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User Interface (II)
+  ;; XEmacs
+  (defun pr-menu-set-ps-title (value &optional item entry index)
+    (pr-relabel-menu-item (format "PostScript Printer: %s" value)
+                         'pr-ps-name-old)
+    (pr-ps-set-printer value)
+    (and index
+        (pr-menu-lock entry index 12 'toggle nil)))
 
+  ;; XEmacs
+  (defun pr-menu-set-txt-title (value &optional item entry index)
+    (pr-relabel-menu-item (format "Text Printer: %s" value)
+                         'pr-txt-name-old)
+    (pr-txt-set-printer value)
+    (and index
+        (pr-menu-lock entry index 12 'toggle nil)))
 
-(defcustom pr-path-alist
-  '((unix    PATH)
-    (cygwin  PATH)
-    (windows PATH))
-  "*Specify an alist for command paths.
+  ;; XEmacs
+  (defun pr-menu-set-utility-title (value &optional item entry index)
+    (pr-xemacs-global-menubar
+     (let ((newname (format "%s" value)))
+       (relabel-menu-item
+       (list "Printing" "PostScript Print" "File" pr-ps-utility-old)
+       newname)
+       (relabel-menu-item
+       (list "Printing" "PostScript Preview" "File" pr-ps-utility-old)
+       newname)
+       (setq pr-ps-utility-old newname)))
+    (pr-ps-set-utility value)
+    (and index
+        (pr-menu-lock entry index 5 nil '("PostScript Print" "File"))))
 
-It's used to find commands used for printing package, like gv, gs, gsview.exe,
-mpage, print.exe, etc.  See also `pr-command' function.
+  ;; XEmacs
+  (defun pr-even-or-odd-pages (value &optional no-lock)
+    (pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist))
+                         'pr-even-or-odd-old)
+    (setq ps-even-or-odd-pages value)
+    (or no-lock
+       (pr-menu-lock 'postscript-options 8 12 'toggle nil)))
 
-Each element has the form:
-
-   (ENTRY DIRECTORY...)
+  )
+ (t                                    ; GNU Emacs
+  ;; Do nothing
+  ))                                   ; end cond featurep
 
-Where:
 
-ENTRY          It's a symbol, used to identify this entry.
-               There must exist at least one of the following entries:
 
-               unix    this entry is used when Emacs is running on GNU or
-                       Unix system.
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; GNU Emacs Definitions
 
-               cygwin  this entry is used when Emacs is running on Windows
-                       95/98/NT/2000 with Cygwin.
 
-               windows this entry is used when Emacs is running on Windows
-                       95/98/NT/2000.
+(cond
+ ((featurep 'xemacs)                   ; XEmacs
+  ;; Do nothing
+  )
+ (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)
 
-DIRECTORY      It should be a string or a symbol.  If it's a symbol, it should
-               exist an equal entry in `pr-path-alist'.  If it's a string,
-               it's considered a directory specification.
+  ;; GNU Emacs
+  (defvar deactivate-mark)
 
-               The directory specification may contain:
-               $var    environment variable expansion
-               ~/      tilde expansion
-               ./      current directory
-               ../     previous directory
+  ;; GNU Emacs
+  (defun pr-keep-region-active ()
+    (setq deactivate-mark nil))
 
-               For example, let's say the home directory is /home/my and the
-               current directory is /home/my/dir, so:
+  ;; GNU Emacs
+  (defun pr-region-active-p ()
+    (and pr-auto-region transient-mark-mode mark-active))
 
-               THE ENTRY                       IS EXPANDED TO
-               ~/entry                         /home/my/entry
-               ./entry                         /home/my/dir/entry
-               ../entry                        /home/my/entry
-               $HOME/entry                     /home/my/entry
-               $HOME/~/other/../my/entry       /home/my/entry
+  ;; GNU Emacs
+  (defun pr-menu-char-height ()
+    (frame-char-height))
 
-               SPECIAL SYMBOL: If the symbol `PATH' is used in the directory
-               list and there isn't a `PATH' entry in `pr-path-alist' or the
-               `PATH' entry has a null directory list, the PATH environment
-               variable is used.
+  ;; GNU Emacs
+  (defun pr-menu-char-width ()
+    (frame-char-width))
 
-Examples:
+  (defvar pr-menu-bar nil
+    "Specify Printing menu-bar entry.")
 
-* On GNU or Unix system:
+  ;; 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
 
-   '((unix      \".\" \"~/bin\" ghostview mpage PATH)
-     (ghostview \"$HOME/bin/gsview-dir\")
-     (mpage     \"$HOME/bin/mpage-dir\")
+  (eval-and-compile
+    (cond
+     ;; GNU Emacs 20
+     ((< emacs-major-version 21)
+      (defun pr-global-menubar (pr-menu-spec)
+       (require 'easymenu)
+       (easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
+       (when pr-menu-print-item
+         (easy-menu-remove-item nil '("tools") pr-menu-print-item)
+         (setq pr-menu-print-item nil
+               pr-menu-bar (vector 'menu-bar 'tools
+                                   (pr-get-symbol "Printing")))))
      )
+     ;; GNU Emacs 21 & 22
+     (t
+      (defun pr-global-menubar (pr-menu-spec)
+       (require 'easymenu)
+       (let ((menu-file (if (= emacs-major-version 21)
+                            '("menu-bar" "files") ; GNU Emacs 21
+                          '("menu-bar" "file")))) ; GNU Emacs 22 or higher
+         (cond
+          (pr-menu-print-item
+           (easy-menu-add-item global-map menu-file
+                               (easy-menu-create-menu "Print" pr-menu-spec)
+                               "print-buffer")
+           (dolist (item '("print-buffer"          "print-region"
+                           "ps-print-buffer-faces" "ps-print-region-faces"
+                           "ps-print-buffer"       "ps-print-region"))
+             (easy-menu-remove-item global-map menu-file item))
+           (setq pr-menu-print-item nil
+                 pr-menu-bar (vector 'menu-bar
+                                     (pr-get-symbol (nth 1 menu-file))
+                                     (pr-get-symbol "Print"))))
+          (t
+           (easy-menu-add-item global-map menu-file
+                               (easy-menu-create-menu "Print" pr-menu-spec)))
+          )))
+      )))
 
-* On Windows system:
+  (eval-and-compile
+    (cond
+     (ps-windows-system
+      ;; GNU Emacs for Windows 9x/NT
+      (defun pr-menu-position (entry index horizontal)
+       (let ((pos (cdr (mouse-pixel-position))))
+         (list
+          (list (or (car pos) 0)       ; X
+                (- (or (cdr pos) 0)    ; Y
+                   (* (pr-menu-index entry index) pr-menu-char-height)))
+          (selected-frame))))          ; frame
+      )
+     (t
+      ;; GNU Emacs
+      (defun pr-menu-position (entry index horizontal)
+       (let ((pos (cdr (mouse-pixel-position))))
+         (list
+          (list (- (or (car pos) 0)    ; X
+                   (* horizontal pr-menu-char-width))
+                (- (or (cdr pos) 0)    ; Y
+                   (* (pr-menu-index entry index) pr-menu-char-height)))
+          (selected-frame))))          ; frame
+      )))
 
-   '((windows   \"c:/applications/executables\" PATH ghostview mpage)
-     (ghostview \"c:/gs/gsview-dir\")
-     (mpage     \"c:/mpage-dir\")
-     )"
-  :type '(repeat
-         (cons :tag ""
-               (symbol :tag "Identifier    ")
-               (repeat :tag "Directory List"
-                       (choice :menu-tag "Directory"
-                               :tag "Directory"
-                               (string :value "")
-                               (symbol :value symbol)))))
-  :version "20"
-  :group 'printing)
+  (defvar pr-menu-position nil)
+  (defvar pr-menu-state nil)
 
+  ;; GNU Emacs
+  (defun pr-menu-lookup (path)
+    (lookup-key global-map
+               (if path
+                   (vconcat pr-menu-bar
+                            (mapcar 'pr-get-symbol
+                                    (if (listp path)
+                                        path
+                                      (list path))))
+                 pr-menu-bar)))
 
-(defcustom pr-txt-name 'default
-  "*Specify a printer for printing a text file.
+  ;; GNU Emacs
+  (defun pr-menu-lock (entry index horizontal state path)
+    (when 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))
+      (let* ((menu   (pr-menu-lookup path))
+            (result (x-popup-menu pr-menu-position menu)))
+       (and result
+            (let ((command (lookup-key menu (vconcat result))))
+              (if (fboundp command)
+                  (funcall command)
+                (eval command)))))
+      (setq pr-menu-position nil)))
 
-The printer name symbol should be defined on `pr-txt-printer-alist' (see it for
-documentation).
+  ;; GNU Emacs
+  (defalias 'pr-update-mode-line 'force-mode-line-update)
 
-This variable should be modified by customization engine.  If this variable is
-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)
+  ;; GNU Emacs
+  (defun pr-do-update-menus (&optional force)
+    (pr-menu-alist pr-ps-printer-alist
+                  'pr-ps-name
+                  'pr-menu-set-ps-title
+                  "PostScript Printers"
+                  'pr-ps-printer-menu-modified
+                  force
+                  "PostScript Printers"
+                  'postscript 2)
+    (pr-menu-alist pr-txt-printer-alist
+                  'pr-txt-name
+                  'pr-menu-set-txt-title
+                  "Text Printers"
+                  'pr-txt-printer-menu-modified
+                  force
+                  "Text Printers"
+                  'text 2)
+    (let ((save-var pr-ps-utility-menu-modified))
+      (pr-menu-alist pr-ps-utility-alist
+                    'pr-ps-utility
+                    'pr-menu-set-utility-title
+                    '("PostScript Print" "File" "PostScript Utility")
+                    'save-var
+                    force
+                    "PostScript Utility"
+                    nil 1))
+    (pr-menu-alist pr-ps-utility-alist
+                  'pr-ps-utility
+                  'pr-menu-set-utility-title
+                  '("PostScript Preview" "File" "PostScript Utility")
+                  'pr-ps-utility-menu-modified
+                  force
+                  "PostScript Utility"
+                  nil 1)
+    (pr-even-or-odd-pages ps-even-or-odd-pages force))
 
+  ;; GNU Emacs
+  (defun pr-menu-get-item (name-list)
+    ;; NAME-LIST is a string or a list of strings.
+    (or (listp name-list)
+       (setq name-list (list name-list)))
+    (and name-list
+        (let* ((reversed (reverse name-list))
+               (name (pr-get-symbol (car reversed)))
+               (path (nreverse (cdr reversed)))
+               (menu (lookup-key
+                      global-map
+                      (vconcat pr-menu-bar
+                               (mapcar 'pr-get-symbol path)))))
+          (assq name (nthcdr 2 menu)))))
 
-(defcustom pr-txt-printer-alist
-  (list (list 'default lpr-command nil
-             (cond ((boundp 'printer-name) printer-name)
-                   (ps-windows-system "PRN")
-                   (t nil)
-                   )))
-  ;; Examples:
-  ;; * On GNU or Unix system:
-  ;;    '((prt_06a "lpr" nil "prt_06a")
-  ;;      (prt_07c nil   nil "prt_07c")
-  ;;      )
-  ;; * On Windows system:
-  ;;    '((prt_06a  "print"     nil "/D:\\\\printers\\prt_06a")
-  ;;      (prt_07c  nil         nil "/D:\\\\printers\\prt_07c")
-  ;;      (PRN      ""          nil "PRN")
-  ;;      (standard "redpr.exe" nil "")
-  ;;      )
-  "*Specify an alist of all text printers (text printer database).
+  ;; GNU Emacs
+  (defvar pr-temp-menu nil)
 
-The alist element has the form:
+  ;; GNU Emacs
+  (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
+                             entry index)
+    (when (and alist (or force (symbol-value modified-sym)))
+      (easy-menu-define pr-temp-menu nil ""
+       (pr-menu-create name alist var-sym fun entry index))
+      (let ((item (pr-menu-get-item menu-path)))
+       (and item
+            (let* ((binding     (nthcdr 3 item))
+                   (key-binding (cdr binding)))
+              (setcar binding pr-temp-menu)
+              (and key-binding (listp (car key-binding))
+                   (setcdr binding (cdr key-binding))) ; skip KEY-BINDING
+              (funcall fun (symbol-value var-sym) item))))
+      (set modified-sym nil)))
 
-   (SYMBOL COMMAND SWITCHES NAME)
+  ;; GNU Emacs
+  (defun pr-menu-set-item-name (item name)
+    (and item
+        (setcar (nthcdr 2 item) name))) ; ITEM-NAME
 
-Where:
+  ;; GNU Emacs
+  (defun pr-menu-set-ps-title (value &optional item entry index)
+    (pr-menu-set-item-name (or item
+                              (pr-menu-get-item "PostScript Printers"))
+                          (format "PostScript Printer: %s" value))
+    (pr-ps-set-printer value)
+    (and index
+        (pr-menu-lock entry index 12 'toggle nil)))
 
-SYMBOL         It's a symbol to identify a text printer.  It's for
-               `pr-txt-name' variable setting and for menu selection.
-               Examples:
-                       'prt_06a
-                       'my_printer
+  ;; GNU Emacs
+  (defun pr-menu-set-txt-title (value &optional item entry index)
+    (pr-menu-set-item-name (or item
+                              (pr-menu-get-item "Text Printers"))
+                          (format "Text Printer: %s" value))
+    (pr-txt-set-printer value)
+    (and index
+        (pr-menu-lock entry index 12 'toggle nil)))
 
-COMMAND                Name of the program for printing a text file.  On 
MS-DOS and
-               MS-Windows systems, if the value is an empty string, then Emacs
-               will write directly to the printer port given by NAME (see text
-               below), that is, the NAME should be something like \"PRN\" or
-               \"LPT1:\".
-               If NAME is something like \"\\\\\\\\host\\\\share-name\" then
-               COMMAND shouldn't be an empty string.
-               The programs `print' and `nprint' (the standard print programs
-               on Windows NT and Novell Netware respectively) are handled
-               specially, using NAME as the destination for output; any other
-               program is treated like `lpr' except that an explicit filename
-               is given as the last argument.
-               If COMMAND is nil, it's used the default printing program:
-               `print' for Windows system, `lp' for lp system and `lpr' for
-               all other systems.  See also `pr-path-alist'.
-               Examples:
-                       \"print\"
-                       \"lpr\"
-                       \"lp\"
+  ;; GNU Emacs
+  (defun pr-menu-set-utility-title (value &optional item entry index)
+    (let ((name (symbol-name value)))
+      (if item
+         (pr-menu-set-item-name item name)
+       (pr-menu-set-item-name
+        (pr-menu-get-item
+         '("PostScript Print"   "File" "PostScript Utility"))
+        name)
+       (pr-menu-set-item-name
+        (pr-menu-get-item
+         '("PostScript Preview" "File" "PostScript Utility"))
+        name)))
+    (pr-ps-set-utility value)
+    (and index
+        (pr-menu-lock entry index 5 nil '("PostScript Print" "File"))))
 
-SWITCHES       List of sexp's to pass as extra options for text printer
-               program.  It is recommended to set NAME (see text below)
-               instead of including an explicit switch on this list.
-               Example:
-                  . for lpr
-                       '(\"-#3\" \"-l\")
-                       nil
+  ;; GNU Emacs
+  (defun pr-even-or-odd-pages (value &optional no-lock)
+    (pr-menu-set-item-name (pr-menu-get-item "Print All Pages")
+                          (cdr (assq value pr-even-or-odd-alist)))
+    (setq ps-even-or-odd-pages value)
+    (or no-lock
+       (pr-menu-lock 'postscript-options 8 12 'toggle nil)))
 
-NAME           A string that specifies a text printer name.
-               On Unix-like systems, a string value should be a name
-               understood by lpr's -P option (or lp's -d option).
-               On MS-DOS and MS-Windows systems, it is the name of a printer
-               device or port.  Typical non-default settings would be \"LPT1:\"
-               to \"LPT3:\" for parallel printers, or \"COM1\" to \"COM4\" or
-               \"AUX\" for serial printers, or \"\\\\\\\\hostname\\\\printer\"
-               (or \"/D:\\\\\\\\hostname\\\\printer\") for a shared network
-               printer.  You can also set it to a name of a file, in which
-               case the output gets appended to that file.  If you want to
-               discard the printed output, set this to \"NUL\".
-               Examples:
-                  . for print.exe
-                       \"/D:\\\\\\\\host\\\\share-name\"
-                       \"LPT1:\"
-                       \"PRN\"
+  ))                                   ; end cond featurep
 
-                  . for lpr or lp
-                       \"share-name\"
 
-This variable should be modified by customization engine.  If this variable is
-modified by other means (for example, a lisp function), use `pr-update-menus'
-function (see it for documentation) to update text printer menu.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Internal Functions (I)
 
-Examples:
 
-* On GNU or Unix system:
+(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))
 
-   '((prt_06a \"lpr\" nil \"prt_06a\")
-     (prt_07c nil   nil \"prt_07c\")
-     )
 
-* On Windows system:
+(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))
 
-   '((prt_06a  \"print\"     nil \"/D:\\\\\\\\printers\\\\prt_06a\")
-     (prt_07c  nil         nil \"/D:\\\\\\\\printers\\\\prt_07c\")
-     (PRN      \"\"          nil \"PRN\")
-     (standard \"redpr.exe\" nil \"\")
-     )
 
-Useful links:
+(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)))
 
-* Information about the print command (print.exe)
-  `http://www.computerhope.com/printhlp.htm'
 
-* RedMon - Redirection Port Monitor (redpr.exe)
-  `http://www.cs.wisc.edu/~ghost/redmon/index.htm'
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Customization Functions
 
-* Redirection Port Monitor (redpr.exe on-line help)
-  `http://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm'
 
-* UNIX man pages: lpr (or type `man lpr')
-  `http://bama.ua.edu/cgi-bin/man-cgi?lpr'
-  `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lpr'
+(defun pr-alist-custom-set (symbol value)
+  "Set the value of custom variables for printer & utility selection."
+  (set symbol value)
+  (and (featurep 'printing)            ; update only after printing is loaded
+       (pr-update-menus t)))
 
-* UNIX man pages: lp (or type `man lp')
-  `http://bama.ua.edu/cgi-bin/man-cgi?lp'
-  `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp'
-"
-  :type '(repeat
-         (list :tag "Text Printer"
-               (symbol :tag "Printer Symbol Name")
-               (string :tag "Printer Command")
-               (repeat :tag "Printer Switches"
-                       (sexp :tag "Switch" :value ""))
-               (choice :menu-tag "Printer Name"
-                       :tag "Printer Name"
-                       (const :tag "None" nil)
-                       string)))
-  :set 'pr-alist-custom-set
-  :version "20"
-  :group 'printing)
 
+(defun pr-ps-utility-custom-set (symbol value)
+  "Update utility menu entry."
+  (set symbol value)
+  (and (featurep 'printing)            ; update only after printing is loaded
+       (pr-menu-set-utility-title value)))
 
-(defcustom pr-ps-name 'default
-  "*Specify a printer for printing a PostScript file.
 
-This printer name symbol should be defined on `pr-ps-printer-alist' (see it for
-documentation).
+(defun pr-ps-name-custom-set (symbol value)
+  "Update `PostScript Printer:' menu entry."
+  (set symbol value)
+  (and (featurep 'printing)            ; update only after printing is loaded
+       (pr-menu-set-ps-title value)))
 
-This variable should be modified by customization engine.  If this variable is
-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)
 
+(defun pr-txt-name-custom-set (symbol value)
+  "Update `Text Printer:' menu entry."
+  (set symbol value)
+  (and (featurep 'printing)            ; update only after printing is loaded
+       (pr-menu-set-txt-title value)))
 
-(defcustom pr-ps-printer-alist
-  (list (list 'default lpr-command nil
-             (cond (ps-windows-system  nil)
-                   (ps-lp-system       "-d")
-                   (t                  "-P"))
-             (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name)))
-  ;; Examples:
-  ;; * On GNU or Unix system:
-  ;;    '((lps_06b "lpr" nil "-P" "lps_06b")
-  ;;      (lps_07c "lpr" nil nil  "lps_07c")
-  ;;      (lps_08c nil   nil nil  "lps_08c")
-  ;;      )
-  ;; * On Windows system:
-  ;;    '((lps_06a  "print"     nil "/D:" "\\\\printers\\lps_06a")
-  ;;      (lps_06b  "print"     nil nil   "\\\\printers\\lps_06b")
-  ;;      (lps_07c  "print"     nil ""    "/D:\\\\printers\\lps_07c")
-  ;;      (lps_08c  nil         nil nil   "\\\\printers\\lps_08c")
-  ;;      (b/w      "gsprint" ("-all" "-twoup") "-printer " "b/w-pr-name")
-  ;;      (LPT1     ""          nil ""    "LPT1:")
-  ;;      (PRN      ""          nil ""    "PRN")
-  ;;      (standard "redpr.exe" nil ""    "")
-  ;;      )
-  "*Specify an alist for all PostScript printers (PostScript printer database).
 
-The alist element has the form:
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; User Interface
 
-   (SYMBOL COMMAND SWITCHES PRINTER-SWITCH NAME DEFAULT...)
 
-Where:
+(defgroup printing nil
+  "Printing Utilities group."
+  :tag "Printing Utilities"
+  :link '(emacs-library-link :tag "Source Lisp File" "printing.el")
+  :prefix "pr-"
+  :version "20"
+  :group 'wp
+  :group 'postscript)
 
-SYMBOL         It's a symbol to identify a PostScript printer.  It's for
-               `pr-ps-name' variable setting and for menu selection.
-               Examples:
-                       'prt_06a
-                       'my_printer
 
-COMMAND                Name of the program for printing a PostScript file.  On 
MS-DOS
-               and MS-Windows systems, if the value is an empty string then
-               Emacs will write directly to the printer port given by NAME
-               (see text below), that is, the NAME should be something like
-               \"PRN\" or \"LPT1:\".
-               If NAME is something like \"\\\\\\\\host\\\\share-name\" then
-               COMMAND shouldn't be an empty string.
-               The programs `print' and `nprint' (the standard print programs
-               on Windows NT and Novell Netware respectively) are handled
-               specially, using NAME as the destination for output; any other
+(defcustom pr-path-style
+  (if (and (not pr-cygwin-system)
+          ps-windows-system)
+      'windows
+    'unix)
+  "*Specify which path style to use for external commands.
+
+Valid values are:
+
+   windows     Windows 9x/NT style (\\)
+
+   unix                Unix style (/)"
+  :type '(choice :tag "Path style"
+                (const :tag "Windows 9x/NT Style (\\)" :value windows)
+                (const :tag "Unix Style (/)" :value unix))
+  :version "20"
+  :group 'printing)
+
+
+(defcustom pr-path-alist
+  '((unix    PATH)
+    (cygwin  PATH)
+    (windows PATH))
+  "*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.
+
+Each element has the form:
+
+   (ENTRY DIRECTORY...)
+
+Where:
+
+ENTRY          It's a symbol, used to identify this entry.
+               There must exist at least one of the following entries:
+
+               unix    this entry is used when Emacs is running on GNU or
+                       Unix system.
+
+               cygwin  this entry is used when Emacs is running on Windows
+                       95/98/NT/2000 with Cygwin.
+
+               windows this entry is used when Emacs is running on Windows
+                       95/98/NT/2000.
+
+DIRECTORY      It should be a string or a symbol.  If it's a symbol, it should
+               exist an equal entry in `pr-path-alist'.  If it's a string,
+               it's considered a directory specification.
+
+               The directory specification may contain:
+               $var    environment variable expansion
+               ~/      tilde expansion
+               ./      current directory
+               ../     previous directory
+
+               For example, let's say the home directory is /home/my and the
+               current directory is /home/my/dir, so:
+
+               THE ENTRY                       IS EXPANDED TO
+               ~/entry                         /home/my/entry
+               ./entry                         /home/my/dir/entry
+               ../entry                        /home/my/entry
+               $HOME/entry                     /home/my/entry
+               $HOME/~/other/../my/entry       /home/my/entry
+
+               SPECIAL SYMBOL: If the symbol `PATH' is used in the directory
+               list and there isn't a `PATH' entry in `pr-path-alist' or the
+               `PATH' entry has a null directory list, the PATH environment
+               variable is used.
+
+Examples:
+
+* On GNU or Unix system:
+
+   '((unix      \".\" \"~/bin\" ghostview mpage PATH)
+     (ghostview \"$HOME/bin/gsview-dir\")
+     (mpage     \"$HOME/bin/mpage-dir\")
+     )
+
+* On Windows system:
+
+   '((windows   \"c:/applications/executables\" PATH ghostview mpage)
+     (ghostview \"c:/gs/gsview-dir\")
+     (mpage     \"c:/mpage-dir\")
+     )"
+  :type '(repeat
+         (cons :tag ""
+               (symbol :tag "Identifier    ")
+               (repeat :tag "Directory List"
+                       (choice :menu-tag "Directory"
+                               :tag "Directory"
+                               (string :value "")
+                               (symbol :value symbol)))))
+  :version "20"
+  :group 'printing)
+
+
+(defcustom pr-txt-name 'default
+  "*Specify a printer for printing a text file.
+
+The printer name symbol should be defined on `pr-txt-printer-alist' (see it for
+documentation).
+
+This variable should be modified by customization engine.  If this variable is
+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)
+
+
+(defcustom pr-txt-printer-alist
+  (list (list 'default lpr-command nil
+             (cond ((boundp 'printer-name) printer-name)
+                   (ps-windows-system "PRN")
+                   (t nil)
+                   )))
+  ;; Examples:
+  ;; * On GNU or Unix system:
+  ;;    '((prt_06a "lpr" nil "prt_06a")
+  ;;      (prt_07c nil   nil "prt_07c")
+  ;;      )
+  ;; * On Windows system:
+  ;;    '((prt_06a  "print"     nil "/D:\\\\printers\\prt_06a")
+  ;;      (prt_07c  nil         nil "/D:\\\\printers\\prt_07c")
+  ;;      (PRN      ""          nil "PRN")
+  ;;      (standard "redpr.exe" nil "")
+  ;;      )
+  "*Specify an alist of all text printers (text printer database).
+
+The alist element has the form:
+
+   (SYMBOL COMMAND SWITCHES NAME)
+
+Where:
+
+SYMBOL         It's a symbol to identify a text printer.  It's for
+               `pr-txt-name' variable setting and for menu selection.
+               Examples:
+                       'prt_06a
+                       'my_printer
+
+COMMAND                Name of the program for printing a text file.  On 
MS-DOS and
+               MS-Windows systems, if the value is an empty string, then Emacs
+               will write directly to the printer port given by NAME (see text
+               below), that is, the NAME should be something like \"PRN\" or
+               \"LPT1:\".
+               If NAME is something like \"\\\\\\\\host\\\\share-name\" then
+               COMMAND shouldn't be an empty string.
+               The programs `print' and `nprint' (the standard print programs
+               on Windows NT and Novell Netware respectively) are handled
+               specially, using NAME as the destination for output; any other
                program is treated like `lpr' except that an explicit filename
                is given as the last argument.
                If COMMAND is nil, it's used the default printing program:
@@ -1490,10 +1842,8 @@
                        \"print\"
                        \"lpr\"
                        \"lp\"
-                       \"cp\"
-                       \"gsprint\"
 
-SWITCHES       List of sexp's to pass as extra options for PostScript printer
+SWITCHES       List of sexp's to pass as extra options for text printer
                program.  It is recommended to set NAME (see text below)
                instead of including an explicit switch on this list.
                Example:
@@ -1501,29 +1851,7 @@
                        '(\"-#3\" \"-l\")
                        nil
 
-                  . for gsprint.exe
-                       '(\"-all\" \"-twoup\")
-
-PRINTER-SWITCH A string that specifies PostScript printer name switch.  If
-               it's necessary to have a space between PRINTER-SWITCH and NAME,
-               it should be inserted at the end of PRINTER-SWITCH string.
-               If PRINTER-SWITCH is nil, it's used the default printer name
-               switch: `/D:' for Windows system, `-d' for lp system and `-P'
-               for all other systems.
-               Examples:
-                  . for lpr
-                       \"-P \"
-
-                  . for lp
-                       \"-d \"
-
-                  . for print.exe
-                       \"/D:\"
-
-                  . for gsprint.exe
-                       \"-printer \"
-
-NAME           A string that specifies a PostScript printer name.
+NAME           A string that specifies a text printer name.
                On Unix-like systems, a string value should be a name
                understood by lpr's -P option (or lp's -d option).
                On MS-DOS and MS-Windows systems, it is the name of a printer
@@ -1535,87 +1863,264 @@
                case the output gets appended to that file.  If you want to
                discard the printed output, set this to \"NUL\".
                Examples:
-                  . for cp.exe
-                       \"\\\\\\\\host\\\\share-name\"
-
-                  . for print.exe or gsprint.exe
+                  . for print.exe
                        \"/D:\\\\\\\\host\\\\share-name\"
-                       \"\\\\\\\\host\\\\share-name\"
                        \"LPT1:\"
                        \"PRN\"
 
                   . for lpr or lp
                        \"share-name\"
 
-DEFAULT                It's a way to set default values when this entry is 
selected.
-               It's a cons like:
-
-                  (VARIABLE . VALUE)
-
-               Which associates VARIABLE with VALUE.  When this entry is
-               selected, it's executed the following command:
-
-                  (set VARIABLE (eval VALUE))
-
-               Note that VALUE can be any valid lisp expression.  So, don't
-               forget to quote symbols and constant lists.
-               If VARIABLE is the special keyword `inherits-from:', VALUE must
-               be a symbol name setting defined in `pr-setting-database' from
-               which the current setting inherits the context.  Take care with
-               circular inheritance.
-               Examples:
-                       '(ps-landscape-mode . nil)
-                       '(ps-spool-duplex . t)
-                       '(pr-gs-device . (my-gs-device t))
-
 This variable should be modified by customization engine.  If this variable is
 modified by other means (for example, a lisp function), use `pr-update-menus'
-function (see it for documentation) to update PostScript printer menu.
+function (see it for documentation) to update text printer menu.
 
 Examples:
 
 * On GNU or Unix system:
 
-   '((lps_06b \"lpr\" nil \"-P\" \"lps_06b\")
-     (lps_07c \"lpr\" nil nil  \"lps_07c\")
-     (lps_08c nil   nil nil  \"lps_08c\")
+   '((prt_06a \"lpr\" nil \"prt_06a\")
+     (prt_07c nil   nil \"prt_07c\")
      )
 
 * On Windows system:
 
-   '((lps_06a  \"print\"     nil \"/D:\" \"\\\\\\\\printers\\\\lps_06a\")
-     (lps_06b  \"print\"     nil nil   \"\\\\\\\\printers\\\\lps_06b\")
-     (lps_07c  \"print\"     nil \"\"    \"/D:\\\\\\\\printers\\\\lps_07c\")
-     (lps_08c  nil         nil nil   \"\\\\\\\\printers\\\\lps_08c\")
-     (b/w1 \"gsprint\" (\"-all\" \"-twoup\") \"-printer \" \"b/w-pr-name\")
-     (b/w2 \"gsprint\" (\"-all\" \"-twoup\") nil \"-printer 
\\\\\\\\printers\\\\lps_06a\")
-     (LPT1     \"\"          nil \"\"    \"LPT1:\")
-     (PRN      \"\"          nil \"\"    \"PRN\")
-     (standard \"redpr.exe\" nil \"\"    \"\")
+   '((prt_06a  \"print\"     nil \"/D:\\\\\\\\printers\\\\prt_06a\")
+     (prt_07c  nil         nil \"/D:\\\\\\\\printers\\\\prt_07c\")
+     (PRN      \"\"          nil \"PRN\")
+     (standard \"redpr.exe\" nil \"\")
      )
 
+Useful links:
 
-gsprint:
-
-You can use gsprint instead of ghostscript to print monochrome PostScript files
-in Windows.  The gsprint utility documentation says that it is more efficient
-than ghostscript to print monochrome PostScript.
-
-To print non-monochrome PostScript file, the efficiency of ghostscript is
-similar to gsprint.
+* Information about the print command (print.exe)
+  `http://www.computerhope.com/printhlp.htm'
 
-Also the gsprint utility comes together with gsview distribution.
+* RedMon - Redirection Port Monitor (redpr.exe)
+  `http://www.cs.wisc.edu/~ghost/redmon/index.htm'
 
-As an example of gsprint declaration:
+* Redirection Port Monitor (redpr.exe on-line help)
+  `http://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm'
 
-   (setq pr-ps-printer-alist
-        '((A \"gsprint\" (\"-all\" \"-twoup\") \"-printer \" \"lps_015\")
-          (B \"gsprint\" (\"-all\" \"-twoup\") nil \"-printer lps_015\")
-          ;; some other printer declaration
-          ))
+* UNIX man pages: lpr (or type `man lpr')
+  `http://bama.ua.edu/cgi-bin/man-cgi?lpr'
+  `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lpr'
 
-The example above declares that printer A prints all pages (-all) and two pages
-per sheet (-twoup).  The printer B declaration does the same as the printer A
+* UNIX man pages: lp (or type `man lp')
+  `http://bama.ua.edu/cgi-bin/man-cgi?lp'
+  `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp'
+"
+  :type '(repeat
+         (list :tag "Text Printer"
+               (symbol :tag "Printer Symbol Name")
+               (string :tag "Printer Command")
+               (repeat :tag "Printer Switches"
+                       (sexp :tag "Switch" :value ""))
+               (choice :menu-tag "Printer Name"
+                       :tag "Printer Name"
+                       (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.
+
+This printer name symbol should be defined on `pr-ps-printer-alist' (see it for
+documentation).
+
+This variable should be modified by customization engine.  If this variable is
+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)
+
+
+(defcustom pr-ps-printer-alist
+  (list (list 'default lpr-command nil
+             (cond (ps-windows-system  nil)
+                   (ps-lp-system       "-d")
+                   (t                  "-P"))
+             (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name)))
+  ;; Examples:
+  ;; * On GNU or Unix system:
+  ;;    '((lps_06b "lpr" nil "-P" "lps_06b")
+  ;;      (lps_07c "lpr" nil nil  "lps_07c")
+  ;;      (lps_08c nil   nil nil  "lps_08c")
+  ;;      )
+  ;; * On Windows system:
+  ;;    '((lps_06a  "print"     nil "/D:" "\\\\printers\\lps_06a")
+  ;;      (lps_06b  "print"     nil nil   "\\\\printers\\lps_06b")
+  ;;      (lps_07c  "print"     nil ""    "/D:\\\\printers\\lps_07c")
+  ;;      (lps_08c  nil         nil nil   "\\\\printers\\lps_08c")
+  ;;      (b/w      "gsprint" ("-all" "-twoup") "-printer " "b/w-pr-name")
+  ;;      (LPT1     ""          nil ""    "LPT1:")
+  ;;      (PRN      ""          nil ""    "PRN")
+  ;;      (standard "redpr.exe" nil ""    "")
+  ;;      )
+  "*Specify an alist for all PostScript printers (PostScript printer database).
+
+The alist element has the form:
+
+   (SYMBOL COMMAND SWITCHES PRINTER-SWITCH NAME DEFAULT...)
+
+Where:
+
+SYMBOL         It's a symbol to identify a PostScript printer.  It's for
+               `pr-ps-name' variable setting and for menu selection.
+               Examples:
+                       'prt_06a
+                       'my_printer
+
+COMMAND                Name of the program for printing a PostScript file.  On 
MS-DOS
+               and MS-Windows systems, if the value is an empty string then
+               Emacs will write directly to the printer port given by NAME
+               (see text below), that is, the NAME should be something like
+               \"PRN\" or \"LPT1:\".
+               If NAME is something like \"\\\\\\\\host\\\\share-name\" then
+               COMMAND shouldn't be an empty string.
+               The programs `print' and `nprint' (the standard print programs
+               on Windows NT and Novell Netware respectively) are handled
+               specially, using NAME as the destination for output; any other
+               program is treated like `lpr' except that an explicit filename
+               is given as the last argument.
+               If COMMAND is nil, it's used the default printing program:
+               `print' for Windows system, `lp' for lp system and `lpr' for
+               all other systems.  See also `pr-path-alist'.
+               Examples:
+                       \"print\"
+                       \"lpr\"
+                       \"lp\"
+                       \"cp\"
+                       \"gsprint\"
+
+SWITCHES       List of sexp's to pass as extra options for PostScript printer
+               program.  It is recommended to set NAME (see text below)
+               instead of including an explicit switch on this list.
+               Example:
+                  . for lpr
+                       '(\"-#3\" \"-l\")
+                       nil
+
+                  . for gsprint.exe
+                       '(\"-all\" \"-twoup\")
+
+PRINTER-SWITCH A string that specifies PostScript printer name switch.  If
+               it's necessary to have a space between PRINTER-SWITCH and NAME,
+               it should be inserted at the end of PRINTER-SWITCH string.
+               If PRINTER-SWITCH is nil, it's used the default printer name
+               switch: `/D:' for Windows system, `-d' for lp system and `-P'
+               for all other systems.
+               Examples:
+                  . for lpr
+                       \"-P \"
+
+                  . for lp
+                       \"-d \"
+
+                  . for print.exe
+                       \"/D:\"
+
+                  . for gsprint.exe
+                       \"-printer \"
+
+NAME           A string that specifies a PostScript printer name.
+               On Unix-like systems, a string value should be a name
+               understood by lpr's -P option (or lp's -d option).
+               On MS-DOS and MS-Windows systems, it is the name of a printer
+               device or port.  Typical non-default settings would be \"LPT1:\"
+               to \"LPT3:\" for parallel printers, or \"COM1\" to \"COM4\" or
+               \"AUX\" for serial printers, or \"\\\\\\\\hostname\\\\printer\"
+               (or \"/D:\\\\\\\\hostname\\\\printer\") for a shared network
+               printer.  You can also set it to a name of a file, in which
+               case the output gets appended to that file.  If you want to
+               discard the printed output, set this to \"NUL\".
+               Examples:
+                  . for cp.exe
+                       \"\\\\\\\\host\\\\share-name\"
+
+                  . for print.exe or gsprint.exe
+                       \"/D:\\\\\\\\host\\\\share-name\"
+                       \"\\\\\\\\host\\\\share-name\"
+                       \"LPT1:\"
+                       \"PRN\"
+
+                  . for lpr or lp
+                       \"share-name\"
+
+DEFAULT                It's a way to set default values when this entry is 
selected.
+               It's a cons like:
+
+                  (VARIABLE . VALUE)
+
+               Which associates VARIABLE with VALUE.  When this entry is
+               selected, it's executed the following command:
+
+                  (set VARIABLE (eval VALUE))
+
+               Note that VALUE can be any valid lisp expression.  So, don't
+               forget to quote symbols and constant lists.
+               If VARIABLE is the special keyword `inherits-from:', VALUE must
+               be a symbol name setting defined in `pr-setting-database' from
+               which the current setting inherits the context.  Take care with
+               circular inheritance.
+               Examples:
+                       '(ps-landscape-mode . nil)
+                       '(ps-spool-duplex . t)
+                       '(pr-gs-device . (my-gs-device t))
+
+This variable should be modified by customization engine.  If this variable is
+modified by other means (for example, a lisp function), use `pr-update-menus'
+function (see it for documentation) to update PostScript printer menu.
+
+Examples:
+
+* On GNU or Unix system:
+
+   '((lps_06b \"lpr\" nil \"-P\" \"lps_06b\")
+     (lps_07c \"lpr\" nil nil  \"lps_07c\")
+     (lps_08c nil   nil nil  \"lps_08c\")
+     )
+
+* On Windows system:
+
+   '((lps_06a  \"print\"     nil \"/D:\" \"\\\\\\\\printers\\\\lps_06a\")
+     (lps_06b  \"print\"     nil nil   \"\\\\\\\\printers\\\\lps_06b\")
+     (lps_07c  \"print\"     nil \"\"    \"/D:\\\\\\\\printers\\\\lps_07c\")
+     (lps_08c  nil         nil nil   \"\\\\\\\\printers\\\\lps_08c\")
+     (b/w1 \"gsprint\" (\"-all\" \"-twoup\") \"-printer \" \"b/w-pr-name\")
+     (b/w2 \"gsprint\" (\"-all\" \"-twoup\") nil \"-printer 
\\\\\\\\printers\\\\lps_06a\")
+     (LPT1     \"\"          nil \"\"    \"LPT1:\")
+     (PRN      \"\"          nil \"\"    \"PRN\")
+     (standard \"redpr.exe\" nil \"\"    \"\")
+     )
+
+
+gsprint:
+
+You can use gsprint instead of ghostscript to print monochrome PostScript files
+in Windows.  The gsprint utility documentation says that it is more efficient
+than ghostscript to print monochrome PostScript.
+
+To print non-monochrome PostScript file, the efficiency of ghostscript is
+similar to gsprint.
+
+Also the gsprint utility comes together with gsview distribution.
+
+As an example of gsprint declaration:
+
+   (setq pr-ps-printer-alist
+        '((A \"gsprint\" (\"-all\" \"-twoup\") \"-printer \" \"lps_015\")
+          (B \"gsprint\" (\"-all\" \"-twoup\") nil \"-printer lps_015\")
+          ;; some other printer declaration
+          ))
+
+The example above declares that printer A prints all pages (-all) and two pages
+per sheet (-twoup).  The printer B declaration does the same as the printer A
 declaration, the only difference is the printer name selection.
 
 There are other command line options like:
@@ -2412,6 +2917,30 @@
   :group 'printing)
 
 
+(defcustom pr-menu-char-height (pr-menu-char-height)
+  "*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.
+
+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)
+
+
 (defcustom pr-setting-database
   '((no-duplex                         ; setting symbol name
      nil nil nil                       ; inherits  local  kill-local
@@ -2551,638 +3080,133 @@
                              |[ ] Print Header Frame        |
                              |[ ] Line Number               |
                              |[ ] Zebra Stripes             |
-                             |[ ] Duplex                    |
-                             |[ ] Tumble                    |
-                             |[ ] Upside-Down               |
-                             |    Print All Pages          >|
-                             +------------------------------+
-   `postscript-process'              |[ ] Spool Buffer              |
-                             |[ ] Print with faces          |
-                             |[ ] Print via Ghostscript     |
-                             +------------------------------+
-   `printing'                |[ ] Auto Region               |
-                             |[ ] Auto Mode                 |
-                             |[ ] Menu Lock                 |
-                             +------------------------------+
-   `help'                    |    Customize                >|
-                             |    Show Settings            >|
-                             |    Help                      |
-                             +------------------------------+
-
-Any other value is ignored."
-  :type '(repeat :tag "Menu Visible Part"
-                (choice :menu-tag "Menu Part"
-                        :tag "Menu Part"
-                        (const postscript)
-                        (const text)
-                        (const postscript-options)
-                        (const postscript-process)
-                        (const printing)
-                        (const help)))
-  :version "20"
-  :group 'printing)
-
-
-(defcustom pr-delete-temp-file t
-  "*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.
-
-That is, any subdirectories (and the superdirectory) of the directory (given as
-argument of functions below) are also printed (as dired-mode listings).
-
-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.
-
-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.
-
-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.
-
-It's used by `pr-interface'."
-  :type 'boolean
-  :version "20"
-  :group 'printing)
-
-(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")))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Internal Variables
-
-
-(defvar pr-txt-command nil
-  "Name of program for printing a text file.
-See `pr-txt-printer-alist'.")
-
-
-(defvar pr-txt-switches nil
-  "List of sexp's to pass as extra options to the text printer program.
-See `pr-txt-printer-alist'.")
-
-
-(defvar pr-txt-printer nil
-  "Specify text printer name.
-See `pr-txt-printer-alist'.")
-
-
-(defvar pr-ps-command nil
-  "Name of program for printing a PostScript file.
-See `pr-ps-printer-alist'.")
-
-
-(defvar pr-ps-switches nil
-  "List of sexp's to pass as extra options to the PostScript printer program.
-See `pr-ps-printer-alist'.")
-
-
-(defvar pr-ps-printer-switch nil
-  "Specify PostScript printer name switch.
-See `pr-ps-printer-alist'.")
-
-
-(defvar pr-ps-printer nil
-  "Specify PostScript printer name.
-See `pr-ps-printer-alist'.")
-
-
-(defvar pr-menu-bar nil
-  "Specify Printing menu-bar entry.")
-
-(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.")
-
-(defvar pr-menu-char-width)   ;; Pacify the byte compiler.
-(defvar pr-menu-char-height)
-
-;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; XEmacs Definitions
-
-
-(cond
- ((featurep 'xemacs)                   ; XEmacs
-  ;; XEmacs
-  (defalias 'pr-f-set-keymap-parents 'set-keymap-parents)
-  (defalias 'pr-f-set-keymap-name    'set-keymap-name)
-
-  ;; XEmacs
-  (defun pr-f-read-string (prompt initial history default)
-    (let ((str (read-string prompt initial)))
-      (if (and str (not (string= str "")))
-         str
-       default)))
-
-  ;; XEmacs
-  (defvar zmacs-region-stays  nil)
-
-  ;; XEmacs
-  (defun pr-keep-region-active ()
-    (setq zmacs-region-stays t))
-
-  ;; XEmacs
-  (defun pr-region-active-p ()
-    (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))
-
-  ;; XEmacs
-  (defun pr-menu-char-height ()
-    (font-height (face-font 'default)))
-
-  ;; XEmacs
-  (defun pr-menu-char-width ()
-    (font-width (face-font 'default)))
-
-  ;; XEmacs
-  (defmacro pr-xemacs-global-menubar (&rest body)
-    `(save-excursion
-       (let ((temp (get-buffer-create (make-temp-name " *Temp"))))
-        ;; be sure to access global menubar
-        (set-buffer temp)
-        ,@body
-        (kill-buffer temp))))
-
-  ;; XEmacs
-  (defun pr-global-menubar (pr-menu-spec)
-    ;; Menu binding
-    (pr-xemacs-global-menubar
-     (add-submenu nil (cons "Printing" pr-menu-spec) "Apps"))
-    (setq pr-menu-print-item nil))
-
-  ;; XEmacs
-  (defvar current-mouse-event nil)
-  (defun pr-menu-position (entry index horizontal)
-    (make-event
-     'button-release
-     (list 'button 1
-          'x (- (event-x-pixel current-mouse-event) ; X
-                (* horizontal pr-menu-char-width))
-          'y (- (event-y-pixel current-mouse-event) ; Y
-                (* (pr-menu-index entry index) pr-menu-char-height)))))
-
-  (defvar pr-menu-position nil)
-  (defvar pr-menu-state nil)
-
-  ;; XEmacs
-  (defvar current-menubar nil)         ; to avoid compilation gripes
-  (defun pr-menu-lookup (path)
-    (car (find-menu-item current-menubar (cons "Printing" path))))
-
-  ;; XEmacs
-  (defun pr-menu-lock (entry index horizontal state path)
-    (when 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))
-      (let* ((menu   (pr-menu-lookup path))
-            (result (get-popup-menu-response menu pr-menu-position)))
-       (and (misc-user-event-p result)
-            (funcall (event-function result)
-                     (event-object result))))
-      (setq pr-menu-position nil)))
-
-  ;; XEmacs
-  (defalias 'pr-update-mode-line 'set-menubar-dirty-flag)
-
-  ;; XEmacs
-  (defvar pr-ps-name-old     "PostScript Printers")
-  (defvar pr-txt-name-old    "Text Printers")
-  (defvar pr-ps-utility-old  "PostScript Utility")
-  (defvar pr-even-or-odd-old "Print All Pages")
-
-  ;; XEmacs
-  (defun pr-do-update-menus (&optional force)
-    (pr-menu-alist pr-ps-printer-alist
-                  'pr-ps-name
-                  'pr-menu-set-ps-title
-                  '("Printing")
-                  'pr-ps-printer-menu-modified
-                  force
-                  pr-ps-name-old
-                  'postscript 2)
-    (pr-menu-alist pr-txt-printer-alist
-                  'pr-txt-name
-                  'pr-menu-set-txt-title
-                  '("Printing")
-                  'pr-txt-printer-menu-modified
-                  force
-                  pr-txt-name-old
-                  'text 2)
-    (let ((save-var pr-ps-utility-menu-modified))
-      (pr-menu-alist pr-ps-utility-alist
-                    'pr-ps-utility
-                    'pr-menu-set-utility-title
-                    '("Printing" "PostScript Print" "File")
-                    'save-var
-                    force
-                    pr-ps-utility-old
-                    nil 1))
-    (pr-menu-alist pr-ps-utility-alist
-                  'pr-ps-utility
-                  'pr-menu-set-utility-title
-                  '("Printing" "PostScript Preview" "File")
-                  'pr-ps-utility-menu-modified
-                  force
-                  pr-ps-utility-old
-                  nil 1)
-    (pr-even-or-odd-pages ps-even-or-odd-pages force))
-
-  ;; XEmacs
-  (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
-                             entry index)
-    (when (and alist (or force (symbol-value modified-sym)))
-      (pr-xemacs-global-menubar
-       (add-submenu menu-path
-                   (pr-menu-create name alist var-sym
-                                   fun entry index)))
-      (funcall fun (symbol-value var-sym))
-      (set modified-sym nil)))
-
-  ;; XEmacs
-  (defun pr-relabel-menu-item (newname var-sym)
-    (pr-xemacs-global-menubar
-     (relabel-menu-item
-      (list "Printing" (symbol-value var-sym))
-      newname)
-     (set var-sym newname)))
-
-  ;; XEmacs
-  (defun pr-menu-set-ps-title (value &optional item entry index)
-    (pr-relabel-menu-item (format "PostScript Printer: %s" value)
-                         'pr-ps-name-old)
-    (pr-ps-set-printer value)
-    (and index
-        (pr-menu-lock entry index 12 'toggle nil)))
-
-  ;; XEmacs
-  (defun pr-menu-set-txt-title (value &optional item entry index)
-    (pr-relabel-menu-item (format "Text Printer: %s" value)
-                         'pr-txt-name-old)
-    (pr-txt-set-printer value)
-    (and index
-        (pr-menu-lock entry index 12 'toggle nil)))
-
-  ;; XEmacs
-  (defun pr-menu-set-utility-title (value &optional item entry index)
-    (pr-xemacs-global-menubar
-     (let ((newname (format "%s" value)))
-       (relabel-menu-item
-       (list "Printing" "PostScript Print" "File" pr-ps-utility-old)
-       newname)
-       (relabel-menu-item
-       (list "Printing" "PostScript Preview" "File" pr-ps-utility-old)
-       newname)
-       (setq pr-ps-utility-old newname)))
-    (pr-ps-set-utility value)
-    (and index
-        (pr-menu-lock entry index 5 nil '("PostScript Print" "File"))))
-
-  ;; XEmacs
-  (defun pr-even-or-odd-pages (value &optional no-lock)
-    (pr-relabel-menu-item (cdr (assq value pr-even-or-odd-alist))
-                         'pr-even-or-odd-old)
-    (setq ps-even-or-odd-pages value)
-    (or no-lock
-       (pr-menu-lock 'postscript-options 8 12 'toggle nil)))
-
-  )
- (t                                    ; GNU Emacs
-  ;; Do nothing
-  ))                                   ; end cond featurep
-
-
-
-;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; GNU Emacs Definitions
-
-
-(cond
- ((featurep 'xemacs)                   ; XEmacs
-  ;; Do nothing
-  )
- (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)
-
-  ;; GNU Emacs
-  (defvar deactivate-mark)
-
-  ;; GNU Emacs
-  (defun pr-keep-region-active ()
-    (setq deactivate-mark nil))
-
-  ;; GNU Emacs
-  (defun pr-region-active-p ()
-    (and pr-auto-region transient-mark-mode mark-active))
-
-  ;; GNU Emacs
-  (defun pr-menu-char-height ()
-    (frame-char-height))
-
-  ;; GNU Emacs
-  (defun pr-menu-char-width ()
-    (frame-char-width))
-
-  ;; 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-and-compile
-    (cond
-     ;; GNU Emacs 20
-     ((< emacs-major-version 21)
-      (defun pr-global-menubar (pr-menu-spec)
-       (require 'easymenu)
-       (easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
-       (when pr-menu-print-item
-         (easy-menu-remove-item nil '("tools") pr-menu-print-item)
-         (setq pr-menu-print-item nil
-               pr-menu-bar (vector 'menu-bar 'tools
-                                   (pr-get-symbol "Printing")))))
-      )
-     ;; GNU Emacs 21 & 22
-     (t
-      (defun pr-global-menubar (pr-menu-spec)
-       (require 'easymenu)
-       (let ((menu-file (if (= emacs-major-version 21)
-                            '("menu-bar" "files") ; GNU Emacs 21
-                          '("menu-bar" "file")))) ; GNU Emacs 22 or higher
-         (cond
-          (pr-menu-print-item
-           (easy-menu-add-item global-map menu-file
-                               (easy-menu-create-menu "Print" pr-menu-spec)
-                               "print-buffer")
-           (dolist (item '("print-buffer"          "print-region"
-                           "ps-print-buffer-faces" "ps-print-region-faces"
-                           "ps-print-buffer"       "ps-print-region"))
-             (easy-menu-remove-item global-map menu-file item))
-           (setq pr-menu-print-item nil
-                 pr-menu-bar (vector 'menu-bar
-                                     (pr-get-symbol (nth 1 menu-file))
-                                     (pr-get-symbol "Print"))))
-          (t
-           (easy-menu-add-item global-map menu-file
-                               (easy-menu-create-menu "Print" pr-menu-spec)))
-          )))
-      )))
-
-  (eval-and-compile
-    (cond
-     (ps-windows-system
-      ;; GNU Emacs for Windows 9x/NT
-      (defun pr-menu-position (entry index horizontal)
-       (let ((pos (cdr (mouse-pixel-position))))
-         (list
-          (list (or (car pos) 0)       ; X
-                (- (or (cdr pos) 0)    ; Y
-                   (* (pr-menu-index entry index) pr-menu-char-height)))
-          (selected-frame))))          ; frame
-      )
-     (t
-      ;; GNU Emacs
-      (defun pr-menu-position (entry index horizontal)
-       (let ((pos (cdr (mouse-pixel-position))))
-         (list
-          (list (- (or (car pos) 0)    ; X
-                   (* horizontal pr-menu-char-width))
-                (- (or (cdr pos) 0)    ; Y
-                   (* (pr-menu-index entry index) pr-menu-char-height)))
-          (selected-frame))))          ; frame
-      )))
+                             |[ ] Duplex                    |
+                             |[ ] Tumble                    |
+                             |[ ] Upside-Down               |
+                             |    Print All Pages          >|
+                             +------------------------------+
+   `postscript-process'              |[ ] Spool Buffer              |
+                             |[ ] Print with faces          |
+                             |[ ] Print via Ghostscript     |
+                             +------------------------------+
+   `printing'                |[ ] Auto Region               |
+                             |[ ] Auto Mode                 |
+                             |[ ] Menu Lock                 |
+                             +------------------------------+
+   `help'                    |    Customize                >|
+                             |    Show Settings            >|
+                             |    Help                      |
+                             +------------------------------+
 
-  (defvar pr-menu-position nil)
-  (defvar pr-menu-state nil)
+Any other value is ignored."
+  :type '(repeat :tag "Menu Visible Part"
+                (choice :menu-tag "Menu Part"
+                        :tag "Menu Part"
+                        (const postscript)
+                        (const text)
+                        (const postscript-options)
+                        (const postscript-process)
+                        (const printing)
+                        (const help)))
+  :version "20"
+  :group 'printing)
 
-  ;; GNU Emacs
-  (defun pr-menu-lookup (path)
-    (lookup-key global-map
-               (if path
-                   (vconcat pr-menu-bar
-                            (mapcar 'pr-get-symbol
-                                    (if (listp path)
-                                        path
-                                      (list path))))
-                 pr-menu-bar)))
 
-  ;; GNU Emacs
-  (defun pr-menu-lock (entry index horizontal state path)
-    (when 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))
-      (let* ((menu   (pr-menu-lookup path))
-            (result (x-popup-menu pr-menu-position menu)))
-       (and result
-            (let ((command (lookup-key menu (vconcat result))))
-              (if (fboundp command)
-                  (funcall command)
-                (eval command)))))
-      (setq pr-menu-position nil)))
+(defcustom pr-delete-temp-file t
+  "*Non-nil means delete temporary files.
 
-  ;; GNU Emacs
-  (defalias 'pr-update-mode-line 'force-mode-line-update)
+Set `pr-delete-temp-file' to nil, if the following message (or a similar)
+happens when printing:
 
-  ;; GNU Emacs
-  (defun pr-do-update-menus (&optional force)
-    (pr-menu-alist pr-ps-printer-alist
-                  'pr-ps-name
-                  'pr-menu-set-ps-title
-                  "PostScript Printers"
-                  'pr-ps-printer-menu-modified
-                  force
-                  "PostScript Printers"
-                  'postscript 2)
-    (pr-menu-alist pr-txt-printer-alist
-                  'pr-txt-name
-                  'pr-menu-set-txt-title
-                  "Text Printers"
-                  'pr-txt-printer-menu-modified
-                  force
-                  "Text Printers"
-                  'text 2)
-    (let ((save-var pr-ps-utility-menu-modified))
-      (pr-menu-alist pr-ps-utility-alist
-                    'pr-ps-utility
-                    'pr-menu-set-utility-title
-                    '("PostScript Print" "File" "PostScript Utility")
-                    'save-var
-                    force
-                    "PostScript Utility"
-                    nil 1))
-    (pr-menu-alist pr-ps-utility-alist
-                  'pr-ps-utility
-                  'pr-menu-set-utility-title
-                  '("PostScript Preview" "File" "PostScript Utility")
-                  'pr-ps-utility-menu-modified
-                  force
-                  "PostScript Utility"
-                  nil 1)
-    (pr-even-or-odd-pages ps-even-or-odd-pages force))
+   Error: could not open \"c:\\temp\\prspool.ps\" for reading."
+  :type 'boolean
+  :version "20"
+  :group 'printing)
 
-  ;; GNU Emacs
-  (defun pr-menu-get-item (name-list)
-    ;; NAME-LIST is a string or a list of strings.
-    (or (listp name-list)
-       (setq name-list (list name-list)))
-    (and name-list
-        (let* ((reversed (reverse name-list))
-               (name (pr-get-symbol (car reversed)))
-               (path (nreverse (cdr reversed)))
-               (menu (lookup-key
-                      global-map
-                      (vconcat pr-menu-bar
-                               (mapcar 'pr-get-symbol path)))))
-          (assq name (nthcdr 2 menu)))))
 
-  ;; GNU Emacs
-  (defvar pr-temp-menu nil)
+(defcustom pr-list-directory nil
+  "*Non-nil means list directory when processing a directory.
 
-  ;; GNU Emacs
-  (defun pr-menu-alist (alist var-sym fun menu-path modified-sym force name
-                             entry index)
-    (when (and alist (or force (symbol-value modified-sym)))
-      (easy-menu-define pr-temp-menu nil ""
-       (pr-menu-create name alist var-sym fun entry index))
-      (let ((item (pr-menu-get-item menu-path)))
-       (and item
-            (let* ((binding     (nthcdr 3 item))
-                   (key-binding (cdr binding)))
-              (setcar binding pr-temp-menu)
-              (and key-binding (listp (car key-binding))
-                   (setcdr binding (cdr key-binding))) ; skip KEY-BINDING
-              (funcall fun (symbol-value var-sym) item))))
-      (set modified-sym nil)))
+That is, any subdirectories (and the superdirectory) of the directory (given as
+argument of functions below) are also printed (as dired-mode listings).
 
-  ;; GNU Emacs
-  (defun pr-menu-set-item-name (item name)
-    (and item
-        (setcar (nthcdr 2 item) name))) ; ITEM-NAME
+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)
 
-  ;; GNU Emacs
-  (defun pr-menu-set-ps-title (value &optional item entry index)
-    (pr-menu-set-item-name (or item
-                              (pr-menu-get-item "PostScript Printers"))
-                          (format "PostScript Printer: %s" value))
-    (pr-ps-set-printer value)
-    (and index
-        (pr-menu-lock entry index 12 'toggle nil)))
 
-  ;; GNU Emacs
-  (defun pr-menu-set-txt-title (value &optional item entry index)
-    (pr-menu-set-item-name (or item
-                              (pr-menu-get-item "Text Printers"))
-                          (format "Text Printer: %s" value))
-    (pr-txt-set-printer value)
-    (and index
-        (pr-menu-lock entry index 12 'toggle nil)))
+(defcustom pr-buffer-name "*Printing Interface*"
+  "*Specify the name of the buffer interface for printing package.
 
-  ;; GNU Emacs
-  (defun pr-menu-set-utility-title (value &optional item entry index)
-    (let ((name (symbol-name value)))
-      (if item
-         (pr-menu-set-item-name item name)
-       (pr-menu-set-item-name
-        (pr-menu-get-item
-         '("PostScript Print"   "File" "PostScript Utility"))
-        name)
-       (pr-menu-set-item-name
-        (pr-menu-get-item
-         '("PostScript Preview" "File" "PostScript Utility"))
-        name)))
-    (pr-ps-set-utility value)
-    (and index
-        (pr-menu-lock entry index 5 nil '("PostScript Print" "File"))))
+It's used by `pr-interface'."
+  :type 'string
+  :version "20"
+  :group 'printing)
 
-  ;; GNU Emacs
-  (defun pr-even-or-odd-pages (value &optional no-lock)
-    (pr-menu-set-item-name (pr-menu-get-item "Print All Pages")
-                          (cdr (assq value pr-even-or-odd-alist)))
-    (setq ps-even-or-odd-pages value)
-    (or no-lock
-       (pr-menu-lock 'postscript-options 8 12 'toggle nil)))
 
-  ))                                   ; end cond featurep
+(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.
 
+NOTE: Case is important for matching, that is, `case-fold-search' is always
+      nil.
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User Interface (III)
+It's used by `pr-interface'."
+  :type '(repeat (regexp :tag "Buffer Name Regexp"))
+  :version "20"
+  :group 'printing)
 
-(defcustom pr-menu-char-height (pr-menu-char-height)
-  "*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.
+(defcustom pr-buffer-verbose t
+  "*Non-nil means to be verbose when editing a field in interface buffer.
 
-See also `pr-menu-lock' and `pr-menu-char-width'."
-  :type 'integer
+It's used by `pr-interface'."
+  :type 'boolean
   :version "20"
   :group 'printing)
 
 
-(defcustom pr-menu-char-width (pr-menu-char-width)
-  "*Specify menu char width in pixels.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Internal Variables
 
-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)
+(defvar pr-txt-command nil
+  "Name of program for printing a text file.
+See `pr-txt-printer-alist'.")
+
+
+(defvar pr-txt-switches nil
+  "List of sexp's to pass as extra options to the text printer program.
+See `pr-txt-printer-alist'.")
+
+
+(defvar pr-txt-printer nil
+  "Specify text printer name.
+See `pr-txt-printer-alist'.")
+
+
+(defvar pr-ps-command nil
+  "Name of program for printing a PostScript file.
+See `pr-ps-printer-alist'.")
+
+
+(defvar pr-ps-switches nil
+  "List of sexp's to pass as extra options to the PostScript printer program.
+See `pr-ps-printer-alist'.")
+
+
+(defvar pr-ps-printer-switch nil
+  "Specify PostScript printer name switch.
+See `pr-ps-printer-alist'.")
+
+
+(defvar pr-ps-printer nil
+  "Specify PostScript printer name.
+See `pr-ps-printer-alist'.")
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]