aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-06-01 09:22:20 +0000
committerGerd Moellmann2001-06-01 09:22:20 +0000
commitc86f4619ebd9991aaa06317e2e4535ef4a556eca (patch)
treee65cc3ffc01ed2f9edd05f7aff86c00e10c3e807
parentb14659e652ee50cd70da508a0c5d962979c111af (diff)
downloademacs-c86f4619ebd9991aaa06317e2e4535ef4a556eca.tar.gz
emacs-c86f4619ebd9991aaa06317e2e4535ef4a556eca.zip
Handle before-string and after-string overlay properties
in ps-print-*-with-faces commands. Doc fix. (ps-print-version): New version number (6.5.2). (ps-e-overlay-end): Alias for overlay-end to avoid compilation gripes for XEmacs. (ps-prefix-quote): Doc fix. (ps-setup, ps-print-quote, ps-generate-postscript-with-faces): Code fix. (ps-basic-plot-str, ps-plot-string): New funs.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/ps-print.el102
2 files changed, 90 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e74655cee59..5f8e4f67c42 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12001-06-01 Vinicius Jose Latorre <vinicius@cpqd.com.br>
2
3 * ps-print.el: Handle before-string and after-string overlay properties
4 in ps-print-*-with-faces commands. Doc fix.
5 (ps-print-version): New version number (6.5.2).
6 (ps-e-overlay-end): Alias for overlay-end to avoid compilation gripes
7 for XEmacs.
8 (ps-prefix-quote): Doc fix.
9 (ps-setup, ps-print-quote, ps-generate-postscript-with-faces): Code
10 fix.
11 (ps-basic-plot-str, ps-plot-string): New funs.
12
12001-05-31 Stefan Monnier <monnier@cs.yale.edu> 132001-05-31 Stefan Monnier <monnier@cs.yale.edu>
2 14
3 * progmodes/etags.el (tags-compression-info-list): Fix docstring 15 * progmodes/etags.el (tags-compression-info-list): Fix docstring
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 2763d55f0f4..912fc9cfb53 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;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 11;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
12;; Keywords: wp, print, PostScript 12;; Keywords: wp, print, PostScript
13;; Time-stamp: <2001/04/24 15:31:37 vinicius> 13;; Time-stamp: <2001/05/30 17:44:36 vinicius>
14;; Version: 6.5.1.1 14;; Version: 6.5.2
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.5.1.1" 17(defconst ps-print-version "6.5.2"
18 "ps-print.el, v 6.5.1.1 <2001/04/24 vinicius> 18 "ps-print.el, v 6.5.2 <2001/05/30 vinicius>
19 19
20Vinicius's last change version -- this file may have been edited as part of 20Vinicius's last change version -- this file may have been edited as part of
21Emacs without changes to the version number. When reporting bugs, please also 21Emacs without changes to the version number. When reporting bugs, please also
@@ -1484,6 +1484,7 @@ Please send all bug fixes and enhancements to
1484 (defalias 'ps-e-next-overlay-change 'next-overlay-change) 1484 (defalias 'ps-e-next-overlay-change 'next-overlay-change)
1485 (defalias 'ps-e-overlays-at 'overlays-at) 1485 (defalias 'ps-e-overlays-at 'overlays-at)
1486 (defalias 'ps-e-overlay-get 'overlay-get) 1486 (defalias 'ps-e-overlay-get 'overlay-get)
1487 (defalias 'ps-e-overlay-end 'overlay-end)
1487 (defalias 'ps-e-x-color-values 'x-color-values) 1488 (defalias 'ps-e-x-color-values 'x-color-values)
1488 (defalias 'ps-e-color-values 'color-values) 1489 (defalias 'ps-e-color-values 'color-values)
1489 (if (fboundp 'find-composition) 1490 (if (fboundp 'find-composition)
@@ -3274,7 +3275,8 @@ The table depends on the current ps-print setup."
3274 (interactive (list (count-lines (mark) (point)))) 3275 (interactive (list (count-lines (mark) (point))))
3275 (ps-nb-pages nb-lines)) 3276 (ps-nb-pages nb-lines))
3276 3277
3277(defvar ps-prefix-quote nil) 3278(defvar ps-prefix-quote nil
3279 "Used for `ps-print-quote' (which see).")
3278 3280
3279;;;###autoload 3281;;;###autoload
3280(defun ps-setup () 3282(defun ps-setup ()
@@ -3387,7 +3389,7 @@ The table depends on the current ps-print setup."
3387 '(20 . ps-bold-faces) 3389 '(20 . ps-bold-faces)
3388 '(20 . ps-italic-faces) 3390 '(20 . ps-italic-faces)
3389 '(20 . ps-underlined-faces) 3391 '(20 . ps-underlined-faces)
3390 ")\n 3392 " )\n
3391;; The following customized variables have long lists and are seldom modified: 3393;; The following customized variables have long lists and are seldom modified:
3392;; ps-page-dimensions-database 3394;; ps-page-dimensions-database
3393;; ps-font-info-database 3395;; ps-font-info-database
@@ -3401,6 +3403,27 @@ The table depends on the current ps-print setup."
3401 3403
3402 3404
3403(defun ps-print-quote (elt) 3405(defun ps-print-quote (elt)
3406 "Quote ELT for printing (used for showing settings).
3407
3408If ELT is nil, return an empty string.
3409If ELT is string, return it.
3410Otherwise, ELT should be a cons (LEN . SYM) where SYM is a variable symbol and
3411LEN is the field length where SYM name will be inserted. The variable
3412`ps-prefix-quote' is used to form the string, if `ps-prefix-quote' is nil, it's
3413used \"(setq \" as prefix; otherwise, it's used \" \". So, the string
3414generated is:
3415
3416 * If `ps-prefix-quote' is nil:
3417 \"(setq SYM-NAME SYM-VALUE\"
3418 |<------->|
3419 LEN
3420
3421 * If `ps-prefix-quote' is non-nil:
3422 \" SYM-NAME SYM-VALUE\"
3423 |<------->|
3424 LEN
3425
3426If `ps-prefix-quote' is nil, it's set to t after generating string."
3404 (cond 3427 (cond
3405 ((null elt) "") 3428 ((null elt) "")
3406 ((stringp elt) elt) 3429 ((stringp elt) elt)
@@ -3411,8 +3434,8 @@ The table depends on the current ps-print setup."
3411 (len (length key)) 3434 (len (length key))
3412 (val (symbol-value sym))) 3435 (val (symbol-value sym)))
3413 (concat (if ps-prefix-quote 3436 (concat (if ps-prefix-quote
3414 ps-prefix-quote 3437 " "
3415 (setq ps-prefix-quote " ") 3438 (setq ps-prefix-quote t)
3416 "(setq ") 3439 "(setq ")
3417 key 3440 key
3418 (if (> col len) 3441 (if (> col len)
@@ -5585,6 +5608,16 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5585 (cons to (* todo char-width)) 5608 (cons to (* todo char-width))
5586 (cons (+ from avail) ps-width-remaining)))) 5609 (cons (+ from avail) ps-width-remaining))))
5587 5610
5611(defun ps-basic-plot-str (from to string)
5612 (let* ((wrappoint (ps-find-wrappoint from to
5613 (ps-avg-char-width 'ps-font-for-text)))
5614 (to (car wrappoint))
5615 (str (substring string from to)))
5616 (ps-mule-prepare-ascii-font str)
5617 (ps-output-string str)
5618 (ps-output " S\n")
5619 wrappoint))
5620
5588(defun ps-basic-plot-string (from to &optional bg-color) 5621(defun ps-basic-plot-string (from to &optional bg-color)
5589 (let* ((wrappoint (ps-find-wrappoint from to 5622 (let* ((wrappoint (ps-find-wrappoint from to
5590 (ps-avg-char-width 'ps-font-for-text))) 5623 (ps-avg-char-width 'ps-font-for-text)))
@@ -5646,6 +5679,10 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5646 " FG\n")) 5679 " FG\n"))
5647 5680
5648 5681
5682(defsubst ps-plot-string (string)
5683 (ps-plot 'ps-basic-plot-str 0 (length string) string))
5684
5685
5649(defvar ps-current-effect 0) 5686(defvar ps-current-effect 0)
5650 5687
5651 5688
@@ -6020,7 +6057,8 @@ If FACE is not a valid face name, it is used default face."
6020 (let ((property-change from) 6057 (let ((property-change from)
6021 (overlay-change from) 6058 (overlay-change from)
6022 (save-buffer-invisibility-spec buffer-invisibility-spec) 6059 (save-buffer-invisibility-spec buffer-invisibility-spec)
6023 (buffer-invisibility-spec nil)) 6060 (buffer-invisibility-spec nil)
6061 before-string after-string)
6024 (while (< from to) 6062 (while (< from to)
6025 (and (< property-change to) ; Don't search for property change 6063 (and (< property-change to) ; Don't search for property change
6026 ; unless previous search succeeded. 6064 ; unless previous search succeeded.
@@ -6029,7 +6067,9 @@ If FACE is not a valid face name, it is used default face."
6029 ; unless previous search succeeded. 6067 ; unless previous search succeeded.
6030 (setq overlay-change (min (ps-e-next-overlay-change from) 6068 (setq overlay-change (min (ps-e-next-overlay-change from)
6031 to))) 6069 to)))
6032 (setq position (min property-change overlay-change)) 6070 (setq position (min property-change overlay-change)
6071 before-string nil
6072 after-string nil)
6033 ;; The code below is not quite correct, 6073 ;; The code below is not quite correct,
6034 ;; because a non-nil overlay invisible property 6074 ;; because a non-nil overlay invisible property
6035 ;; which is inactive according to the current value 6075 ;; which is inactive according to the current value
@@ -6051,24 +6091,38 @@ If FACE is not a valid face name, it is used default face."
6051 (while (and overlays 6091 (while (and overlays
6052 (not (eq face 'emacs--invisible--face))) 6092 (not (eq face 'emacs--invisible--face)))
6053 (let* ((overlay (car overlays)) 6093 (let* ((overlay (car overlays))
6054 (overlay-invisible (ps-e-overlay-get overlay 'invisible)) 6094 (overlay-invisible
6055 (overlay-priority (or (ps-e-overlay-get overlay 'priority) 6095 (ps-e-overlay-get overlay 'invisible))
6056 0))) 6096 (overlay-priority
6097 (or (ps-e-overlay-get overlay 'priority) 0)))
6057 (and (> overlay-priority face-priority) 6098 (and (> overlay-priority face-priority)
6058 (setq face 6099 (setq before-string
6059 (cond ((if (eq save-buffer-invisibility-spec t) 6100 (or (ps-e-overlay-get overlay 'before-string)
6060 (not (null overlay-invisible)) 6101 before-string)
6061 (or (memq overlay-invisible 6102 after-string
6062 save-buffer-invisibility-spec) 6103 (or (and (<= (ps-e-overlay-end overlay) position)
6063 (assq overlay-invisible 6104 (ps-e-overlay-get overlay 'after-string))
6064 save-buffer-invisibility-spec))) 6105 after-string)
6065 'emacs--invisible--face) 6106 face-priority overlay-priority
6066 ((ps-e-overlay-get overlay 'face)) 6107 face
6067 (t face)) 6108 (cond
6068 face-priority overlay-priority))) 6109 ((if (eq save-buffer-invisibility-spec t)
6110 (not (null overlay-invisible))
6111 (or (memq overlay-invisible
6112 save-buffer-invisibility-spec)
6113 (assq overlay-invisible
6114 save-buffer-invisibility-spec)))
6115 'emacs--invisible--face)
6116 ((ps-e-overlay-get overlay 'face))
6117 (t face)
6118 ))))
6069 (setq overlays (cdr overlays)))) 6119 (setq overlays (cdr overlays))))
6070 ;; Plot up to this record. 6120 ;; Plot up to this record.
6121 (and before-string
6122 (ps-plot-string before-string))
6071 (ps-plot-with-face from position face) 6123 (ps-plot-with-face from position face)
6124 (and after-string
6125 (ps-plot-string after-string))
6072 (setq from position))))) 6126 (setq from position)))))
6073 (ps-plot-with-face from to face)))) 6127 (ps-plot-with-face from to face))))
6074 6128