Mercurial > emacs
comparison lisp/ps-print.el @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | f035500271d2 |
children | 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
89908:ee1402f7b568 | 89909:68c22ea6027c |
---|---|
1 ;;; ps-print.el --- print text from the buffer as PostScript | 1 ;;; ps-print.el --- print text from the buffer as PostScript |
2 | 2 |
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | 3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
4 ;; 2003 Free Software Foundation, Inc. | 4 ;; 2003, 2004 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) | 6 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
7 ;; Jacques Duthen (was <duthen@cegelec-red.fr>) | 7 ;; Jacques Duthen (was <duthen@cegelec-red.fr>) |
8 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> | 8 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
9 ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 9 ;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
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/07/10 19:19:12 vinicius> | 13 ;; Time-stamp: <2004/03/10 18:57:00 vinicius> |
14 ;; Version: 6.6.2 | 14 ;; Version: 6.6.4 |
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.2" | 17 (defconst ps-print-version "6.6.4" |
18 "ps-print.el, v 6.6.2 <2003/07/10 vinicius> | 18 "ps-print.el, v 6.6.4 <2004/03/10 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 |
22 report the version of Emacs, if any, that ps-print was distributed with. | 22 report the version of Emacs, if any, that ps-print was distributed with. |
23 | 23 |
1211 ;; New since version 2.8 | 1211 ;; New since version 2.8 |
1212 ;; --------------------- | 1212 ;; --------------------- |
1213 ;; | 1213 ;; |
1214 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> | 1214 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1215 ;; | 1215 ;; |
1216 ;; 20040229 | |
1217 ;; `ps-time-stamp-yyyy-mm-dd', `ps-time-stamp-iso8601' | |
1218 ;; | |
1216 ;; 20010619 | 1219 ;; 20010619 |
1217 ;; `ps-time-stamp-locale-default' | 1220 ;; `ps-time-stamp-locale-default' |
1218 ;; | 1221 ;; |
1219 ;; 20010530 | 1222 ;; 20010530 |
1220 ;; Handle before-string and after-string overlay properties. | 1223 ;; Handle before-string and after-string overlay properties. |
1259 ;; N-up printing. | 1262 ;; N-up printing. |
1260 ;; Hook: `ps-print-begin-sheet-hook'. | 1263 ;; Hook: `ps-print-begin-sheet-hook'. |
1261 ;; | 1264 ;; |
1262 ;; [keinichi] 19990509 Kein'ichi Handa <handa@etl.go.jp> | 1265 ;; [keinichi] 19990509 Kein'ichi Handa <handa@etl.go.jp> |
1263 ;; | 1266 ;; |
1264 ;; `ps-print-region-function' | 1267 ;; `ps-print-region-function' |
1265 ;; | 1268 ;; |
1266 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> | 1269 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1267 ;; | 1270 ;; |
1268 ;; 19990301 | 1271 ;; 19990301 |
1269 ;; PostScript tumble and setpagedevice. | 1272 ;; PostScript tumble and setpagedevice. |
1272 ;; PostScript prologue header comment insertion. | 1275 ;; PostScript prologue header comment insertion. |
1273 ;; Skip invisible text better. | 1276 ;; Skip invisible text better. |
1274 ;; | 1277 ;; |
1275 ;; [keinichi] 19980819 Kein'ichi Handa <handa@etl.go.jp> | 1278 ;; [keinichi] 19980819 Kein'ichi Handa <handa@etl.go.jp> |
1276 ;; | 1279 ;; |
1277 ;; Multi-byte buffer handling. | 1280 ;; Multi-byte buffer handling. |
1278 ;; | 1281 ;; |
1279 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> | 1282 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1280 ;; | 1283 ;; |
1281 ;; 19980306 | 1284 ;; 19980306 |
1282 ;; Skip invisible text. | 1285 ;; Skip invisible text. |
1368 ;; suggestion for `ps-postscript-code-directory' variable. | 1371 ;; suggestion for `ps-postscript-code-directory' variable. |
1369 ;; | 1372 ;; |
1370 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript | 1373 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript |
1371 ;; level 1 compatibility. | 1374 ;; level 1 compatibility. |
1372 ;; | 1375 ;; |
1373 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down, | 1376 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for: |
1374 ;; line number step, line number start and zebra stripe follow suggestions, and | 1377 ;; - upside-down, line number step, line number start and zebra stripe |
1375 ;; for XEmacs beta-tests. | 1378 ;; follow suggestions. |
1379 ;; - `ps-time-stamp-yyyy-mm-dd' and `ps-time-stamp-iso8601' suggestion. | |
1380 ;; - and for XEmacs beta-tests. | |
1376 ;; | 1381 ;; |
1377 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript | 1382 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript |
1378 ;; prologue code suggestion, for odd/even printing suggestion and for | 1383 ;; prologue code suggestion, for odd/even printing suggestion and for |
1379 ;; `ps-prologue-file' enhancement. | 1384 ;; `ps-prologue-file' enhancement. |
1380 ;; | 1385 ;; |
3109 delimiters '(' and ')'. | 3114 delimiters '(' and ')'. |
3110 | 3115 |
3111 For symbols with bound functions, the function is called and should return a | 3116 For symbols with bound functions, the function is called and should return a |
3112 string to be inserted into the array. For symbols with bound values, the value | 3117 string to be inserted into the array. For symbols with bound values, the value |
3113 should be a string to be inserted into the array. In either case, function or | 3118 should be a string to be inserted into the array. In either case, function or |
3114 variable, the string value has PostScript string delimiters added to it." | 3119 variable, the string value has PostScript string delimiters added to it. |
3120 | |
3121 If symbols are unbounded, they are silently ignored." | |
3115 :type '(repeat (choice :menu-tag "Left Header" | 3122 :type '(repeat (choice :menu-tag "Left Header" |
3116 :tag "Left Header" | 3123 :tag "Left Header" |
3117 string symbol)) | 3124 string symbol)) |
3118 :group 'ps-print-headers) | 3125 :group 'ps-print-headers) |
3119 | 3126 |
3132 as, for example, \"06/18/01\". | 3139 as, for example, \"06/18/01\". |
3133 | 3140 |
3134 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". | 3141 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". |
3135 | 3142 |
3136 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". | 3143 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". |
3144 | |
3145 `ps-time-stamp-yyyy-mm-dd' Return date as \"2001-06-18\" (ISO | |
3146 date). | |
3147 | |
3148 `ps-time-stamp-iso8601' Alias for `ps-time-stamp-yyyy-mm-dd'. | |
3137 | 3149 |
3138 You can also create your own time stamp function by using `format-time-string' | 3150 You can also create your own time stamp function by using `format-time-string' |
3139 \(which see)." | 3151 \(which see)." |
3140 :type '(repeat (choice :menu-tag "Right Header" | 3152 :type '(repeat (choice :menu-tag "Right Header" |
3141 :tag "Right Header" | 3153 :tag "Right Header" |
3155 ')'. | 3167 ')'. |
3156 | 3168 |
3157 For symbols with bound functions, the function is called and should return a | 3169 For symbols with bound functions, the function is called and should return a |
3158 string to be inserted into the array. For symbols with bound values, the value | 3170 string to be inserted into the array. For symbols with bound values, the value |
3159 should be a string to be inserted into the array. In either case, function or | 3171 should be a string to be inserted into the array. In either case, function or |
3160 variable, the string value has PostScript string delimiters added to it." | 3172 variable, the string value has PostScript string delimiters added to it. |
3173 | |
3174 If symbols are unbounded, they are silently ignored." | |
3161 :version "21.1" | 3175 :version "21.1" |
3162 :type '(repeat (choice :menu-tag "Left Footer" | 3176 :type '(repeat (choice :menu-tag "Left Footer" |
3163 :tag "Left Footer" | 3177 :tag "Left Footer" |
3164 string symbol)) | 3178 string symbol)) |
3165 :group 'ps-print-headers) | 3179 :group 'ps-print-headers) |
3179 as, for example, \"06/18/01\". | 3193 as, for example, \"06/18/01\". |
3180 | 3194 |
3181 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". | 3195 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". |
3182 | 3196 |
3183 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". | 3197 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". |
3198 | |
3199 `ps-time-stamp-yyyy-mm-dd' Return date as \"2001-06-18\" (ISO | |
3200 date). | |
3201 | |
3202 `ps-time-stamp-iso8601' Alias for `ps-time-stamp-yyyy-mm-dd'. | |
3184 | 3203 |
3185 You can also create your own time stamp function by using `format-time-string' | 3204 You can also create your own time stamp function by using `format-time-string' |
3186 \(which see)." | 3205 \(which see)." |
3187 :version "21.1" | 3206 :version "21.1" |
3188 :type '(repeat (choice :menu-tag "Right Footer" | 3207 :type '(repeat (choice :menu-tag "Right Footer" |
3692 (defun ps-time-stamp-mon-dd-yyyy () | 3711 (defun ps-time-stamp-mon-dd-yyyy () |
3693 "Return date as \"Jun 18 2001\"." | 3712 "Return date as \"Jun 18 2001\"." |
3694 (format-time-string "%b %d %Y")) | 3713 (format-time-string "%b %d %Y")) |
3695 | 3714 |
3696 | 3715 |
3716 (defun ps-time-stamp-yyyy-mm-dd () | |
3717 "Return date as \"2001-06-18\" (ISO date)." | |
3718 (format-time-string "%Y-%m-%d")) | |
3719 | |
3720 | |
3721 (defalias 'ps-time-stamp-iso8601 'ps-time-stamp-yyyy-mm-dd | |
3722 "Alias for `ps-time-stamp-yyyy-mm-dd' (which see).") | |
3723 | |
3724 | |
3697 (defun ps-time-stamp-hh:mm:ss () | 3725 (defun ps-time-stamp-hh:mm:ss () |
3698 "Return time as \"17:28:31\"." | 3726 "Return time as \"17:28:31\"." |
3699 (format-time-string "%T")) | 3727 (format-time-string "%T")) |
3700 | 3728 |
3701 | 3729 |
4111 | 4139 |
4112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 4140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
4113 ;; Internal functions and variables | 4141 ;; Internal functions and variables |
4114 | 4142 |
4115 | 4143 |
4144 (defun ps-message-log-max () | |
4145 (and (not (string= (buffer-name) "*Messages*")) | |
4146 message-log-max)) | |
4147 | |
4148 | |
4116 (defvar ps-print-hook nil) | 4149 (defvar ps-print-hook nil) |
4117 (defvar ps-print-begin-sheet-hook nil) | 4150 (defvar ps-print-begin-sheet-hook nil) |
4118 (defvar ps-print-begin-page-hook nil) | 4151 (defvar ps-print-begin-page-hook nil) |
4119 (defvar ps-print-begin-column-hook nil) | 4152 (defvar ps-print-begin-column-hook nil) |
4120 | 4153 |
4123 (ps-spool-without-faces from to region-p) | 4156 (ps-spool-without-faces from to region-p) |
4124 (ps-do-despool filename)) | 4157 (ps-do-despool filename)) |
4125 | 4158 |
4126 | 4159 |
4127 (defun ps-spool-without-faces (from to &optional region-p) | 4160 (defun ps-spool-without-faces (from to &optional region-p) |
4128 (run-hooks 'ps-print-hook) | 4161 (let ((message-log-max (ps-message-log-max))) ; to print *Messages* buffer |
4129 (ps-printing-region region-p from to) | 4162 (run-hooks 'ps-print-hook) |
4130 (ps-generate (current-buffer) from to 'ps-generate-postscript)) | 4163 (ps-printing-region region-p from to) |
4164 (ps-generate (current-buffer) from to 'ps-generate-postscript))) | |
4131 | 4165 |
4132 | 4166 |
4133 (defun ps-print-with-faces (from to &optional filename region-p) | 4167 (defun ps-print-with-faces (from to &optional filename region-p) |
4134 (ps-spool-with-faces from to region-p) | 4168 (ps-spool-with-faces from to region-p) |
4135 (ps-do-despool filename)) | 4169 (ps-do-despool filename)) |
4136 | 4170 |
4137 | 4171 |
4138 (defun ps-spool-with-faces (from to &optional region-p) | 4172 (defun ps-spool-with-faces (from to &optional region-p) |
4139 (run-hooks 'ps-print-hook) | 4173 (let ((message-log-max (ps-message-log-max))) ; to print *Messages* buffer |
4140 (ps-printing-region region-p from to) | 4174 (run-hooks 'ps-print-hook) |
4141 (ps-generate (current-buffer) from to 'ps-generate-postscript-with-faces)) | 4175 (ps-printing-region region-p from to) |
4176 (ps-generate (current-buffer) from to 'ps-generate-postscript-with-faces))) | |
4142 | 4177 |
4143 | 4178 |
4144 (defun ps-count-lines-preprint (from to) | 4179 (defun ps-count-lines-preprint (from to) |
4145 (or (and from to) | 4180 (or (and from to) |
4146 (error "The mark is not set now")) | 4181 (error "The mark is not set now")) |
4147 (list (count-lines from to))) | 4182 (let ((message-log-max (ps-message-log-max))) ; to count lines of *Messages* |
4183 (list (count-lines from to)))) | |
4148 | 4184 |
4149 | 4185 |
4150 (defun ps-count-lines (from to) | 4186 (defun ps-count-lines (from to) |
4151 (+ (count-lines from to) | 4187 (+ (count-lines from to) |
4152 (save-excursion | 4188 (save-excursion |
6549 (t (list list)))) | 6585 (t (list list)))) |
6550 | 6586 |
6551 (defun ps-kill-emacs-check () | 6587 (defun ps-kill-emacs-check () |
6552 (let (ps-buffer) | 6588 (let (ps-buffer) |
6553 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) | 6589 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) |
6590 (buffer-name ps-buffer) ; check if it's not killed | |
6554 (buffer-modified-p ps-buffer) | 6591 (buffer-modified-p ps-buffer) |
6555 (y-or-n-p "Unprinted PostScript waiting; print now? ") | 6592 (y-or-n-p "Unprinted PostScript waiting; print now? ") |
6556 (ps-despool)) | 6593 (ps-despool)) |
6557 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) | 6594 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) |
6595 (buffer-name ps-buffer) ; check if it's not killed | |
6558 (buffer-modified-p ps-buffer) | 6596 (buffer-modified-p ps-buffer) |
6559 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")) | 6597 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")) |
6560 (error "Unprinted PostScript")))) | 6598 (error "Unprinted PostScript")))) |
6561 | 6599 |
6562 (cond ((fboundp 'add-hook) | 6600 (cond ((fboundp 'add-hook) |
6790 | 6828 |
6791 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 6829 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6792 | 6830 |
6793 (provide 'ps-print) | 6831 (provide 'ps-print) |
6794 | 6832 |
6833 ;;; arch-tag: fb06a585-1112-4206-885d-a57d95d50579 | |
6795 ;;; ps-print.el ends here | 6834 ;;; ps-print.el ends here |