changeset 90779:6ea6d3d1508d

Some code fix.
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Fri, 02 Mar 2007 01:43:44 +0000
parents c5ab22abb1ec
children ec58e5c426ef
files lisp/ChangeLog.unicode lisp/ps-def.el lisp/ps-print.el lisp/ps-samp.el
diffstat 4 files changed, 94 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog.unicode	Tue Feb 27 11:03:55 2007 +0000
+++ b/lisp/ChangeLog.unicode	Fri Mar 02 01:43:44 2007 +0000
@@ -1,3 +1,18 @@
+2007-03-01  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+	* ps-print.el: Replace (defvar VAR nil) by (defvar VAR).
+	(ps-print-emacs-type): Var eliminated.
+	(ps-setup): Remove ps-print-emacs-type. Print which Emacsen is
+	running ps-print package.
+
+	* ps-def.el: Replace (defvar VAR nil) by (defvar VAR).
+	(ps-frame-parameter): Replace defun by defalias.
+	(mark-active): defvar eliminated.
+
+	* ps-samp.el (ps-prsc, ps-c-prsc, ps-s-prsc): Macros eliminated.
+	(ps-rmail-mode-hook, ps-vm-mode-hook, ps-gnus-summary-setup)
+	(ps-jts-ps-setup): Replace macros by vector key definition.
+
 2007-02-16  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
 	* progmodes/ebnf-abn.el (ebnf-abn-skip-comment):
--- a/lisp/ps-def.el	Tue Feb 27 11:03:55 2007 +0000
+++ b/lisp/ps-def.el	Fri Mar 02 01:43:44 2007 +0000
@@ -7,7 +7,7 @@
 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters)
 ;;	Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
-;; Version: 7.2
+;; Version: 7.2.2
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
@@ -40,14 +40,14 @@
 
 
 (cond
- ((featurep 'xemacs)			; xemacs
+ ((featurep 'xemacs)			; XEmacs
 
 
   ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;; ps-bdf
 
-  (defvar installation-directory nil)
-  (defvar coding-system-for-read nil)
+  (defvar installation-directory)
+  (defvar coding-system-for-read)
 
 
   ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -165,8 +165,7 @@
     (ps-xemacs-color-name (face-background face)))
 
 
-  (defun ps-frame-parameter (param)
-    (frame-property nil param))
+  (defalias 'ps-frame-parameter 'frame-property)
 
 
   ;; Return t if the device (which can be changed during an emacs session)
@@ -207,9 +206,9 @@
 
 
   ;; to avoid XEmacs compilation gripes
-  (defvar coding-system-for-write   nil)
-  (defvar coding-system-for-read    nil)
-  (defvar buffer-file-coding-system nil)
+  (defvar coding-system-for-write)
+  (defvar coding-system-for-read)
+  (defvar buffer-file-coding-system)
 
 
   (and (fboundp 'find-coding-system)
@@ -299,7 +298,7 @@
       (ps-plot-with-face from to face)))
 
   )
- (t					; emacs
+ (t					; Emacs
   ;; Do nothing
   ))					; end cond featurep
 
@@ -311,17 +310,15 @@
 
 
 (cond
- ((featurep 'xemacs)			; xemacs
+ ((featurep 'xemacs)			; XEmacs
   ;; Do nothing
   )
- (t					; emacs
+ (t					; Emacs
 
 
   ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;; ps-print
 
-  (defvar mark-active nil)
-
 
   (defun ps-mark-active-p ()
     mark-active)
@@ -335,8 +332,7 @@
     (face-background face nil t))
 
 
-  (defun ps-frame-parameter (param)
-    (frame-parameter nil param))
+  (defalias 'ps-frame-parameter 'frame-parameter)
 
 
   ;; Return t if the device (which can be changed during an emacs session) can
--- a/lisp/ps-print.el	Tue Feb 27 11:03:55 2007 +0000
+++ b/lisp/ps-print.el	Fri Mar 02 01:43:44 2007 +0000
@@ -1450,18 +1450,16 @@
     (error "`ps-print' requires floating point support"))
 
 
-(defvar ps-print-emacs-type
-  (let ((case-fold-search t))
-    (cond ((string-match "XEmacs" emacs-version) 'xemacs)
-	  ((string-match "Lucid" emacs-version)
-	   (error "`ps-print' doesn't support Lucid"))
-	  ((string-match "Epoch" emacs-version)
-	   (error "`ps-print' doesn't support Epoch"))
-	  (t
-	   (unless (and (boundp 'emacs-major-version)
-			(> emacs-major-version 22))
-	     (error "`ps-print' only supports Emacs 23 and higher"))
-	   'emacs))))
+(let ((case-fold-search t))
+  (cond ((string-match "XEmacs" emacs-version))
+	((string-match "Lucid" emacs-version)
+	 (error "`ps-print' doesn't support Lucid"))
+	((string-match "Epoch" emacs-version)
+	 (error "`ps-print' doesn't support Epoch"))
+	(t
+	 (unless (and (boundp 'emacs-major-version)
+		      (>= emacs-major-version 22))
+	   (error "`ps-print' only supports Emacs 22 and higher")))))
 
 
 (defconst ps-windows-system
@@ -3276,13 +3274,13 @@
 
 (defcustom ps-postscript-code-directory
   (or (if (featurep 'xemacs)
-	  (cond ((fboundp 'locate-data-directory) ; xemacs
+	  (cond ((fboundp 'locate-data-directory) ; XEmacs
 		 (funcall 'locate-data-directory "ps-print"))
-		((boundp 'data-directory) ; xemacs
+		((boundp 'data-directory) ; XEmacs
 		 (symbol-value 'data-directory))
 		(t			; don't know what to do
 		 nil))
-	data-directory)			; emacs
+	data-directory)			; Emacs
       (error "`ps-postscript-code-directory' isn't set properly"))
   "*Directory where it's located the PostScript prologue file used by ps-print.
 By default, this directory is the same as in the variable `data-directory'."
@@ -3524,11 +3522,12 @@
     (mapconcat
      #'ps-print-quote
      (list
-      (concat "\n;;; ps-print version " ps-print-version "\n")
+      (concat "\n;;; (" (if (featurep 'xemacs) "XEmacs" "Emacs")
+	      ") ps-print version " ps-print-version "\n")
       ";; internal vars"
-      (ps-comment-string "emacs-version      " emacs-version)
-      (ps-comment-string "ps-windows-system  " ps-windows-system)
-      (ps-comment-string "ps-lp-system       " ps-lp-system)
+      (ps-comment-string "emacs-version     " emacs-version)
+      (ps-comment-string "ps-windows-system " ps-windows-system)
+      (ps-comment-string "ps-lp-system      " ps-lp-system)
       nil
       '(25 . ps-print-color-p)
       '(25 . ps-lpr-command)
@@ -3801,7 +3800,7 @@
 	     filename))))
 
 
-(defvar ps-mark-code-directory nil)
+(defvar ps-mark-code-directory)
 
 (defvar ps-print-prologue-0 ""
   "ps-print PostScript error handler.")
@@ -3811,12 +3810,12 @@
 
 ;; Start Editing Here:
 
-(defvar ps-source-buffer nil)
+(defvar ps-source-buffer)
 (defvar ps-spool-buffer-name "*PostScript*")
-(defvar ps-spool-buffer nil)
-
-(defvar ps-output-head nil)
-(defvar ps-output-tail nil)
+(defvar ps-spool-buffer)
+
+(defvar ps-output-head)
+(defvar ps-output-tail)
 
 (defvar ps-page-postscript 0)		; page number
 (defvar ps-page-order 0)		; PostScript page counter
@@ -3826,29 +3825,29 @@
 (defvar ps-page-n-up 0)			; n-up counter
 (defvar ps-lines-printed 0)		; total lines printed
 (defvar ps-showline-count 1)		; line number counter
-(defvar ps-first-page nil)
-(defvar ps-last-page nil)
+(defvar ps-first-page)
+(defvar ps-last-page)
 (defvar ps-print-page-p t)
 
-(defvar ps-control-or-escape-regexp nil)
-(defvar ps-n-up-on nil)
-
-(defvar ps-background-pages nil)
-(defvar ps-background-all-pages nil)
+(defvar ps-control-or-escape-regexp)
+(defvar ps-n-up-on)
+
+(defvar ps-background-pages)
+(defvar ps-background-all-pages)
 (defvar ps-background-text-count 0)
 (defvar ps-background-image-count 0)
 
 (defvar ps-current-font 0)
-(defvar ps-default-foreground nil)
-(defvar ps-default-background nil)
-(defvar ps-default-color nil)
-(defvar ps-current-color nil)
-(defvar ps-current-bg nil)
-
-(defvar ps-zebra-stripe-full-p nil)
+(defvar ps-default-foreground)
+(defvar ps-default-background)
+(defvar ps-default-color)
+(defvar ps-current-color)
+(defvar ps-current-bg)
+
+(defvar ps-zebra-stripe-full-p)
 (defvar ps-razchunk 0)
 
-(defvar ps-color-p nil)
+(defvar ps-color-p)
 
 ;; These values determine how much print-height to deduct when headers/footers
 ;; are turned on.  This is a pretty clumsy way of handling it, but it'll do for
@@ -3868,20 +3867,20 @@
 (defmacro ps-page-dimensions-get-height (dims) `(nth 1 ,dims))
 (defmacro ps-page-dimensions-get-media  (dims) `(nth 2 ,dims))
 
-(defvar ps-landscape-page-height nil)
-
-(defvar ps-print-width nil)
-(defvar ps-print-height nil)
-
-(defvar ps-height-remaining nil)
-(defvar ps-width-remaining nil)
-
-(defvar ps-font-size-internal nil)
-(defvar ps-header-font-size-internal nil)
-(defvar ps-header-title-font-size-internal nil)
-(defvar ps-footer-font-size-internal nil)
-(defvar ps-line-spacing-internal nil)
-(defvar ps-paragraph-spacing-internal nil)
+(defvar ps-landscape-page-height)
+
+(defvar ps-print-width)
+(defvar ps-print-height)
+
+(defvar ps-height-remaining)
+(defvar ps-width-remaining)
+
+(defvar ps-font-size-internal)
+(defvar ps-header-font-size-internal)
+(defvar ps-header-title-font-size-internal)
+(defvar ps-footer-font-size-internal)
+(defvar ps-line-spacing-internal)
+(defvar ps-paragraph-spacing-internal)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -4078,10 +4077,10 @@
        message-log-max))
 
 
-(defvar ps-print-hook nil)
-(defvar ps-print-begin-sheet-hook nil)
-(defvar ps-print-begin-page-hook nil)
-(defvar ps-print-begin-column-hook nil)
+(defvar ps-print-hook)
+(defvar ps-print-begin-sheet-hook)
+(defvar ps-print-begin-page-hook)
+(defvar ps-print-begin-column-hook)
 
 
 (defun ps-print-without-faces (from to &optional filename region-p)
@@ -4636,7 +4635,7 @@
 
 ;; These functions insert the arrays that define the contents of the headers.
 
-(defvar ps-encode-header-string-function nil)
+(defvar ps-encode-header-string-function)
 
 (defun ps-generate-header-line (fonttag &optional content)
   (ps-output " [" fonttag " ")
@@ -5909,7 +5908,7 @@
 			 (/ q-done (/ q-todo 100)))
 		       ))))))
 
-(defvar ps-last-font nil)
+(defvar ps-last-font)
 
 (defun ps-set-font (font)
   (setq ps-last-font (format "f%d" (setq ps-current-font font)))
--- a/lisp/ps-samp.el	Tue Feb 27 11:03:55 2007 +0000
+++ b/lisp/ps-samp.el	Fri Mar 02 01:43:44 2007 +0000
@@ -9,7 +9,7 @@
 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters)
 ;;	Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: wp, print, PostScript
-;; Version: 7.2
+;; Version: 7.2.2
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
@@ -49,17 +49,12 @@
 ;; WARNING!!! The following code is *sample* code only.
 ;; Don't use it unless you understand what it does!
 
-(defmacro ps-prsc ()
-  `(if (featurep 'xemacs) 'f22           [f22]))
-(defmacro ps-c-prsc ()
-  `(if (featurep 'xemacs) '(control f22) [C-f22]))
-(defmacro ps-s-prsc ()
-  `(if (featurep 'xemacs) '(shift f22)   [S-f22]))
+;; The key `f22' should probably be replaced by `print'.  --Stef
 
 ;; A hook to bind to `rmail-mode-hook' to locally bind prsc and set the
 ;; `ps-left-headers' specially for mail messages.
 (defun ps-rmail-mode-hook ()
-  (local-set-key (ps-prsc) 'ps-rmail-print-message-from-summary)
+  (local-set-key [(f22)] 'ps-rmail-print-message-from-summary)
   (setq ps-header-lines 3
 	ps-left-header
 	;; The left headers will display the message's subject, its
@@ -133,7 +128,7 @@
 ;; A hook to bind to `vm-mode-hook' to locally bind prsc and set the
 ;; `ps-left-headers' specially for mail messages.
 (defun ps-vm-mode-hook ()
-  (local-set-key (ps-prsc) 'ps-vm-print-message-from-summary)
+  (local-set-key [(f22)] 'ps-vm-print-message-from-summary)
   (setq ps-header-lines 3
 	ps-left-header
 	;; The left headers will display the message's subject, its
@@ -159,7 +154,7 @@
 ;; A hook to bind to bind to `gnus-summary-setup-buffer' to locally bind
 ;; prsc.
 (defun ps-gnus-summary-setup ()
-  (local-set-key (ps-prsc) 'ps-gnus-print-article-from-summary))
+  (local-set-key [(f22)] 'ps-gnus-print-article-from-summary))
 
 ;; Look in an article or mail message for the Subject: line.  To be
 ;; placed in `ps-left-headers'.
@@ -191,9 +186,9 @@
 ;; modification.)
 
 (defun ps-jts-ps-setup ()
-  (global-set-key (ps-prsc) 'ps-spool-buffer-with-faces) ;f22 is prsc
-  (global-set-key (ps-s-prsc) 'ps-spool-region-with-faces)
-  (global-set-key (ps-c-prsc) 'ps-despool)
+  (global-set-key [(f22)] 'ps-spool-buffer-with-faces) ;f22 is prsc
+  (global-set-key [(shift f22)] 'ps-spool-region-with-faces)
+  (global-set-key [(control f22)] 'ps-despool)
   (add-hook 'gnus-article-prepare-hook 'ps-gnus-article-prepare-hook)
   (add-hook 'gnus-summary-mode-hook 'ps-gnus-summary-setup)
   (add-hook 'vm-mode-hook 'ps-vm-mode-hook)