-(eval-and-compile
- (defun pr-get-symbol (name)
- ;; Recent versions of easy-menu downcase names before interning them.
- (and (fboundp 'easy-menu-name-match)
- (setq name (downcase name)))
- (or (intern-soft name)
- (make-symbol name)))
-
- (cond
- ((eq ps-print-emacs-type 'emacs) ; GNU Emacs
- (defsubst pr-region-active-p ()
- (and pr-auto-region transient-mark-mode mark-active)))
-
- ((eq ps-print-emacs-type 'xemacs) ; XEmacs
- (defsubst pr-region-active-p ()
- (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p)))))
-
-
- (defconst pr-menu-spec
- (cond
- ((eq ps-print-emacs-type 'emacs) ; GNU Emacs
- '(
- ["Printing Interface" pr-interface
- :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)
- ["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)
- ["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))
- ["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))
- ["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"
- ["As Is..." (call-interactively 'pr-ps-file-preview)
- :keys "\\[pr-ps-file-preview]"
- :help "Preview PostScript file"]
- "--"
- ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
- :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]
- ["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
- :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"
- :active pr-ps-utility-alist]
- ["Tumble" pr-toggle-file-tumble
- :style toggle :selected pr-file-tumble
- :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)"
- ("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" :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)
- ["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"
- ["As Is..." (call-interactively 'pr-ps-file-ps-print)
- :keys "\\[pr-ps-file-ps-print]"
- :help "Send PostScript file to printer"]
- "--"
- ["PostScript Utility" pr-update-menus :active pr-ps-utility-alist
- :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]
- ["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
- :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"
- :active pr-ps-utility-alist]
- ["Tumble" pr-toggle-file-tumble
- :style toggle :selected pr-file-tumble
- :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)"])
- ["PostScript Printers" pr-update-menus
- :active pr-ps-printer-alist :included (pr-visible-p 'postscript)
- :help "Select PostScript printer"]
- "--"
- ("Printify" :visible (pr-visible-p 'text)
- :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"
- ["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"]
+(defun pr-get-symbol (name)
+ (easy-menu-intern name))
+
+(cond
+ ((featurep 'xemacs) ; XEmacs
+ (defvar zmacs-region-stays nil) ; to avoid compilation gripes
+ (defun pr-region-active-p ()
+ (and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))
+
+ (t ; GNU Emacs
+ (defun pr-region-active-p ()
+ (and pr-auto-region transient-mark-mode mark-active))))
+
+
+(defconst pr-menu-spec
+ ;; Menu mapping:
+ ;; unfortunately XEmacs doesn't support :active for submenus,
+ ;; only for items.
+ ;; So, it uses :included instead of :active.
+ ;; Also, XEmacs doesn't support :help tag.
+ (let ((pr-:active (if (featurep 'xemacs)
+ :included ; XEmacs
+ :active)) ; GNU Emacs
+ (pr-:help (if (featurep 'xemacs)
+ 'ignore ; XEmacs
+ #'(lambda (text) (list :help text))))) ; GNU Emacs
+ `(
+ ["Printing Interface" pr-interface
+ ,@(funcall
+ pr-:help "Use buffer interface instead of menu interface")]
+ "--"
+ ("PostScript Preview" :included (pr-visible-p 'postscript)
+ ,@(funcall
+ 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" ,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" ,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" ,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]
+ ["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]"
+ ,@(funcall
+ pr-:help "Preview PostScript file")]