changeset 73827:985f3831f360

Fix Print submenu creation
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Wed, 08 Nov 2006 14:04:09 +0000
parents 1d5a66a8dd30
children 0f89186ff97e
files lisp/ChangeLog lisp/printing.el
diffstat 2 files changed, 34 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 08 09:52:26 2006 +0000
+++ b/lisp/ChangeLog	Wed Nov 08 14:04:09 2006 +0000
@@ -1,3 +1,11 @@
+2006-11-08  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+	* printing.el (pr-alist-custom-set, pr-ps-utility-custom-set)
+	(pr-ps-name-custom-set, pr-txt-name-custom-set): Return back the old
+	behaviour.
+	(pr-menu-bind): Act on global-map instead of menu-bar-file-menu
+	directly.
+
 2006-11-08  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ido.el (ido-ignore-extensions, ido-show-dot-for-dired)
--- a/lisp/printing.el	Wed Nov 08 09:52:26 2006 +0000
+++ b/lisp/printing.el	Wed Nov 08 14:04:09 2006 +0000
@@ -5,7 +5,7 @@
 
 ;; 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>
+;; Time-stamp: <2006/11/08 12:01:50 vinicius>
 ;; Keywords: wp, print, PostScript
 ;; Version: 6.8.4
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
@@ -68,7 +68,7 @@
 ;; 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/emacs/download/ps-print.tar.gz'.
 ;; Please, see README file for ps-print installation instructions.
 ;;
 ;; `printing' was inspired on:
@@ -958,8 +958,8 @@
 ;;
 ;; * 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/emacs/download/ps-print.tar.gz'
 ;;
 ;; * For GNU or Unix system:
 ;;
@@ -1144,7 +1144,6 @@
   "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 +1151,6 @@
   "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 +1158,6 @@
   "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 +1165,6 @@
   "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 +3087,7 @@
     ;; 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 +3096,24 @@
 				  (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-change (cdr menu-file) "Print" pr-menu-spec))))))))
   (pr-update-menus t))
 
 
@@ -6056,7 +6055,9 @@
   ;; 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)