diff options
| author | Vinicius Jose Latorre | 2003-05-15 02:32:03 +0000 |
|---|---|---|
| committer | Vinicius Jose Latorre | 2003-05-15 02:32:03 +0000 |
| commit | edf0b0c5ec4e028cee93a763a6246c22f62d2d81 (patch) | |
| tree | 347db0fdc2ca7461c3dd65fc697513ec4b5fcb86 | |
| parent | c55b5fadffbde743eec765c0df4f162089b2627a (diff) | |
| download | emacs-edf0b0c5ec4e028cee93a763a6246c22f62d2d81.tar.gz emacs-edf0b0c5ec4e028cee93a763a6246c22f62d2d81.zip | |
Avoid unnecessary calls to funs in header and footer variables
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/ps-mule.el | 46 | ||||
| -rw-r--r-- | lisp/ps-print.el | 66 |
3 files changed, 82 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c8a9acfba5b..5e214fb9e46 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2003-05-15 Vinicius Jose Latorre <viniciusjl@ig.com.br> | ||
| 2 | |||
| 3 | * ps-print.el: Avoid unnecessary calls to funs in header and footer | ||
| 4 | variables. Reported by Greg Hill <ghill@synergymicro.com>. | ||
| 5 | (ps-print-version): New version number (6.6.1). | ||
| 6 | (ps-begin-page): Code fix. | ||
| 7 | (ps-generate-string-list, ps-header-footer-string): New funs. | ||
| 8 | (ps-lh-cache, ps-rh-cache, ps-lf-cache, ps-rf-cache): New vars. | ||
| 9 | |||
| 10 | * ps-mule.el (ps-mule-header-string-charsets): Call | ||
| 11 | ps-header-footer-string to avoid unnecessary calls to functions in | ||
| 12 | header and footer variables. | ||
| 13 | |||
| 1 | 2003-05-15 John Paul Wallington <jpw@gnu.org> | 14 | 2003-05-15 John Paul Wallington <jpw@gnu.org> |
| 2 | 15 | ||
| 3 | * mail/rmail.el (rmail-ignored-headers): Ignore Face: header. | 16 | * mail/rmail.el (rmail-ignored-headers): Ignore Face: header. |
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el index 7bb9f6145a7..a20853959be 100644 --- a/lisp/ps-mule.el +++ b/lisp/ps-mule.el | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | ;;; ps-mule.el --- provide multi-byte character facility to ps-print | 1 | ;;; ps-mule.el --- provide multi-byte character facility to ps-print |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 6 | ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
| 6 | ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 7 | ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
| 7 | ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 8 | ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
| 8 | ;; Vinicius Jose Latorre <vinicius@cpqd.com.br> | 9 | ;; Vinicius Jose Latorre <vinicius@cpqd.com.br> |
| 9 | ;; Keywords: wp, print, PostScript, multibyte, mule | 10 | ;; Keywords: wp, print, PostScript, multibyte, mule |
| 10 | ;; Time-stamp: <2001/08/15 15:34:11 vinicius> | 11 | ;; Time-stamp: <2003/05/14 22:19:41 vinicius> |
| 11 | 12 | ||
| 12 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| 13 | 14 | ||
| @@ -1439,36 +1440,17 @@ FONTTAG should be a string \"/h0\" or \"/h1\"." | |||
| 1439 | ;;;###autoload | 1440 | ;;;###autoload |
| 1440 | (defun ps-mule-header-string-charsets () | 1441 | (defun ps-mule-header-string-charsets () |
| 1441 | "Return a list of character sets that appears in header strings." | 1442 | "Return a list of character sets that appears in header strings." |
| 1442 | (let ((str "")) | 1443 | (let* ((str (ps-header-footer-string)) |
| 1443 | (when ps-print-header | 1444 | (len (length str)) |
| 1444 | (let ((tail (list ps-left-header ps-right-header))) | 1445 | (i 0) |
| 1445 | (while tail | 1446 | charset-list) |
| 1446 | ;; Simulate what is done by ps-generate-header-line to get a | 1447 | (while (< i len) |
| 1447 | ;; string to plot. | 1448 | (let ((charset (char-charset (aref str i)))) |
| 1448 | (let ((count 0) | 1449 | (setq i (1+ i)) |
| 1449 | (tmp (car tail))) | 1450 | (or (eq charset 'ascii) |
| 1450 | (setq tail (cdr tail)) | 1451 | (memq charset charset-list) |
| 1451 | (while (and tmp (< count ps-header-lines)) | 1452 | (setq charset-list (cons charset charset-list))))) |
| 1452 | (let ((elt (car tmp))) | 1453 | charset-list)) |
| 1453 | (setq tmp (cdr tmp) | ||
| 1454 | count (1+ count) | ||
| 1455 | str (concat str | ||
| 1456 | (cond ((stringp elt) elt) | ||
| 1457 | ((and (symbolp elt) (fboundp elt)) | ||
| 1458 | (funcall elt)) | ||
| 1459 | ((and (symbolp elt) (boundp elt)) | ||
| 1460 | (symbol-value elt)) | ||
| 1461 | (t "")))))))))) | ||
| 1462 | (let ((len (length str)) | ||
| 1463 | (i 0) | ||
| 1464 | charset-list) | ||
| 1465 | (while (< i len) | ||
| 1466 | (let ((charset (char-charset (aref str i)))) | ||
| 1467 | (setq i (1+ i)) | ||
| 1468 | (or (eq charset 'ascii) | ||
| 1469 | (memq charset charset-list) | ||
| 1470 | (setq charset-list (cons charset charset-list))))) | ||
| 1471 | charset-list))) | ||
| 1472 | 1454 | ||
| 1473 | ;;;###autoload | 1455 | ;;;###autoload |
| 1474 | (defun ps-mule-begin-job (from to) | 1456 | (defun ps-mule-begin-job (from to) |
diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 9a6a555f0ff..ac6d37854e3 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el | |||
| @@ -10,12 +10,12 @@ | |||
| 10 | ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 10 | ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
| 11 | ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> | 11 | ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 12 | ;; Keywords: wp, print, PostScript | 12 | ;; Keywords: wp, print, PostScript |
| 13 | ;; Time-stamp: <2003/03/05 21:54:55 vinicius> | 13 | ;; Time-stamp: <2003/05/14 22:34:05 vinicius> |
| 14 | ;; Version: 6.6 | 14 | ;; Version: 6.6.1 |
| 15 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ | 15 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
| 16 | 16 | ||
| 17 | (defconst ps-print-version "6.6" | 17 | (defconst ps-print-version "6.6.1" |
| 18 | "ps-print.el, v 6.6 <2003/03/05 vinicius> | 18 | "ps-print.el, v 6.6.1 <2003/05/14 vinicius> |
| 19 | 19 | ||
| 20 | Vinicius's last change version -- this file may have been edited as part of | 20 | Vinicius's last change version -- this file may have been edited as part of |
| 21 | Emacs without changes to the version number. When reporting bugs, please also | 21 | Emacs without changes to the version number. When reporting bugs, please also |
| @@ -840,7 +840,7 @@ Please send all bug fixes and enhancements to | |||
| 840 | ;; 22 + 22 + | 840 | ;; 22 + 22 + |
| 841 | ;; -------- ----------- --------- ---------------- | 841 | ;; -------- ----------- --------- ---------------- |
| 842 | ;; | 842 | ;; |
| 843 | ;; Any other value is treated as `nil'. | 843 | ;; Any other value is treated as nil. |
| 844 | ;; | 844 | ;; |
| 845 | ;; See also section How Ps-Print Has A Text And/Or Image On Background. | 845 | ;; See also section How Ps-Print Has A Text And/Or Image On Background. |
| 846 | ;; | 846 | ;; |
| @@ -4666,6 +4666,42 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th | |||
| 4666 | (goto-char (point-max)) | 4666 | (goto-char (point-max)) |
| 4667 | (insert-file fname))) | 4667 | (insert-file fname))) |
| 4668 | 4668 | ||
| 4669 | ;; These functions are used in `ps-mule' to get charset of header and footer. | ||
| 4670 | ;; To avoid unnecessary calls to functions in `ps-left-header', | ||
| 4671 | ;; `ps-right-header', `ps-left-footer' and `ps-right-footer'. | ||
| 4672 | |||
| 4673 | (defun ps-generate-string-list (content) | ||
| 4674 | (let (str) | ||
| 4675 | (while content | ||
| 4676 | (setq str (cons (cond | ||
| 4677 | ((stringp (car content)) | ||
| 4678 | (car content)) | ||
| 4679 | ((and (symbolp (car content)) (fboundp (car content))) | ||
| 4680 | (concat "(" (funcall (car content)) ")")) | ||
| 4681 | ((and (symbolp (car content)) (boundp (car content))) | ||
| 4682 | (concat "(" (symbol-value (car content)) ")")) | ||
| 4683 | (t | ||
| 4684 | "")) | ||
| 4685 | str) | ||
| 4686 | content (cdr content))) | ||
| 4687 | (nreverse str))) | ||
| 4688 | |||
| 4689 | (defvar ps-lh-cache nil) | ||
| 4690 | (defvar ps-rh-cache nil) | ||
| 4691 | (defvar ps-lf-cache nil) | ||
| 4692 | (defvar ps-rf-cache nil) | ||
| 4693 | |||
| 4694 | (defun ps-header-footer-string () | ||
| 4695 | (and ps-print-header | ||
| 4696 | (setq ps-lh-cache (ps-generate-string-list ps-left-header) | ||
| 4697 | ps-rh-cache (ps-generate-string-list ps-right-header))) | ||
| 4698 | (and ps-print-footer | ||
| 4699 | (setq ps-lf-cache (ps-generate-string-list ps-left-footer) | ||
| 4700 | ps-rf-cache (ps-generate-string-list ps-right-footer))) | ||
| 4701 | (mapconcat 'identity | ||
| 4702 | (append ps-lh-cache ps-rh-cache ps-lf-cache ps-rf-cache) | ||
| 4703 | "")) | ||
| 4704 | |||
| 4669 | ;; These functions insert the arrays that define the contents of the headers. | 4705 | ;; These functions insert the arrays that define the contents of the headers. |
| 4670 | 4706 | ||
| 4671 | (defun ps-generate-header-line (fonttag &optional content) | 4707 | (defun ps-generate-header-line (fonttag &optional content) |
| @@ -5809,14 +5845,22 @@ XSTART YSTART are the relative position for the first page in a sheet.") | |||
| 5809 | (format "/PageNumber %d def\n" (ps-page-number))) | 5845 | (format "/PageNumber %d def\n" (ps-page-number))) |
| 5810 | 5846 | ||
| 5811 | (when ps-print-header | 5847 | (when ps-print-header |
| 5812 | (ps-generate-header "HeaderLinesLeft" "/h0" "/h1" ps-left-header) | 5848 | (ps-generate-header "HeaderLinesLeft" "/h0" "/h1" |
| 5813 | (ps-generate-header "HeaderLinesRight" "/h0" "/h1" ps-right-header) | 5849 | (or ps-lh-cache ps-left-header)) |
| 5814 | (ps-output (format "%d SetHeaderLines\n" ps-header-lines))) | 5850 | (ps-generate-header "HeaderLinesRight" "/h0" "/h1" |
| 5851 | (or ps-rh-cache ps-right-header)) | ||
| 5852 | (ps-output (format "%d SetHeaderLines\n" ps-header-lines)) | ||
| 5853 | (setq ps-lh-cache nil | ||
| 5854 | ps-rh-cache nil)) | ||
| 5815 | 5855 | ||
| 5816 | (when ps-print-footer | 5856 | (when ps-print-footer |
| 5817 | (ps-generate-header "FooterLinesLeft" "/H0" "/H0" ps-left-footer) | 5857 | (ps-generate-header "FooterLinesLeft" "/H0" "/H0" |
| 5818 | (ps-generate-header "FooterLinesRight" "/H0" "/H0" ps-right-footer) | 5858 | (or ps-lf-cache ps-left-footer)) |
| 5819 | (ps-output (format "%d SetFooterLines\n" ps-footer-lines))) | 5859 | (ps-generate-header "FooterLinesRight" "/H0" "/H0" |
| 5860 | (or ps-rf-cache ps-right-footer)) | ||
| 5861 | (ps-output (format "%d SetFooterLines\n" ps-footer-lines)) | ||
| 5862 | (setq ps-lf-cache nil | ||
| 5863 | ps-rf-cache nil)) | ||
| 5820 | 5864 | ||
| 5821 | (ps-output (number-to-string ps-lines-printed) " BeginPage\n") | 5865 | (ps-output (number-to-string ps-lines-printed) " BeginPage\n") |
| 5822 | (ps-set-font ps-current-font) | 5866 | (ps-set-font ps-current-font) |