]> code.delx.au - gnu-emacs/blobdiff - lisp/printing.el
Update GPL version for Emacs images.
[gnu-emacs] / lisp / printing.el
index 508d0bde5855a6c783e69ef3352288883017a5db..412f0b342fc99aa31ec5aa59470e776269ff7aac 100644 (file)
@@ -1,11 +1,10 @@
 ;;; printing.el --- printing utilities
 
 ;; Copyright (C) 2000, 2001, 2003, 2004, 2005,
-;;   2006 Free Software Foundation, Inc.
+;;   2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
-;; Time-stamp: <2006/09/15 18:53:14 vinicius>
 ;; Keywords: wp, print, PostScript
 ;; Version: 6.8.4
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
@@ -21,7 +20,7 @@ Please send all bug fixes and enhancements to
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify it under
 ;; the terms of the GNU General Public License as published by the Free
-;; Software Foundation; either version 2, or (at your option) any later
+;; Software Foundation; either version 3, or (at your option) any later
 ;; version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -68,7 +67,7 @@ Please send all bug fixes and enhancements to
 ;; interface to ps-print package and it also provides some extra stuff.
 ;;
 ;; To download the latest ps-print package see
-;; `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'.
+;; `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'.
 ;; Please, see README file for ps-print installation instructions.
 ;;
 ;; `printing' was inspired on:
@@ -958,8 +957,8 @@ Please send all bug fixes and enhancements to
 ;;
 ;; * For `printing' package:
 ;;
-;;    printing `http://www.cpqd.com.br/~vinicius/emacs/printing.el.gz'
-;;    ps-print `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'
+;;    printing `http://www.emacswiki.org/cgi-bin/emacs/download/printing.el'
+;;    ps-print `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'
 ;;
 ;; * For GNU or Unix system:
 ;;
@@ -1144,7 +1143,6 @@ If SUFFIX is non-nil, add that at the end of the file name."
   "Set the value of custom variables for printer & utility selection."
   (set symbol value)
   (and (featurep 'printing)            ; update only after printing is loaded
-       (not pr-menu-print-item)
        (pr-update-menus t)))
 
 
@@ -1152,7 +1150,6 @@ If SUFFIX is non-nil, add that at the end of the file name."
   "Update utility menu entry."
   (set symbol value)
   (and (featurep 'printing)            ; update only after printing is loaded
-       (not pr-menu-print-item)
        (pr-menu-set-utility-title value)))
 
 
@@ -1160,7 +1157,6 @@ If SUFFIX is non-nil, add that at the end of the file name."
   "Update `PostScript Printer:' menu entry."
   (set symbol value)
   (and (featurep 'printing)            ; update only after printing is loaded
-       (not pr-menu-print-item)
        (pr-menu-set-ps-title value)))
 
 
@@ -1168,7 +1164,6 @@ If SUFFIX is non-nil, add that at the end of the file name."
   "Update `Text Printer:' menu entry."
   (set symbol value)
   (and (featurep 'printing)            ; update only after printing is loaded
-       (not pr-menu-print-item)
        (pr-menu-set-txt-title value)))
 
 
@@ -3091,7 +3086,7 @@ Calls `pr-update-menus' to adjust menus."
     ;; third... time, but "print" item exists only in the first load.
     (cond
      ;; Emacs 20
-     ((string< emacs-version "21.")
+     ((< emacs-major-version 21)
       (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)
@@ -3100,21 +3095,26 @@ Calls `pr-update-menus' to adjust menus."
                                  (pr-get-symbol "Printing")))))
      ;; Emacs 21 & 22
      (t
-      (cond
-       (pr-menu-print-item
-       (easy-menu-add-item menu-bar-file-menu nil
-                           (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 menu-bar-file-menu nil item))
-       (setq pr-menu-print-item nil
-             pr-menu-bar (vector 'menu-bar
-                                 'file
-                                 (pr-get-symbol "Print"))))
-       (t
-       (easy-menu-change '("file") "Print" pr-menu-spec)))))))
+      (let ((menu-file (if (= emacs-major-version 21)
+                          '("menu-bar" "files") ; Emacs 21
+                        '("menu-bar" "file")))) ; 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)))
+        ))))))
   (pr-update-menus t))
 
 
@@ -4402,7 +4402,7 @@ Interactively, you have the following situations:
    C-u 2 M-x pr-ps-fast-fire RET
       The command prompts the user for a N-UP value, then for a current
       PostScript printer and, finally, for a file name.  Then change the active
-      printer to that choosen by user and saves the PostScript image in
+      printer to that chosen by user and saves the PostScript image in
       that file instead of sending it to the printer.
 
 
@@ -4421,7 +4421,7 @@ zero and the argument SELECT is treated as follows:
 
    If it's an integer greater or equal to 2, the command prompts the user for a
    current PostScript printer and for a file name.  Then change the active
-   printer to that choosen by user and saves the PostScript image in that file
+   printer to that chosen by user and saves the PostScript image in that file
    instead of sending it to the printer.
 
    If it's a symbol which it's defined in `pr-ps-printer-alist', it's the new
@@ -4943,9 +4943,9 @@ See `pr-visible-entry-alist'.")
 
 If FORCE is non-nil, update menus doesn't matter if `pr-ps-printer-alist',
 `pr-txt-printer-alist' or `pr-ps-utility-alist' were modified or not;
-otherwise, update PostScript printer menu iff `pr-ps-printer-menu-modified' is
-non-nil, update text printer menu iff `pr-txt-printer-menu-modified' is
-non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
+otherwise, update PostScript printer menu if `pr-ps-printer-menu-modified' is
+non-nil, update text printer menu if `pr-txt-printer-menu-modified' is
+non-nil, and update PostScript File menus if `pr-ps-utility-menu-modified' is
 non-nil.
 
 If menu binding was not done, calls `pr-menu-bind'."
@@ -6056,7 +6056,9 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
   ;; header
   (let ((versions (concat "printing v" pr-version
                          "    ps-print v" ps-print-version)))
-    (widget-insert (make-string (- 79 (length versions)) ?\s) versions))
+    ;; to keep compatibility with Emacs 20 & 21:
+    ;; DO NOT REPLACE `?\ ' BY `?\s'
+    (widget-insert (make-string (- 79 (length versions)) ?\ ) versions))
   (pr-insert-italic "\nCurrent Directory : " 1)
   (pr-insert-italic default-directory)